diff --git a/src/components/App/__snapshots__/test.js.snap b/src/components/App/__snapshots__/test.js.snap index b371156..87df27a 100644 --- a/src/components/App/__snapshots__/test.js.snap +++ b/src/components/App/__snapshots__/test.js.snap @@ -4,6 +4,7 @@ exports[`App rendering 1`] = ` new URLSearchParams(params).toString(); + class App extends React.PureComponent { state = {} @@ -110,8 +112,7 @@ class App extends React.PureComponent { handleSubmit = ({expr, syntax}) => { if (expr) { - const params = new URLSearchParams({ syntax, expr }); - document.location.hash = params.toString(); + document.location.hash = toUrl({ syntax, expr }); } } @@ -192,6 +193,7 @@ class App extends React.PureComponent { return
{ diff --git a/src/components/Form/test.js b/src/components/Form/test.js index e917f66..4a142ce 100644 --- a/src/components/Form/test.js +++ b/src/components/Form/test.js @@ -36,49 +36,6 @@ describe('Form', () => { expect(component).toMatchSnapshot(); }); - test('changing expression input', () => { - const component = shallow( - - ); - const eventObj = { - target: { name: 'expr', value: 'Testing value' } - }; - component.find('[name="expr"]').simulate('change', eventObj); - - expect(component.state('expr')).toEqual('Testing value'); - }); - - test('changing syntax input', () => { - const component = shallow( - - ); - const eventObj = { - target: { name: 'syntax', value: 'Testing value' } - }; - component.find('[name="syntax"]').simulate('change', eventObj); - - expect(component.state('syntax')).toEqual('Testing value'); - }); - - test('setting expression and syntax via props', () => { - const component = shallow( - - ); - expect(component.state()).toEqual(expect.objectContaining({ - syntax: 'js' - })); - component.setProps({ expr: 'Testing expression' }); - expect(component.state()).toEqual(expect.objectContaining({ - expr: 'Testing expression', - syntax: 'js' - })); - component.setProps({ syntax: 'testing syntax' }); - expect(component.state()).toEqual(expect.objectContaining({ - expr: 'Testing expression', - syntax: 'testing syntax' - })); - }); - describe('submitting expression', () => { test('submitting form', () => { const onSubmit = jest.fn();