-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
Showing
9 changed files
with
348 additions
and
9 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
190 changes: 190 additions & 0 deletions
190
components/Slider/__tests__/__snapshots__/index.test.jsx.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,190 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Slider defaultValue 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="10" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider disabled 1`] = ` | ||
<div | ||
class="za-slider disabled" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider max 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider min 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider renders correctly 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider step 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Slider value 1`] = ` | ||
<div | ||
class="za-slider" | ||
> | ||
<div | ||
class="za-slider-line" | ||
> | ||
<div | ||
class="za-slider-line-bg" | ||
style="width:0;" | ||
/> | ||
</div> | ||
<div | ||
aria-valuemax="100" | ||
aria-valuemin="0" | ||
aria-valuenow="10" | ||
class="za-slider-handle" | ||
role="slider" | ||
style="left:0;" | ||
> | ||
<div | ||
class="za-slider-handle-shadow" | ||
/> | ||
</div> | ||
</div> | ||
`; |
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,49 @@ | ||
import React from 'react'; | ||
import { render, mount } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
import Slider from '../index'; | ||
|
||
describe('Slider', () => { | ||
it('renders correctly', () => { | ||
const wrapper = render(<Slider />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('min', () => { | ||
const wrapper = render(<Slider min={0} />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('max', () => { | ||
const wrapper = render(<Slider max={100} />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('step', () => { | ||
const wrapper = render(<Slider step={5} />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('disabled', () => { | ||
const wrapper = render(<Slider disabled />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('defaultValue', () => { | ||
const wrapper = render(<Slider defaultValue={10} />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('value', () => { | ||
const wrapper = render(<Slider value={10} />); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('set new value', () => { | ||
jest.useFakeTimers(); | ||
const wrapper = mount(<Slider />); | ||
wrapper.setProps({ value: 50 }); | ||
jest.runAllTimers(); | ||
wrapper.unmount(); | ||
}); | ||
}); |
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
19 changes: 19 additions & 0 deletions
19
components/Tooltip/__tests__/__snapshots__/index.test.jsx.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,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Tooltip renders correctly 1`] = ` | ||
<span> | ||
foo | ||
</span> | ||
`; | ||
|
||
exports[`Tooltip visible 1`] = ` | ||
<Tooltip | ||
message="hello" | ||
prefixCls="za-tooltip" | ||
visible={true} | ||
> | ||
<span> | ||
foo | ||
</span> | ||
</Tooltip> | ||
`; |
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,19 @@ | ||
import React from 'react'; | ||
import { render, mount } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
import Tooltip from '../index'; | ||
|
||
describe('Tooltip', () => { | ||
it('renders correctly', () => { | ||
const wrapper = render(<Tooltip message="hello"><span>foo</span></Tooltip>); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it('visible', () => { | ||
jest.useFakeTimers(); | ||
const wrapper = mount(<Tooltip visible message="hello"><span>foo</span></Tooltip>); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
jest.runAllTimers(); | ||
wrapper.unmount(); | ||
}); | ||
}); |
Oops, something went wrong.