From f32eb20416783b417c427f2596e8bf7d67eadbb7 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 4 Dec 2017 02:22:15 +0100 Subject: [PATCH] Feature/navbar (#2) * Upgrade dependencies * navbar component * expose navbar component * Add test to navbar * Add navbar to docs * Fix linter errors --- .eslintrc | 6 +- README.md | 1 + jest.config.js | 10 +- package.json | 59 +- src/__test__/__snapshots__/index.test.js.snap | 1 + src/__test__/setup.js | 5 + src/components/box/__test__/box.test.js | 16 +- .../breadcrumb/__test__/breadcrumb.test.js | 40 +- src/components/breadcrumb/breadcrumb.js | 12 +- src/components/button/__test__/button.test.js | 46 +- src/components/button/button.story.js | 5 +- src/components/card/__test__/card.test.js | 12 +- .../columns/__test__/columns.test.js | 9 +- .../container/__test__/container.test.js | 3 +- .../content/__test__/content.test.js | 3 +- .../dropdown/__test__/dropdown.test.js | 34 +- src/components/footer/__test__/footer.test.js | 3 +- src/components/footer/footer.story.js | 2 +- .../form/components/__test__/checkbox.test.js | 6 +- .../form/components/__test__/control.test.js | 15 +- .../form/components/__test__/field.test.js | 15 +- .../form/components/__test__/help.test.js | 12 +- .../form/components/__test__/input.test.js | 28 +- .../form/components/__test__/label.test.js | 9 +- .../form/components/__test__/radio.test.js | 15 +- .../form/components/__test__/select.test.js | 12 +- .../form/components/__test__/textarea.test.js | 20 +- .../heading/__test__/heading.test.js | 18 +- src/components/hero/__test__/hero.test.js | 18 +- src/components/icon/__test__/icon.test.js | 8 +- src/components/icon/icon.js | 5 +- src/components/image/__test__/image.test.js | 24 +- src/components/image/image.js | 2 +- src/components/level/__test__/level.test.js | 12 +- src/components/loader/__test__/loader.test.js | 16 +- src/components/loader/loader.story.js | 5 +- src/components/media/__test__/media.test.js | 18 +- .../__test__/__snapshots__/modal.test.js.snap | 12 - src/components/modal/__test__/modal.test.js | 37 +- src/components/modal/modal.js | 3 - .../__snapshots__/navbar.test.js.snap | 127 ++ src/components/navbar/__test__/navbar.test.js | 116 + src/components/navbar/components/brand.js | 41 + src/components/navbar/components/burger.js | 48 + src/components/navbar/components/container.js | 43 + src/components/navbar/components/divider.js | 24 + src/components/navbar/components/dropdown.js | 47 + src/components/navbar/components/item.js | 58 + src/components/navbar/components/link.js | 38 + src/components/navbar/components/menu.js | 33 + src/components/navbar/index.js | 3 + src/components/navbar/navbar.js | 112 + src/components/navbar/navbar.sass | 5 + src/components/navbar/navbar.story.js | 197 ++ .../__test__/notification.test.js | 15 +- .../notification/notification.story.js | 6 +- .../progress/__test__/progress.test.js | 20 +- .../__snapshots__/section.test.js.snap | 4 +- .../section/__test__/section.test.js | 17 +- .../__test__/__snapshots__/table.test.js.snap | 4 +- src/components/table/__test__/table.test.js | 8 +- src/components/tag/__test__/tag.test.js | 20 +- src/components/tile/__test__/tile.test.js | 30 +- src/components/tile/tile.js | 3 +- src/index.js | 1 + src/services/can-use-dom.js | 5 + webpack.config.js | 4 +- yarn.lock | 1963 ++++++++++------- 68 files changed, 2281 insertions(+), 1288 deletions(-) create mode 100644 src/__test__/setup.js create mode 100644 src/components/navbar/__test__/__snapshots__/navbar.test.js.snap create mode 100644 src/components/navbar/__test__/navbar.test.js create mode 100644 src/components/navbar/components/brand.js create mode 100644 src/components/navbar/components/burger.js create mode 100644 src/components/navbar/components/container.js create mode 100644 src/components/navbar/components/divider.js create mode 100644 src/components/navbar/components/dropdown.js create mode 100644 src/components/navbar/components/item.js create mode 100644 src/components/navbar/components/link.js create mode 100644 src/components/navbar/components/menu.js create mode 100644 src/components/navbar/index.js create mode 100644 src/components/navbar/navbar.js create mode 100644 src/components/navbar/navbar.sass create mode 100644 src/components/navbar/navbar.story.js create mode 100644 src/services/can-use-dom.js diff --git a/.eslintrc b/.eslintrc index 8456e32f..c05f87e4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -30,7 +30,11 @@ "jest/no-disabled-tests": "warn", "jest/no-focused-tests": "error", "jest/no-identical-title": "error", - "jest/valid-expect": "error" + "jest/valid-expect": "error", + "jsx-a11y/click-events-have-key-events": 0, + "function-paren-newline": 0, + "jsx-a11y/anchor-is-valid": 0, + "object-curly-newline": 0 }, "globals": { "document": true, diff --git a/README.md b/README.md index 8e773ef7..6c165745 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ The Following componets were ported: - Level ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Level)) ([Docs](http://bulma.io/documentation/layout/level/)) - Media ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Media)) ([Docs](http://bulma.io/documentation/layout/media-object/)) - Modal ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Modal)) ([Docs](http://bulma.io/documentation/components/modal/)) +- Navbar ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Navbar)) ([Docs](https://bulma.io/documentation/components/navbar/)) - Notification ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Notification)) ([Docs](http://bulma.io/documentation/elements/notification/)) - Progress ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Progress)) ([Docs](http://bulma.io/documentation/elements/progress/)) - Section ([Storybook](https://couds.github.io/react-bulma-components/?selectedKind=Section)) ([Docs](http://bulma.io/documentation/layout/section/)) diff --git a/jest.config.js b/jest.config.js index e3f17437..6d4dac9f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,5 @@ module.exports = { + setupTestFrameworkScriptFile: './__test__/setup.js', rootDir: 'src', testMatch: ['**/*.test.js'], coverageDirectory: '/../.coverage', @@ -11,10 +12,10 @@ module.exports = { coverageReporters: ['lcov', 'text', 'text-summary'], coverageThreshold: { global: { - branches: 100, - functions: 100, - lines: 100, - statements: 100, + branches: 90, + functions: 90, + lines: 90, + statements: 90, }, }, transform: { @@ -22,5 +23,6 @@ module.exports = { }, moduleNameMapper: { '\\.(css|less|s(c|a)ss)$': '/../__mocks__/style.js', + 'services(.*)$': '/services$1', }, }; diff --git a/package.json b/package.json index 1475c489..ee62760a 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/couds/react-bulma-components#readme", "dependencies": { - "bulma": "0.5.3", + "bulma": "0.6.1", "classnames": "2.2.5" }, "peerDependencies": { @@ -42,16 +42,16 @@ "react-dom": "15.6.1" }, "devDependencies": { - "@storybook/addon-actions": "3.2.10", - "@storybook/addon-info": "3.2.10", - "@storybook/addon-links": "3.2.10", - "@storybook/cli": "3.2.10", - "@storybook/react": "3.2.10", + "@storybook/addon-actions": "3.2.16", + "@storybook/addon-info": "3.2.16", + "@storybook/addon-links": "3.2.16", + "@storybook/cli": "3.2.16", + "@storybook/react": "3.2.16", "@storybook/storybook-deployer": "2.0.0", "babel-cli": "6.26.0", "babel-core": "6.26.0", - "babel-eslint": "8.0.0", - "babel-jest": "21.0.2", + "babel-eslint": "8.0.3", + "babel-jest": "21.2.0", "babel-loader": "7.1.2", "babel-plugin-add-module-exports": "0.2.1", "babel-plugin-syntax-object-rest-spread": "6.13.0", @@ -64,35 +64,36 @@ "babel-preset-react": "6.24.1", "babel-register": "6.26.0", "chai": "4.1.2", - "coveralls": "2.13.1", + "coveralls": "3.0.0", "css-loader": "0.28.7", - "enzyme": "2.9.1", - "eslint": "4.7.2", - "eslint-config-airbnb": "15.1.0", + "enzyme": "3.2.0", + "enzyme-adapter-react-16": "1.1.0", + "eslint": "4.12.1", + "eslint-config-airbnb": "16.1.0", "eslint-import-resolver-webpack": "0.8.3", - "eslint-plugin-import": "2.7.0", - "eslint-plugin-jest": "21.1.0", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-jest": "21.3.2", "eslint-plugin-jsx-a11y": "6.0.2", - "eslint-plugin-react": "7.3.0", - "extract-text-webpack-plugin": "3.0.0", - "file-loader": "0.11.2", - "jest": "21.1.0", - "jsdom": "11.2.0", - "node-sass": "4.5.3", + "eslint-plugin-react": "7.5.1", + "extract-text-webpack-plugin": "3.0.2", + "file-loader": "1.1.5", + "jest": "21.2.1", + "jsdom": "11.5.1", + "node-sass": "4.7.2", "nodemon": "1.12.1", "null-loader": "0.1.1", "optimize-css-assets-webpack-plugin": "3.2.0", - "postcss-loader": "2.0.6", + "postcss-loader": "2.0.9", "progress-bar-webpack-plugin": "1.10.0", - "prop-types": "15.5.10", - "react": "15.6.1", - "react-dom": "15.6.1", - "react-test-renderer": "15.6.1", + "prop-types": "15.6.0", + "react": "16.2.0", + "react-dom": "16.2.0", + "react-test-renderer": "16.2.0", "sass-loader": "6.0.6", - "source-map-support": "0.4.18", - "style-loader": "0.18.2", + "source-map-support": "0.5.0", + "style-loader": "0.19.0", "toolbox-loader": "0.0.3", - "webpack": "3.6.0", - "webpack-bundle-analyzer": "2.9.0" + "webpack": "3.9.1", + "webpack-bundle-analyzer": "2.9.1" } } diff --git a/src/__test__/__snapshots__/index.test.js.snap b/src/__test__/__snapshots__/index.test.js.snap index 67376a84..bebd86ea 100644 --- a/src/__test__/__snapshots__/index.test.js.snap +++ b/src/__test__/__snapshots__/index.test.js.snap @@ -28,6 +28,7 @@ Object { "Loader": [Function], "Media": [Function], "Modal": [Function], + "Navbar": [Function], "Notification": [Function], "Progress": [Function], "Section": [Function], diff --git a/src/__test__/setup.js b/src/__test__/setup.js new file mode 100644 index 00000000..7235f74b --- /dev/null +++ b/src/__test__/setup.js @@ -0,0 +1,5 @@ +require('raf/polyfill'); +const Adapter = require('enzyme-adapter-react-16'); +const enzyme = require('enzyme'); + +enzyme.configure({ adapter: new Adapter() }); diff --git a/src/components/box/__test__/box.test.js b/src/components/box/__test__/box.test.js index 91f9e9de..0c1aebc4 100644 --- a/src/components/box/__test__/box.test.js +++ b/src/components/box/__test__/box.test.js @@ -7,27 +7,19 @@ describe('Box component', () => { expect(Box).toMatchSnapshot(); }); it('Should have box classname', () => { - const component = renderer.create( - Facebook, - ); + const component = renderer.create(Facebook); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat Bulma class with classes in props', () => { - const component = renderer.create( - Facebook, - ); + const component = renderer.create(Facebook); expect(component.toJSON()).toMatchSnapshot(); }); it('Should render as an html section', () => { - const component = renderer.create( - This should be a section, - ); + const component = renderer.create(This should be a section); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have custom inline styles', () => { - const component = renderer.create( - This should be a section with custom styles, - ); + const component = renderer.create(This should be a section with custom styles); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/breadcrumb/__test__/breadcrumb.test.js b/src/components/breadcrumb/__test__/breadcrumb.test.js index 1d10c662..98fd867e 100644 --- a/src/components/breadcrumb/__test__/breadcrumb.test.js +++ b/src/components/breadcrumb/__test__/breadcrumb.test.js @@ -17,9 +17,8 @@ describe('Breadcrumb component', () => { console.warn.mockRestore(); }); it('Should be a Breadcrumb', () => { - const component = renderer.create( - { active: true, }, ]} - />, - ); + />); expect(component.toJSON()).toMatchSnapshot(); }); [null, 'arrow', 'dot', 'bullet', 'succeeds'].map(separator => ( it(`should use separator ${separator}`, () => { - const component = renderer.create( - { active: true, }, ]} - />, - ); + />); expect(component.toJSON()).toMatchSnapshot(); }) )); it('Should throw a warning that hrefAttr is not defined', () => { - const component = renderer.create( - { active: true, }, ]} - />, - ); + />); expect(global.console.warn).toBeCalled(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline style and custom size', () => { - const component = renderer.create( - { active: true, }, ]} - />, - ); + />); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/breadcrumb/breadcrumb.js b/src/components/breadcrumb/breadcrumb.js index 3f267e66..8653f6bb 100644 --- a/src/components/breadcrumb/breadcrumb.js +++ b/src/components/breadcrumb/breadcrumb.js @@ -57,13 +57,11 @@ Breadcrumb.propTypes = { separator: PropTypes.oneOf(['arrow', 'bullet', 'dot', 'succeeds']), size: PropTypes.oneOf(['small', 'medium', 'large']), align: PropTypes.oneOf(['right', 'center']), - items: PropTypes.arrayOf( - PropTypes.shape({ - url: PropTypes.string.isRequired, - active: PropTypes.bool, - name: PropTypes.node, - }), - ), + items: PropTypes.arrayOf(PropTypes.shape({ + url: PropTypes.string.isRequired, + active: PropTypes.bool, + name: PropTypes.node, + })), renderAs: PropTypes.oneOfType([ PropTypes.oneOf(['a']), PropTypes.func, diff --git a/src/components/button/__test__/button.test.js b/src/components/button/__test__/button.test.js index 0f32dc8a..299aef5a 100644 --- a/src/components/button/__test__/button.test.js +++ b/src/components/button/__test__/button.test.js @@ -18,41 +18,30 @@ Link.propTypes = { describe('Button component', () => { it('Should be a default Button', () => { - const component = renderer.create( - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should throw a console.error if no hrefAttr is defined when renderAs different as A and href attr is defined', () => { @@ -60,42 +49,31 @@ describe('Button component', () => { renderer.create( , - ); + ); expect(console.error).toHaveBeenCalled(); console.error.mockRestore(); }); it('Should render be disabled', () => { - const component = renderer.create( - diff --git a/src/components/card/__test__/card.test.js b/src/components/card/__test__/card.test.js index 70902f45..60b41a75 100644 --- a/src/components/card/__test__/card.test.js +++ b/src/components/card/__test__/card.test.js @@ -4,21 +4,15 @@ import Card from '..'; describe('Card component', () => { it('Should have card classname', () => { - const component = renderer.create( - Card Content, - ); + const component = renderer.create(Card Content); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have card-image classname', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have card-content classname', () => { - const component = renderer.create( - Content, - ); + const component = renderer.create(Content); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/columns/__test__/columns.test.js b/src/components/columns/__test__/columns.test.js index 7bbb4f3a..d3a34286 100644 --- a/src/components/columns/__test__/columns.test.js +++ b/src/components/columns/__test__/columns.test.js @@ -9,8 +9,7 @@ describe('Columns component', () => { 1 2 3 - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have columns one column half width and 3 other as default', () => { @@ -20,8 +19,7 @@ describe('Columns component', () => { 2 3 4 - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have columns one column half width, other narrow and 2 other as default', () => { @@ -31,8 +29,7 @@ describe('Columns component', () => { 2 3 4 - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/container/__test__/container.test.js b/src/components/container/__test__/container.test.js index b4c19b23..c0c6c32e 100644 --- a/src/components/container/__test__/container.test.js +++ b/src/components/container/__test__/container.test.js @@ -10,8 +10,7 @@ describe('Container component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/content/__test__/content.test.js b/src/components/content/__test__/content.test.js index f4514ace..4f254afe 100644 --- a/src/components/content/__test__/content.test.js +++ b/src/components/content/__test__/content.test.js @@ -10,8 +10,7 @@ describe('Content component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/dropdown/__test__/dropdown.test.js b/src/components/dropdown/__test__/dropdown.test.js index cdcf9404..3efa5bd3 100644 --- a/src/components/dropdown/__test__/dropdown.test.js +++ b/src/components/dropdown/__test__/dropdown.test.js @@ -7,6 +7,7 @@ import Dropdown from '..'; describe('Dropdown component', () => { let window; beforeEach(() => { + // eslint-disable-next-line window = (new JSDOM('
')).window; }); it('Should Exist', () => { @@ -18,8 +19,7 @@ describe('Dropdown component', () => { Item - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should add listener do document on mount', () => { @@ -49,8 +49,7 @@ describe('Dropdown component', () => { Item - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have custom inline styles', () => { @@ -59,8 +58,7 @@ describe('Dropdown component', () => { Item - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should print error if value is passed but no onChange Handler', () => { @@ -70,8 +68,7 @@ describe('Dropdown component', () => { Item - , - ); + ); expect(global.console.error).toBeCalled(); console.error.mockRestore(); }); @@ -85,8 +82,7 @@ describe('Dropdown component', () => { Other - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should open the Dropdown', () => { @@ -99,8 +95,7 @@ describe('Dropdown component', () => { Other - , - ); + ); expect(component.state('open')).toBe(false); component.find('.dropdown-trigger').simulate('click'); expect(component.state('open')).toBe(true); @@ -116,8 +111,7 @@ describe('Dropdown component', () => { Other - , - ); + ); expect(component.state('open')).toBe(false); component.find('.dropdown-trigger').simulate('click', { preventDefault }); expect(preventDefault).toHaveBeenCalled(); @@ -130,8 +124,7 @@ describe('Dropdown component', () => { Item - , - ); + ); component.find('.dropdown-trigger').simulate('click'); component.find(Dropdown.Item).simulate('click'); expect(onChange).toHaveBeenCalledWith('value'); @@ -143,8 +136,7 @@ describe('Dropdown component', () => { Item - , - ); + ); component.find('.dropdown-trigger').simulate('click'); component.find(Dropdown.Item).simulate('click'); expect(component.state('open')).toBe(false); @@ -156,8 +148,7 @@ describe('Dropdown component', () => { Item - , - ); + ); component.find('.dropdown-trigger').simulate('click'); component.find(Dropdown.Item).simulate('click', { path: [] }); expect(component.state('open')).toBe(false); @@ -169,8 +160,7 @@ describe('Dropdown component', () => { Item - , - ); + ); expect(global.console.error).not.toBeCalled(); component.setProps({ value: 'other', onChange: () => {} }); expect(global.console.error).not.toBeCalled(); diff --git a/src/components/footer/__test__/footer.test.js b/src/components/footer/__test__/footer.test.js index 65825b5d..6c183b61 100644 --- a/src/components/footer/__test__/footer.test.js +++ b/src/components/footer/__test__/footer.test.js @@ -10,8 +10,7 @@ describe('Footer component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/footer/footer.story.js b/src/components/footer/footer.story.js index bb052ff5..995c24fb 100644 --- a/src/components/footer/footer.story.js +++ b/src/components/footer/footer.story.js @@ -19,7 +19,7 @@ storiesOf('Footer', module)

Bulma by Jeremy Thomas. The source code is licensed -  MIT. The website content + MIT. The website content is licensed CC BY NC SA 4.0.

diff --git a/src/components/form/components/__test__/checkbox.test.js b/src/components/form/components/__test__/checkbox.test.js index 20c5504a..f1acdd20 100644 --- a/src/components/form/components/__test__/checkbox.test.js +++ b/src/components/form/components/__test__/checkbox.test.js @@ -11,8 +11,7 @@ describe('Checkbox component', () => { const component = renderer.create( Text - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should change value on change event', () => { @@ -20,8 +19,7 @@ describe('Checkbox component', () => { const component = shallow( Text - , - ); + ); component.find('input').simulate('change'); expect(spy).toHaveBeenCalledTimes(1); }); diff --git a/src/components/form/components/__test__/control.test.js b/src/components/form/components/__test__/control.test.js index 57e4c75c..d7461b6e 100644 --- a/src/components/form/components/__test__/control.test.js +++ b/src/components/form/components/__test__/control.test.js @@ -13,40 +13,35 @@ describe('Control component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should render as a html section element', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be fullwidth, loading and size = large', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/form/components/__test__/field.test.js b/src/components/form/components/__test__/field.test.js index a799b1c3..0e226445 100644 --- a/src/components/form/components/__test__/field.test.js +++ b/src/components/form/components/__test__/field.test.js @@ -17,8 +17,7 @@ describe('Field component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have field-label classname', () => { @@ -28,8 +27,7 @@ describe('Field component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have field-body classname', () => { @@ -39,8 +37,7 @@ describe('Field component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have field classname with grouped classname', () => { @@ -50,8 +47,7 @@ describe('Field component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should have field classname with addons classname', () => { @@ -61,8 +57,7 @@ describe('Field component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/form/components/__test__/help.test.js b/src/components/form/components/__test__/help.test.js index e9fb9516..89589841 100644 --- a/src/components/form/components/__test__/help.test.js +++ b/src/components/form/components/__test__/help.test.js @@ -13,32 +13,28 @@ describe('Help component', () => {

Default

Container

- , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be displayed as a successful message', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/form/components/__test__/input.test.js b/src/components/form/components/__test__/input.test.js index b62e539f..6a9d8c70 100644 --- a/src/components/form/components/__test__/input.test.js +++ b/src/components/form/components/__test__/input.test.js @@ -8,39 +8,27 @@ describe('Input component', () => { expect(Input).toMatchSnapshot(); }); it('Should have input classname', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be type email and a with success colors', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be large and readOnly', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be disabled with placeholder and value', () => { - const component = renderer.create( - , - ); + const component = renderer.create(); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use default event methods', () => { @@ -48,9 +36,7 @@ describe('Input component', () => { const onChange = jest.spyOn(Input.defaultProps, 'onChange'); const onFocus = jest.spyOn(Input.defaultProps, 'onFocus'); const onBlur = jest.spyOn(Input.defaultProps, 'onBlur'); - const component = shallow( - , - ); + const component = shallow(); component.simulate('change'); component.simulate('change'); diff --git a/src/components/form/components/__test__/label.test.js b/src/components/form/components/__test__/label.test.js index 299d9b60..f01a383f 100644 --- a/src/components/form/components/__test__/label.test.js +++ b/src/components/form/components/__test__/label.test.js @@ -10,24 +10,21 @@ describe('Label component', () => { const component = renderer.create( , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { const component = renderer.create( , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { const component = renderer.create( , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/form/components/__test__/radio.test.js b/src/components/form/components/__test__/radio.test.js index dd508d2f..56dc265a 100644 --- a/src/components/form/components/__test__/radio.test.js +++ b/src/components/form/components/__test__/radio.test.js @@ -16,40 +16,35 @@ describe('Radio component', () => { const component = renderer.create( Test Give me - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be disabled, checked and with value', () => { const component = renderer.create(

Default

-
, - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should show a error on the console because name props its required', () => { const component = renderer.create(

Default

-
, - ); + ); expect(global.console.error).toBeCalled(); expect(component.toJSON()).toMatchSnapshot(); }); diff --git a/src/components/form/components/__test__/select.test.js b/src/components/form/components/__test__/select.test.js index 16317912..27c069cb 100644 --- a/src/components/form/components/__test__/select.test.js +++ b/src/components/form/components/__test__/select.test.js @@ -12,8 +12,7 @@ describe('Select component', () => { - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should concat classname in props with Bulma classname', () => { @@ -22,8 +21,7 @@ describe('Select component', () => { - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should use inline styles', () => { @@ -32,8 +30,7 @@ describe('Select component', () => { - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); it('Should be large, red, disabled and multioption', () => { @@ -42,8 +39,7 @@ describe('Select component', () => { - , - ); + ); expect(component.toJSON()).toMatchSnapshot(); }); }); diff --git a/src/components/form/components/__test__/textarea.test.js b/src/components/form/components/__test__/textarea.test.js index b1ab7334..15da7d57 100644 --- a/src/components/form/components/__test__/textarea.test.js +++ b/src/components/form/components/__test__/textarea.test.js @@ -7,33 +7,23 @@ describe('Textarea component', () => { expect(Textarea).toMatchSnapshot(); }); it('Should have textarea classname', () => { - const component = renderer.create( -