Skip to content

Commit

Permalink
✅ fix lint and test case
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Mar 17, 2020
1 parent c60ee27 commit 03eff43
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
'prefer-destructuring': 0,
'react/no-unused-prop-types': 0,
'max-len': 0,
'brace-style': 0,
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}],
'brace-style': 0
},
};
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,28 @@
"prepublishOnly": "npm run lint && npm run test && npm run compile && np --no-cleanup --yolo --no-publish"
},
"devDependencies": {
"@umijs/fabric": "^2.0.4",
"coveralls": "^3.0.6",
"cross-env": "^7.0.2",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"enzyme-to-json": "^3.3.4",
"eslint": "^6.8.0",
"fastclick": "~1.0.6",
"father": "^2.29.2",
"history": "^1.17.0",
"immutability-helper": "^3.0.1",
"less-loader": "^5.0.0",
"np": "^6.2.0",
"preact": "^8.2.1",
"preact-compat": "^3.16.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-dnd": "^7.0.2",
"react-dnd-html5-backend": "^7.0.2",
"react-dom": "^16.0.0",
"react-router": "^3.0.0",
"react-test-renderer": "^16.0.0",
"sortablejs": "^1.7.0",
"father": "^2.29.2",
"@umijs/fabric": "^2.0.4"
"sortablejs": "^1.7.0"
},
"dependencies": {
"classnames": "2.x",
Expand Down
12 changes: 12 additions & 0 deletions tests/__snapshots__/a11y.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ exports[`<TabsComponent /> should render correctly 1`] = `
role="tablist"
tabindex="-1"
>
<input
id="input"
style="float:right"
/>
<div
class="rc-tabs-nav-container"
>
Expand Down Expand Up @@ -172,6 +176,10 @@ exports[`<TabsComponent withTabKey /> should render correctly 1`] = `
role="tablist"
tabindex="-1"
>
<input
id="input"
style="float:right"
/>
<div
class="rc-tabs-nav-container"
>
Expand Down Expand Up @@ -343,6 +351,10 @@ exports[`<TabsComponent withTabKey withCustomId /> should render correctly 1`] =
role="tablist"
tabindex="-1"
>
<input
id="input"
style="float:right"
/>
<div
class="rc-tabs-nav-container"
>
Expand Down
18 changes: 9 additions & 9 deletions tests/a11y.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ describe('<TabsComponent />', () => {
expect(renderToJson(render(component))).toMatchSnapshot();
});

it('extraContent not listen keyboard naviagtion', () => {
wrapper.find('#input').simulate('keyDown', {
keyCode: KeyCode.RIGHT,
which: KeyCode.RIGHT,
});
expect(tabs.at(0).getDOMNode().className).toContain('rc-tabs-tab-active');
expect(tabs.at(1).getDOMNode().className).not.toContain('rc-tabs-tab-active');
});

it('first tab should be selected by default', () => {
const firstTab = tabs.first();
const selectedTab = tabs.find('[aria-selected="true"]');
Expand All @@ -77,15 +86,6 @@ describe('<TabsComponent />', () => {
thirdTab.simulate('click');
expect(document.activeElement).toBe(thirdTab.getDOMNode());
});

it('extraContent not listen keyboard naviagtion', () => {
wrapper.find('#input').simulate('keyDown', {
keyCode: KeyCode.RIGHT,
which: KeyCode.RIGHT,
});
expect(tabs.at(0).getDOMNode().className).toContain('rc-tabs-tab-active');
expect(tabs.at(1).getDOMNode().className).not.toContain('rc-tabs-tab-active');
});
});

describe('<TabsComponent withTabKey />', () => {
Expand Down

0 comments on commit 03eff43

Please sign in to comment.