-
-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix activeElement check #193 * Add test and fix check
- Loading branch information
1 parent
df6aec7
commit 722d52f
Showing
2 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
/* eslint-env jest */ | ||
import React from 'react'; | ||
import Tab from '../Tab'; | ||
import TabList from '../TabList'; | ||
import TabPanel from '../TabPanel'; | ||
import Tabs from '../Tabs'; | ||
import { reset as resetIdCounter } from '../../helpers/uuid'; | ||
|
||
function createTabs(props = {}) { | ||
return ( | ||
<Tabs {...props}> | ||
<TabList> | ||
<Tab>Foo</Tab> | ||
<Tab>Bar</Tab> | ||
<Tab> | ||
<a>Baz</a> | ||
</Tab> | ||
<Tab disabled>Qux</Tab> | ||
</TabList> | ||
<TabPanel>Hello Foo</TabPanel> | ||
<TabPanel>Hello Bar</TabPanel> | ||
<TabPanel>Hello Baz</TabPanel> | ||
<TabPanel>Hello Qux</TabPanel> | ||
</Tabs> | ||
); | ||
} | ||
|
||
describe('ServerSide <Tabs />', () => { | ||
beforeEach(() => resetIdCounter()); | ||
|
||
beforeAll(() => { | ||
// eslint-disable-next-line no-console | ||
console.error = error => { | ||
throw new Error(error); | ||
}; | ||
}); | ||
|
||
test('does not crash in node environments', () => { | ||
expect(() => createTabs()).not.toThrow(); | ||
}); | ||
}); |