質問編集履歴
2
タイポ修正。
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
import { shallowMount } from '@vue/test-utils';
|
46
46
|
|
47
|
-
mport Test from 'test.vue';
|
47
|
+
import Test from 'test.vue';
|
48
48
|
|
49
49
|
|
50
50
|
|
1
テストコード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,14 +34,38 @@
|
|
34
34
|
|
35
35
|
```
|
36
36
|
|
37
|
-
|
38
|
-
|
39
37
|
このようなVueコンポーネントがあるとします。
|
40
38
|
|
41
39
|
`'@vue/test-utils + Jest'`で`onSubmit`メソッドをテストしようと思ったのですが、
|
42
40
|
|
43
41
|
`$refs.formのsubmitイベントが発火した`というテストの書き方がわかりません。
|
44
42
|
|
43
|
+
```test.js
|
44
|
+
|
45
|
+
import { shallowMount } from '@vue/test-utils';
|
46
|
+
|
47
|
+
mport Test from 'test.vue';
|
45
48
|
|
46
49
|
|
50
|
+
|
51
|
+
describe('onSubmit', () => {
|
52
|
+
|
53
|
+
test('formのsubmitイベントが発火すること', () => {
|
54
|
+
|
55
|
+
const wrapper = shallowMount(Test);
|
56
|
+
|
57
|
+
wrapper.vm.onSubmit();
|
58
|
+
|
59
|
+
wrapper.vm.$nextTick(() => {
|
60
|
+
|
61
|
+
// ????
|
62
|
+
|
63
|
+
});
|
64
|
+
|
65
|
+
});
|
66
|
+
|
67
|
+
});
|
68
|
+
|
69
|
+
```
|
70
|
+
|
47
71
|
どなたかご教示のほどよろしくお願いします。
|