Skip to content

Commit

Permalink
fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nerrad committed Jun 8, 2018
1 parent 5d62386 commit 0e1d753
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ModelSelect Snapshot with default options (with required modelName) should render and match snapshot 1`] = `
<StateManager
defaultInputValue=""
defaultMenuIsOpen={false}
defaultValue={null}
isClearable={true}
isLoading={true}
placeholder="Select..."
/>
<React.Fragment>
<StateManager
defaultInputValue=""
defaultMenuIsOpen={false}
defaultValue={null}
isClearable={true}
isLoading={true}
name="model-select-1"
options={Array []}
placeholder="Select..."
value={Object {}}
/>
</React.Fragment>
`;
23 changes: 17 additions & 6 deletions assets/src/components/form/select/test/model-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const simulatedResponse = [
describe( 'ModelSelect Snapshot with default options (with required modelName)',
() => {
it( 'should render and match snapshot', () => {
const wrapper = shallow( <ModelSelect modelName={ 'events' } /> );
const wrapper = shallow( <ModelSelect modelName={ 'event' } /> );
expect( wrapper ).toMatchSnapshot();
} );
},
Expand All @@ -19,22 +19,33 @@ describe( 'ModelSelect props check', () => {
it( 'should render and have passed in props match expectation', () => {
const wrapper = shallow(
<ModelSelect
modelName={ 'events' }
modelName={ 'event' }
modelEntities={ simulatedResponse }
selectConfiguration={ {
isClearable: false,
isLoading: false,
} }
/>,
);
expect( wrapper.prop( 'options' ) ).toEqual(
const selectWrapper = wrapper.childAt( 0 );
expect( selectWrapper.prop( 'options' ) ).toEqual(
[
{ label: 'Event A', value: 1 },
{ label: 'Event B', value: 2 },
],
);
expect( wrapper.prop( 'isClearable' ) ).toEqual( false );
expect( wrapper.prop( 'isLoading' ) ).toEqual( false );
expect( wrapper.prop( 'placeholder' ) ).toEqual( 'Select...' );
expect( selectWrapper.prop( 'isClearable' ) ).toEqual( false );
expect( selectWrapper.prop( 'isLoading' ) ).toEqual( false );
expect( selectWrapper.prop( 'placeholder' ) ).toEqual( 'Select...' );
} );
it( 'should render a label when selectLabel is provided', () => {
const wrapper = shallow(
<ModelSelect
modelName={ 'event' }
modelEntities={ simulatedResponse }
selectLabel={ 'Label for Select' }
/>
);
expect( wrapper.childAt(0).text() ).toEqual( 'Label for Select' );
} );
} );
Loading

0 comments on commit 0e1d753

Please sign in to comment.