aboutsummaryrefslogtreecommitdiff
path: root/test/settings/components
diff options
context:
space:
mode:
Diffstat (limited to 'test/settings/components')
-rw-r--r--test/settings/components/form/BlacklistForm.test.tsx (renamed from test/settings/components/form/BlacklistForm.test.jsx)0
-rw-r--r--test/settings/components/form/KeymapsForm.test.tsx (renamed from test/settings/components/form/KeymapsForm.test.jsx)14
-rw-r--r--test/settings/components/form/PropertiesForm.test.tsx (renamed from test/settings/components/form/PropertiesForm.test.jsx)0
-rw-r--r--test/settings/components/form/SearchEngineForm.test.tsx (renamed from test/settings/components/form/SearchEngineForm.test.jsx)60
-rw-r--r--test/settings/components/ui/input.test.tsx (renamed from test/settings/components/ui/input.test.jsx)0
5 files changed, 29 insertions, 45 deletions
diff --git a/test/settings/components/form/BlacklistForm.test.jsx b/test/settings/components/form/BlacklistForm.test.tsx
index 2be5d96..2be5d96 100644
--- a/test/settings/components/form/BlacklistForm.test.jsx
+++ b/test/settings/components/form/BlacklistForm.test.tsx
diff --git a/test/settings/components/form/KeymapsForm.test.jsx b/test/settings/components/form/KeymapsForm.test.tsx
index 6ac57c9..dc2322b 100644
--- a/test/settings/components/form/KeymapsForm.test.jsx
+++ b/test/settings/components/form/KeymapsForm.test.tsx
@@ -2,15 +2,17 @@ import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestRenderer from 'react-test-renderer';
import ReactTestUtils from 'react-dom/test-utils';
-import KeymapsForm from 'settings/components/form/KeymapsForm'
+import KeymapsForm from '../../../../src/settings/components/form/KeymapsForm'
+import { FormKeymaps } from 'shared/SettingData';
+import { expect } from 'chai';
describe("settings/form/KeymapsForm", () => {
describe('render', () => {
it('renders keymap fields', () => {
- let root = ReactTestRenderer.create(<KeymapsForm value={{
+ let root = ReactTestRenderer.create(<KeymapsForm value={FormKeymaps.valueOf({
'scroll.vertically?{"count":1}': 'j',
'scroll.vertically?{"count":-1}': 'k',
- }} />).root
+ })} />).root
let inputj = root.findByProps({ id: 'scroll.vertically?{"count":1}' });
let inputk = root.findByProps({ id: 'scroll.vertically?{"count":-1}' });
@@ -46,12 +48,12 @@ describe("settings/form/KeymapsForm", () => {
it('invokes onChange event on edit', (done) => {
ReactTestUtils.act(() => {
ReactDOM.render(<KeymapsForm
- value={{
+ value={FormKeymaps.valueOf({
'scroll.vertically?{"count":1}': 'j',
'scroll.vertically?{"count":-1}': 'k',
- }}
+ })}
onChange={value => {
- expect(value['scroll.vertically?{"count":1}']).to.equal('jjj');
+ expect(value.toJSON()['scroll.vertically?{"count":1}']).to.equal('jjj');
done();
}} />, container);
});
diff --git a/test/settings/components/form/PropertiesForm.test.jsx b/test/settings/components/form/PropertiesForm.test.tsx
index 80f60d2..80f60d2 100644
--- a/test/settings/components/form/PropertiesForm.test.jsx
+++ b/test/settings/components/form/PropertiesForm.test.tsx
diff --git a/test/settings/components/form/SearchEngineForm.test.jsx b/test/settings/components/form/SearchEngineForm.test.tsx
index 06822f2..0e6b17d 100644
--- a/test/settings/components/form/SearchEngineForm.test.jsx
+++ b/test/settings/components/form/SearchEngineForm.test.tsx
@@ -3,14 +3,15 @@ import ReactDOM from 'react-dom';
import ReactTestRenderer from 'react-test-renderer';
import ReactTestUtils from 'react-dom/test-utils';
import SearchForm from 'settings/components/form/SearchForm'
+import { FormSearch } from 'shared/SettingData';
describe("settings/form/SearchForm", () => {
describe('render', () => {
it('renders SearchForm', () => {
- let root = ReactTestRenderer.create(<SearchForm value={{
+ let root = ReactTestRenderer.create(<SearchForm value={FormSearch.valueOf({
default: 'google',
engines: [['google', 'google.com'], ['yahoo', 'yahoo.com']],
- }} />).root;
+ })} />).root;
let names = root.findAllByProps({ name: 'name' });
expect(names).to.have.lengthOf(2);
@@ -22,28 +23,6 @@ describe("settings/form/SearchForm", () => {
expect(urls[0].props.value).to.equal('google.com');
expect(urls[1].props.value).to.equal('yahoo.com');
});
-
- it('renders blank value', () => {
- let root = ReactTestRenderer.create(<SearchForm />).root;
-
- let names = root.findAllByProps({ name: 'name' });
- expect(names).to.be.empty;
-
- let urls = root.findAllByProps({ name: 'url' });
- expect(urls).to.be.empty;
- });
-
- it('renders blank engines', () => {
- let root = ReactTestRenderer.create(
- <SearchForm value={{ default: 'google' }} />,
- ).root;
-
- let names = root.findAllByProps({ name: 'name' });
- expect(names).to.be.empty;
-
- let urls = root.findAllByProps({ name: 'url' });
- expect(urls).to.be.empty;
- });
});
describe('onChange event', () => {
@@ -62,14 +41,15 @@ describe("settings/form/SearchForm", () => {
it('invokes onChange event on edit', (done) => {
ReactTestUtils.act(() => {
ReactDOM.render(<SearchForm
- value={{
+ value={FormSearch.valueOf({
default: 'google',
engines: [['google', 'google.com'], ['yahoo', 'yahoo.com']]
- }}
+ })}
onChange={value => {
- expect(value.default).to.equal('louvre');
- expect(value.engines).to.have.lengthOf(2)
- expect(value.engines).to.have.deep.members(
+ let json = value.toJSON();
+ expect(json.default).to.equal('louvre');
+ expect(json.engines).to.have.lengthOf(2)
+ expect(json.engines).to.have.deep.members(
[['louvre', 'google.com'], ['yahoo', 'yahoo.com']]
);
done();
@@ -87,14 +67,15 @@ describe("settings/form/SearchForm", () => {
it('invokes onChange event on delete', (done) => {
ReactTestUtils.act(() => {
- ReactDOM.render(<SearchForm value={{
+ ReactDOM.render(<SearchForm value={FormSearch.valueOf({
default: 'yahoo',
engines: [['louvre', 'google.com'], ['yahoo', 'yahoo.com']]
- }}
+ })}
onChange={value => {
- expect(value.default).to.equal('yahoo');
- expect(value.engines).to.have.lengthOf(1)
- expect(value.engines).to.have.deep.members(
+ let json = value.toJSON();
+ expect(json.default).to.equal('yahoo');
+ expect(json.engines).to.have.lengthOf(1)
+ expect(json.engines).to.have.deep.members(
[['yahoo', 'yahoo.com']]
);
done();
@@ -107,14 +88,15 @@ describe("settings/form/SearchForm", () => {
it('invokes onChange event on add', (done) => {
ReactTestUtils.act(() => {
- ReactDOM.render(<SearchForm value={{
+ ReactDOM.render(<SearchForm value={FormSearch.valueOf({
default: 'yahoo',
engines: [['google', 'google.com']]
- }}
+ })}
onChange={value => {
- expect(value.default).to.equal('yahoo');
- expect(value.engines).to.have.lengthOf(2)
- expect(value.engines).to.have.deep.members(
+ let json = value.toJSON();
+ expect(json.default).to.equal('yahoo');
+ expect(json.engines).to.have.lengthOf(2)
+ expect(json.engines).to.have.deep.members(
[['google', 'google.com'], ['', '']],
);
done();
diff --git a/test/settings/components/ui/input.test.jsx b/test/settings/components/ui/input.test.tsx
index 432efcb..432efcb 100644
--- a/test/settings/components/ui/input.test.jsx
+++ b/test/settings/components/ui/input.test.tsx