-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
key and value for select knob match key/value of options
fixes #799 add selectV2 for backwards compatibility
- Loading branch information
Showing
8 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; // eslint-disable-line | ||
import SelectType from '../types/Select'; | ||
|
||
describe('Select', () => { | ||
let knob; | ||
|
||
beforeEach(() => { | ||
knob = { | ||
name: 'Colors', | ||
value: '#00ff00', | ||
options: { | ||
Green: '#00ff00', | ||
Red: '#ff0000', | ||
}, | ||
}; | ||
}); | ||
|
||
it('displays value', () => { | ||
const wrapper = shallow(<SelectType knob={knob} />); | ||
|
||
const green = wrapper.find('option').first(); | ||
expect(green.text()).toEqual('#00ff00'); | ||
expect(green.prop('value')).toEqual('Green'); | ||
}); | ||
|
||
describe('selectV2', () => { | ||
beforeEach(() => { | ||
knob.selectV2 = true; | ||
}); | ||
|
||
it('correctly maps option keys and values', () => { | ||
const wrapper = shallow(<SelectType knob={knob} />); | ||
|
||
const green = wrapper.find('option').first(); | ||
expect(green.text()).toEqual('Green'); | ||
expect(green.prop('value')).toEqual('#00ff00'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters