[improvement] rename packages dir to src (#3659)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders demo correctly 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
<div class="van-cell-group van-hairline--top-bottom">
|
||||
<div class="van-cell van-cell--center van-switch-cell">
|
||||
<div class="van-cell__title"><span>标题</span></div>
|
||||
<div class="van-cell__value">
|
||||
<div role="switch" aria-checked="true" class="van-switch van-switch--on" style="font-size: 24px;">
|
||||
<div class="van-switch__node"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-cell-group van-hairline--top-bottom">
|
||||
<div class="van-cell van-cell--center van-switch-cell">
|
||||
<div class="van-cell__title"><span>标题</span></div>
|
||||
<div class="van-cell__value">
|
||||
<div role="switch" aria-checked="true" class="van-switch van-switch--on van-switch--disabled" style="font-size: 24px;">
|
||||
<div class="van-switch__node"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-cell-group van-hairline--top-bottom">
|
||||
<div class="van-cell van-cell--center van-switch-cell">
|
||||
<div class="van-cell__title"><span>标题</span></div>
|
||||
<div class="van-cell__value">
|
||||
<div role="switch" aria-checked="true" class="van-switch van-switch--on" style="font-size: 24px;">
|
||||
<div class="van-switch__node">
|
||||
<div class="van-loading van-loading--circular van-switch__loading"><span class="van-loading__spinner van-loading__spinner--circular" style="color: rgb(25, 137, 250);"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,21 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`border prop 1`] = `
|
||||
<div class="van-cell van-cell--center van-cell--borderless van-switch-cell">
|
||||
<div class="van-cell__value van-cell__value--alone">
|
||||
<div role="switch" aria-checked="false" class="van-switch" style="font-size: 24px;">
|
||||
<div class="van-switch__node"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`cell-size prop 1`] = `
|
||||
<div class="van-cell van-cell--center van-cell--large van-switch-cell van-switch-cell--large">
|
||||
<div class="van-cell__value van-cell__value--alone">
|
||||
<div role="switch" aria-checked="false" class="van-switch" style="font-size: 24px;">
|
||||
<div class="van-switch__node"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,4 @@
|
||||
import Demo from '../demo';
|
||||
import demoTest from '../../../test/demo-test';
|
||||
|
||||
demoTest(Demo);
|
||||
@@ -0,0 +1,37 @@
|
||||
import SwitchCell from '..';
|
||||
import { mount } from '../../../test/utils';
|
||||
|
||||
test('change event', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(SwitchCell, {
|
||||
context: {
|
||||
on: {
|
||||
change: onChange
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.van-switch').trigger('click');
|
||||
|
||||
expect(onChange).toHaveBeenCalledWith(true);
|
||||
});
|
||||
|
||||
test('border prop', () => {
|
||||
const wrapper = mount(SwitchCell, {
|
||||
propsData: {
|
||||
border: false
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('cell-size prop', () => {
|
||||
const wrapper = mount(SwitchCell, {
|
||||
propsData: {
|
||||
cellSize: 'large'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
Reference in New Issue
Block a user