-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61f53b8
commit e363e7c
Showing
7 changed files
with
77 additions
and
0 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
21 changes: 21 additions & 0 deletions
21
components/switch/__tests__/__snapshots__/index.test.js.snap
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,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Switch renders correctly 1`] = ` | ||
<RCTSwitch | ||
disabled={false} | ||
onChange={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
onValueChange={[Function]} | ||
style={ | ||
Array [ | ||
Object { | ||
"height": 31, | ||
"width": 51, | ||
}, | ||
undefined, | ||
] | ||
} | ||
value={true} | ||
/> | ||
`; |
18 changes: 18 additions & 0 deletions
18
components/switch/__tests__/__snapshots__/index.test.web.js.snap
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,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SegmentedControl renders correctly 1`] = ` | ||
<label | ||
class="am-switch" | ||
> | ||
<input | ||
checked="" | ||
class="am-switch-checkbox" | ||
name="" | ||
type="checkbox" | ||
value="on" | ||
/> | ||
<div | ||
class="checkbox" | ||
/> | ||
</label> | ||
`; |
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,10 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import Switch from '../index'; | ||
|
||
describe('Switch', () => { | ||
it('renders correctly', () => { | ||
const tree = renderer.create(<Switch checked />).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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,20 @@ | ||
import React from 'react'; | ||
import { render, shallow } from 'enzyme'; | ||
import { renderToJson } from 'enzyme-to-json'; | ||
import Switch from '../index.web'; | ||
|
||
describe('SegmentedControl', () => { | ||
it('renders correctly', () => { | ||
const wrapper = render(<Switch checked />); | ||
expect(renderToJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('check api', () => { | ||
const onChange = jest.fn(); | ||
const wrapper = shallow(<Switch checked onChange={onChange} />); | ||
expect(wrapper.find('input').is('input[value="on"]')).toBeTruthy(); | ||
// I don't know why click/change doesn't change the value to `off` | ||
// wrapper.find('input').simulate('click', { target: { checked: false } }); | ||
// expect(wrapper.find('input').is('input[value="off"]')).toBeTruthy(); | ||
}); | ||
}); |
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