ソースを参照

upd: checkboxgroup

zongyue3 4 年 前
コミット
48a10f15eb

+ 3 - 0
src/packages/__VUE/checkboxgroup/__tests__/__snapshots__/checkboxgroup.spec.ts.snap

@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`prop label 1`] = `"<view class=\\"nut-checkboxgroup\\"></view>"`;

+ 43 - 0
src/packages/__VUE/checkboxgroup/__tests__/checkboxgroup.spec.ts

@@ -0,0 +1,43 @@
+import { mount } from '@vue/test-utils';
+import Checkboxgroup from '../index.vue';
+import Checkbox from '../../checkbox/index.vue';
+import { h } from '@vue/runtime-core';
+
+test('prop label', () => {
+  const wrapper = mount(Checkboxgroup, {
+    props: {
+      disabled: true
+    }
+  });
+  expect(wrapper.html()).toMatchSnapshot();
+});
+
+// test('should emit "update:modelValue" event when checkbox is clicked', async () => {
+//   const wrapper = mount(Checkboxgroup, {
+//     slots: {
+//       default: () => {
+//         return h(
+//           'nut-checkbox',
+//           {
+//             modelValue: 'false',
+//             label: '1'
+//           }
+//         )
+//       }
+//     }
+//   });
+
+//   expect(wrapper.html()).toContain('abc');
+
+// const items = wrapper.findAll('.nut-checkbox');
+// console.log('blabla', wrapper)
+
+// await items[0].trigger('click');
+// expect(wrapper.vm).toContain('ballll')
+
+// await items[1].trigger('click');
+// expect(wrapper.vm.value).toEqual(['1', '2']);
+
+// await items[0].trigger('click');
+// expect(wrapper.vm.value).toEqual(['2']);
+// });