mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[bugfix] Checkbox: label-position prop not work
This commit is contained in:
@@ -59,7 +59,6 @@
|
||||
line-height: @checkbox-size;
|
||||
|
||||
&--left {
|
||||
float: left;
|
||||
margin: 0 @checkbox-label-margin 0 0;
|
||||
}
|
||||
|
||||
|
15
packages/checkbox/test/__snapshots__/index.spec.js.snap
Normal file
15
packages/checkbox/test/__snapshots__/index.spec.js.snap
Normal file
@@ -0,0 +1,15 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`label disabled 1`] = `
|
||||
<div role="checkbox" tabindex="0" aria-checked="undefined" class="van-checkbox">
|
||||
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success">
|
||||
<!----></i></div><span class="van-checkbox__label">Label</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`label-position prop 1`] = `
|
||||
<div role="checkbox" tabindex="0" aria-checked="undefined" class="van-checkbox"><span class="van-checkbox__label van-checkbox__label--left">Label</span>
|
||||
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success">
|
||||
<!----></i></div>
|
||||
</div>
|
||||
`;
|
@@ -31,8 +31,8 @@ test('disabled', () => {
|
||||
|
||||
test('label disabled', () => {
|
||||
const wrapper = mount(Checkbox, {
|
||||
slots: {
|
||||
default: '<div />'
|
||||
scopedSlots: {
|
||||
default: () => 'Label'
|
||||
},
|
||||
propsData: {
|
||||
labelDisabled: true
|
||||
@@ -41,6 +41,7 @@ test('label disabled', () => {
|
||||
|
||||
wrapper.find('.van-checkbox__label').trigger('click');
|
||||
expect(wrapper.emitted('input')).toBeFalsy();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('checkbox group', async () => {
|
||||
@@ -91,3 +92,16 @@ test('click event', () => {
|
||||
icon.trigger('click');
|
||||
expect(onClick).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
test('label-position prop', () => {
|
||||
const wrapper = mount(Checkbox, {
|
||||
scopedSlots: {
|
||||
default: () => 'Label'
|
||||
},
|
||||
propsData: {
|
||||
labelPosition: 'left'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
Reference in New Issue
Block a user