diff --git a/src/checkbox/test/index.spec.js b/src/checkbox/test/index.spec.js
index 948f1c5a2..0b81c4d3d 100644
--- a/src/checkbox/test/index.spec.js
+++ b/src/checkbox/test/index.spec.js
@@ -52,13 +52,14 @@ test('checkbox group', async () => {
const wrapper = mount({
template: `
-
+
+
+
`,
data() {
return {
- result: [],
- list: ['a', 'b', 'c']
+ result: []
};
}
});
@@ -155,3 +156,37 @@ test('bind-group prop', async () => {
expect(wrapper.vm.result).toEqual([]);
expect(wrapper.vm.value).toBeTruthy();
});
+
+test('toggleAll method', async () => {
+ const wrapper = mount({
+ template: `
+
+
+
+
+
+ `,
+ data() {
+ return {
+ result: ['a']
+ };
+ },
+ methods: {
+ toggleAll(checked) {
+ this.$refs.group.toggleAll(checked);
+ }
+ }
+ });
+
+ wrapper.vm.toggleAll();
+ await later();
+ expect(wrapper.vm.result).toEqual(['b', 'c']);
+
+ wrapper.vm.toggleAll(false);
+ await later();
+ expect(wrapper.vm.result).toEqual([]);
+
+ wrapper.vm.toggleAll(true);
+ await later();
+ expect(wrapper.vm.result).toEqual(['a', 'b', 'c']);
+});