mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 02:21:48 +08:00
FIX feature & tests
This commit is contained in:
parent
1eadde2319
commit
1fdfe33cdd
@ -76,8 +76,8 @@ class TextFilter extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Input
|
<Input
|
||||||
autocomplete="off"
|
autoComplete="off"
|
||||||
spellcheck="false"
|
spellCheck="false"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Filter"
|
placeholder="Filter"
|
||||||
name="filter-text"
|
name="filter-text"
|
||||||
|
@ -8,15 +8,14 @@ describe('manager.ui.components.stories_panel.test_filter', () => {
|
|||||||
describe('render', () => {
|
describe('render', () => {
|
||||||
test('should render input without filterText', () => {
|
test('should render input without filterText', () => {
|
||||||
const wrap = mount(<TextFilter />);
|
const wrap = mount(<TextFilter />);
|
||||||
|
const input = wrap.find('[name="filter-text"]').first();
|
||||||
const input = wrap.find('Styled(input)').first();
|
|
||||||
|
|
||||||
expect(input).toHaveProp('placeholder', 'Filter');
|
expect(input).toHaveProp('placeholder', 'Filter');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render input with filterText', () => {
|
test('should render input with filterText', () => {
|
||||||
const wrap = mount(<TextFilter text="Filter Text" />);
|
const wrap = mount(<TextFilter text="Filter Text" />);
|
||||||
const input = wrap.find('Styled(input)').first();
|
const input = wrap.find('[name="filter-text"]').first();
|
||||||
|
|
||||||
expect(input).toHaveProp('value', 'Filter Text');
|
expect(input).toHaveProp('value', 'Filter Text');
|
||||||
});
|
});
|
||||||
@ -27,7 +26,7 @@ describe('manager.ui.components.stories_panel.test_filter', () => {
|
|||||||
const onChange = jest.fn();
|
const onChange = jest.fn();
|
||||||
const wrap = mount(<TextFilter onChange={onChange} />);
|
const wrap = mount(<TextFilter onChange={onChange} />);
|
||||||
|
|
||||||
const input = wrap.find('Styled(input)').first();
|
const input = wrap.find('[name="filter-text"]').first();
|
||||||
input.value = 'new value';
|
input.value = 'new value';
|
||||||
input.simulate('change', { target: input });
|
input.simulate('change', { target: input });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user