diff options
Diffstat (limited to 'test/settings/components/form')
4 files changed, 33 insertions, 33 deletions
diff --git a/test/settings/components/form/BlacklistForm.test.tsx b/test/settings/components/form/BlacklistForm.test.tsx index 7daf513..6c329ff 100644 --- a/test/settings/components/form/BlacklistForm.test.tsx +++ b/test/settings/components/form/BlacklistForm.test.tsx @@ -10,11 +10,11 @@ import Blacklist from '../../../../src/shared/settings/Blacklist'; describe("settings/form/BlacklistForm", () => { describe('render', () => { it('renders BlacklistForm', () => { - let root = ReactTestRenderer.create( + const root = ReactTestRenderer.create( <BlacklistForm value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps'])} />, ).root; - let children = root.children[0].children; + const children = root.children[0].children; expect(children).to.have.lengthOf(3); expect(children[0].children[0].props.value).to.equal('*.slack.com'); expect(children[1].children[0].props.value).to.equal('www.google.com/maps'); @@ -22,9 +22,9 @@ describe("settings/form/BlacklistForm", () => { }); it('renders blank value', () => { - let root = ReactTestRenderer.create(<BlacklistForm />).root; + const root = ReactTestRenderer.create(<BlacklistForm />).root; - let children = root.children[0].children; + const children = root.children[0].children; expect(children).to.have.lengthOf(1); expect(children[0].props.name).to.equal('add'); }); @@ -48,14 +48,14 @@ describe("settings/form/BlacklistForm", () => { ReactDOM.render(<BlacklistForm value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps*'])} onChange={value => { - let urls = value.items.map(item => item.pattern); + const urls = value.items.map(item => item.pattern); expect(urls).to.have.members(['gitter.im', 'www.google.com/maps*']); done(); }} />, container) }); - let input = document.querySelectorAll('input[type=text]')[0]; + const input = document.querySelectorAll('input[type=text]')[0]; input.value = 'gitter.im'; ReactTestUtils.Simulate.change(input); }); @@ -65,14 +65,14 @@ describe("settings/form/BlacklistForm", () => { ReactDOM.render(<BlacklistForm value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps*'])} onChange={value => { - let urls = value.items.map(item => item.pattern); + const urls = value.items.map(item => item.pattern); expect(urls).to.have.members(['www.google.com/maps*']); done(); }} />, container) }); - let button = document.querySelectorAll('input[type=button]')[0]; + const button = document.querySelectorAll('input[type=button]')[0]; ReactTestUtils.Simulate.click(button); }); @@ -81,14 +81,14 @@ describe("settings/form/BlacklistForm", () => { ReactDOM.render(<BlacklistForm value={Blacklist.fromJSON(['*.slack.com'])} onChange={value => { - let urls = value.items.map(item => item.pattern); + const urls = value.items.map(item => item.pattern); expect(urls).to.have.members(['*.slack.com', '']); done(); }} />, container); }); - let button = document.querySelector('input[type=button].ui-add-button'); + const button = document.querySelector('input[type=button].ui-add-button'); ReactTestUtils.Simulate.click(button); }); }); diff --git a/test/settings/components/form/KeymapsForm.test.tsx b/test/settings/components/form/KeymapsForm.test.tsx index 1d1e77c..ccc772c 100644 --- a/test/settings/components/form/KeymapsForm.test.tsx +++ b/test/settings/components/form/KeymapsForm.test.tsx @@ -9,23 +9,23 @@ import { expect } from 'chai'; describe("settings/form/KeymapsForm", () => { describe('render', () => { it('renders keymap fields', () => { - let root = ReactTestRenderer.create(<KeymapsForm value={FormKeymaps.fromJSON({ + const root = ReactTestRenderer.create(<KeymapsForm value={FormKeymaps.fromJSON({ 'scroll.vertically?{"count":1}': 'j', 'scroll.vertically?{"count":-1}': 'k', })} />).root - let inputj = root.findByProps({ id: 'scroll.vertically?{"count":1}' }); - let inputk = root.findByProps({ id: 'scroll.vertically?{"count":-1}' }); + const inputj = root.findByProps({ id: 'scroll.vertically?{"count":1}' }); + const inputk = root.findByProps({ id: 'scroll.vertically?{"count":-1}' }); expect(inputj.props.value).to.equal('j'); expect(inputk.props.value).to.equal('k'); }); it('renders blank value', () => { - let root = ReactTestRenderer.create(<KeymapsForm />).root; + const root = ReactTestRenderer.create(<KeymapsForm />).root; - let inputj = root.findByProps({ id: 'scroll.vertically?{"count":1}' }); - let inputk = root.findByProps({ id: 'scroll.vertically?{"count":-1}' }); + const inputj = root.findByProps({ id: 'scroll.vertically?{"count":1}' }); + const inputk = root.findByProps({ id: 'scroll.vertically?{"count":-1}' }); expect(inputj.props.value).to.be.empty; expect(inputk.props.value).to.be.empty; @@ -58,7 +58,7 @@ describe("settings/form/KeymapsForm", () => { }} />, container); }); - let input = document.getElementById('scroll.vertically?{"count":1}'); + const input = document.getElementById('scroll.vertically?{"count":1}'); input.value = 'jjj'; ReactTestUtils.Simulate.change(input); }); diff --git a/test/settings/components/form/PropertiesForm.test.tsx b/test/settings/components/form/PropertiesForm.test.tsx index 0e33cc8..4a0e25a 100644 --- a/test/settings/components/form/PropertiesForm.test.tsx +++ b/test/settings/components/form/PropertiesForm.test.tsx @@ -7,19 +7,19 @@ import PropertiesForm from 'settings/components/form/PropertiesForm' describe("settings/form/PropertiesForm", () => { describe('render', () => { it('renders PropertiesForm', () => { - let types = { + const types = { mystr: 'string', mynum: 'number', mybool: 'boolean', empty: 'string', } - let values = { + const values = { mystr: 'abc', mynum: 123, mybool: true, }; - let root = ReactTestRenderer.create( + const root = ReactTestRenderer.create( <PropertiesForm types={types} value={values} />, ).root @@ -62,7 +62,7 @@ describe("settings/form/PropertiesForm", () => { />, container); }); - let input = document.querySelector('input[name=myvalue]'); + const input = document.querySelector('input[name=myvalue]'); input.value = 'abcd' ReactTestUtils.Simulate.change(input); }); @@ -79,7 +79,7 @@ describe("settings/form/PropertiesForm", () => { />, container); }); - let input = document.querySelector('input[name=myvalue]'); + const input = document.querySelector('input[name=myvalue]'); input.value = '1234' ReactTestUtils.Simulate.change(input); }); @@ -96,7 +96,7 @@ describe("settings/form/PropertiesForm", () => { />, container); }); - let input = document.querySelector('input[name=myvalue]'); + const input = document.querySelector('input[name=myvalue]'); input.checked = true; ReactTestUtils.Simulate.change(input); }); diff --git a/test/settings/components/form/SearchEngineForm.test.tsx b/test/settings/components/form/SearchEngineForm.test.tsx index 1f0420d..b918203 100644 --- a/test/settings/components/form/SearchEngineForm.test.tsx +++ b/test/settings/components/form/SearchEngineForm.test.tsx @@ -8,17 +8,17 @@ import { FormSearch } from 'shared/SettingData'; describe("settings/form/SearchForm", () => { describe('render', () => { it('renders SearchForm', () => { - let root = ReactTestRenderer.create(<SearchForm value={FormSearch.fromJSON({ + const root = ReactTestRenderer.create(<SearchForm value={FormSearch.fromJSON({ default: 'google', engines: [['google', 'google.com'], ['yahoo', 'yahoo.com']], })} />).root; - let names = root.findAllByProps({ name: 'name' }); + const names = root.findAllByProps({ name: 'name' }); expect(names).to.have.lengthOf(2); expect(names[0].props.value).to.equal('google'); expect(names[1].props.value).to.equal('yahoo'); - let urls = root.findAllByProps({ name: 'url' }); + const urls = root.findAllByProps({ name: 'url' }); expect(urls).to.have.lengthOf(2); expect(urls[0].props.value).to.equal('google.com'); expect(urls[1].props.value).to.equal('yahoo.com'); @@ -46,7 +46,7 @@ describe("settings/form/SearchForm", () => { engines: [['google', 'google.com'], ['yahoo', 'yahoo.com']] })} onChange={value => { - let json = value.toJSON(); + const json = value.toJSON(); expect(json.default).to.equal('louvre'); expect(json.engines).to.have.lengthOf(2) expect(json.engines).to.have.deep.members( @@ -56,10 +56,10 @@ describe("settings/form/SearchForm", () => { }} />, container); }); - let radio = document.querySelectorAll('input[type=radio]'); + const radio = document.querySelectorAll('input[type=radio]'); radio.checked = true; - let name = document.querySelector('input[name=name]'); + const name = document.querySelector('input[name=name]'); name.value = 'louvre'; ReactTestUtils.Simulate.change(name); @@ -72,7 +72,7 @@ describe("settings/form/SearchForm", () => { engines: [['louvre', 'google.com'], ['yahoo', 'yahoo.com']] })} onChange={value => { - let json = value.toJSON(); + const json = value.toJSON(); expect(json.default).to.equal('yahoo'); expect(json.engines).to.have.lengthOf(1) expect(json.engines).to.have.deep.members( @@ -82,7 +82,7 @@ describe("settings/form/SearchForm", () => { }} />, container); }); - let button = document.querySelector('input[type=button]'); + const button = document.querySelector('input[type=button]'); ReactTestUtils.Simulate.click(button); }); @@ -93,7 +93,7 @@ describe("settings/form/SearchForm", () => { engines: [['google', 'google.com']] })} onChange={value => { - let json = value.toJSON(); + const json = value.toJSON(); expect(json.default).to.equal('yahoo'); expect(json.engines).to.have.lengthOf(2) expect(json.engines).to.have.deep.members( @@ -103,7 +103,7 @@ describe("settings/form/SearchForm", () => { }} />, container); }); - let button = document.querySelector('input[type=button].ui-add-button'); + const button = document.querySelector('input[type=button].ui-add-button'); ReactTestUtils.Simulate.click(button); }); }); |