diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-30 09:03:01 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-30 09:03:01 +0900 |
commit | 808344eecfedd04149551867724e46a7988c45a0 (patch) | |
tree | 523281c76405696f7ad0008887691baa09973735 /test/settings/components/form/blacklist-form.test.jsx | |
parent | 4bac47249be20aff630fbecfe66fe021068a3095 (diff) |
Fix React Component tests
Diffstat (limited to 'test/settings/components/form/blacklist-form.test.jsx')
-rw-r--r-- | test/settings/components/form/blacklist-form.test.jsx | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/test/settings/components/form/blacklist-form.test.jsx b/test/settings/components/form/blacklist-form.test.jsx deleted file mode 100644 index 40067d0..0000000 --- a/test/settings/components/form/blacklist-form.test.jsx +++ /dev/null @@ -1,81 +0,0 @@ -import { render } from 'react'; -import BlacklistForm from 'settings/components/form/blacklist-form' - -describe("settings/form/BlacklistForm", () => { - beforeEach(() => { - document.body.innerHTML = ''; - }); - - describe('render', () => { - it('renders BlacklistForm', () => { - render(<BlacklistForm value={['*.slack.com', 'www.google.com/maps']} />, document.body); - - let inputs = document.querySelectorAll('input[type=text]'); - expect(inputs).to.have.lengthOf(2); - expect(inputs[0].value).to.equal('*.slack.com'); - expect(inputs[1].value).to.equal('www.google.com/maps'); - }); - - it('renders blank value', () => { - render(<BlacklistForm />, document.body); - - let inputs = document.querySelectorAll('input[type=text]'); - expect(inputs).to.be.empty; - }); - - it('renders blank value', () => { - render(<BlacklistForm />, document.body); - - let inputs = document.querySelectorAll('input[type=text]'); - expect(inputs).to.be.empty; - }); - }); - - describe('onChange', () => { - it('invokes onChange event on edit', (done) => { - render(<BlacklistForm - value={['*.slack.com', 'www.google.com/maps*']} - onChange={value => { - expect(value).to.have.lengthOf(2) - .and.have.members(['gitter.im', 'www.google.com/maps*']); - - done(); - }} - />, document.body); - - let input = document.querySelectorAll('input[type=text]')[0]; - input.value = 'gitter.im'; - input.dispatchEvent(new Event('change')) - }); - - it('invokes onChange event on delete', (done) => { - render(<BlacklistForm - value={['*.slack.com', 'www.google.com/maps*']} - onChange={value => { - expect(value).to.have.lengthOf(1) - .and.have.members(['www.google.com/maps*']); - - done(); - }} - />, document.body); - - let button = document.querySelectorAll('input[type=button]')[0]; - button.click(); - }); - - it('invokes onChange event on add', (done) => { - render(<BlacklistForm - value={['*.slack.com']} - onChange={value => { - expect(value).to.have.lengthOf(2) - .and.have.members(['*.slack.com', '']); - - done(); - }} - />, document.body); - - let button = document.querySelector('input[type=button].ui-add-button'); - button.click(); - }); - }); -}); |