diff options
| author | Zog | 2018-01-11 16:56:42 +0100 | 
|---|---|---|
| committer | Zog | 2018-01-11 16:56:42 +0100 | 
| commit | f64486052cbe18730e9f0c68a625c34bbd7b53cd (patch) | |
| tree | 7aea20e5d30993f8a6ebdc85a057f45950ec59ae /spec/javascript | |
| parent | ed0faeaaa7bddc135c7b55f6d12fd09a739afacc (diff) | |
| download | chouette-core-f64486052cbe18730e9f0c68a625c34bbd7b53cd.tar.bz2 | |
Add tests, but I'm unable to run them for now :-(
Diffstat (limited to 'spec/javascript')
| -rw-r--r-- | spec/javascript/vehicle_journeys/components/CustomFieldsInputs_spec.js | 42 | ||||
| -rw-r--r-- | spec/javascript/vehicle_journeys/components/__snapshots__/CustomFieldsInputs_spec.js.snap | 3 | 
2 files changed, 45 insertions, 0 deletions
| diff --git a/spec/javascript/vehicle_journeys/components/CustomFieldsInputs_spec.js b/spec/javascript/vehicle_journeys/components/CustomFieldsInputs_spec.js new file mode 100644 index 000000000..62013354a --- /dev/null +++ b/spec/javascript/vehicle_journeys/components/CustomFieldsInputs_spec.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react' +import CustomFieldsInputs from '../../../../app/javascript/vehicle_journeys/components/tools/CustomFieldsInputs' +import renderer from 'react-test-renderer' +require('select2') +console.log($().jquery) + +describe('CustomFieldsInputs', () => { +  set('values', () => { +    return {} +  }) + +  set('component', () => { +    let inputs = renderer.create( +      <CustomFieldsInputs +        values={values} +        disabled={false} +        onUpdate={()=>{}} +      /> +    ).toJSON() + +    return inputs +  }) + +  it('should match the snapshot', () => { +    expect(component).toMatchSnapshot() +  }) + +  context('with fields', () => { +    set('values', () => { +      return { +        foo: { +          options: { list_values: ["", "1", "2"] }, +          field_type: "list", +          name: "test" +        } +      } +    }) +    it('should match the snapshot', () => { +      expect(component).toMatchSnapshot() +    }) +  }) +}) diff --git a/spec/javascript/vehicle_journeys/components/__snapshots__/CustomFieldsInputs_spec.js.snap b/spec/javascript/vehicle_journeys/components/__snapshots__/CustomFieldsInputs_spec.js.snap new file mode 100644 index 000000000..c93ec0097 --- /dev/null +++ b/spec/javascript/vehicle_journeys/components/__snapshots__/CustomFieldsInputs_spec.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`CustomFieldsInputs should match the snapshot 1`] = `<div />`; | 
