Commit 84f81687 authored by wacky6.AriesMBP's avatar wacky6.AriesMBP Committed by 杨奕

Switch: set checkbox checked property

parent 11e3181a
......@@ -111,6 +111,7 @@
},
watch: {
checked() {
this.$refs.input.checked = this.checked;
if (this.onColor || this.offColor) {
this.setBackgroundColor();
}
......
......@@ -175,4 +175,29 @@ describe('Switch', () => {
}, 10);
}, 10);
});
it('sets checkbox value', done => {
vm = createVue({
template: `
<div>
<el-switch v-model="value"></el-switch>
</div>
`,
data() {
return {
value: false
};
}
}, true);
vm.value = true;
setTimeout(() => {
expect(vm.$el.querySelector('input').checked).to.equal(true);
vm.value = false;
setTimeout(() => {
expect(vm.$el.querySelector('input').checked).to.equal(false);
done();
}, 10);
}, 10);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment