diff options
Diffstat (limited to 'spec')
| -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 />`; | 
