File tree Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Expand file tree Collapse file tree 4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 43
43
- [ destroy] ( api/wrapper/destroy.md )
44
44
- [ find] ( api/wrapper/find.md )
45
45
- [ findAll] ( api/wrapper/findAll.md )
46
+ - [ findComponent] ( api/wrapper/findComponent.md )
47
+ - [ findAllComponents] ( api/wrapper/findAllComponents.md )
46
48
- [ html] ( api/wrapper/html.md )
47
49
- [ is] ( api/wrapper/is.md )
48
50
- [ isEmpty] ( api/wrapper/isEmpty.md )
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ vue-test-utils はラッパベースの API です。
31
31
!!!include(docs/ja/api/wrapper/exists.md)!!!
32
32
!!!include(docs/ja/api/wrapper/find.md)!!!
33
33
!!!include(docs/ja/api/wrapper/findAll.md)!!!
34
+ !!!include(docs/ja/api/wrapper/findComponent.md)!!!
35
+ !!!include(docs/ja/api/wrapper/findAllComponents.md)!!!
34
36
!!!include(docs/ja/api/wrapper/html.md)!!!
35
37
!!!include(docs/ja/api/wrapper/is.md)!!!
36
38
!!!include(docs/ja/api/wrapper/isEmpty.md)!!!
Original file line number Diff line number Diff line change
1
+ ## findAllComponents
2
+
3
+ 一致するすべての Vue コンポーネントの ` WrapperArray ` を返します。
4
+
5
+ - ** 引数:**
6
+
7
+ - ` {Component|ref|name} selector `
8
+
9
+ - ** 戻り値:** ` {WrapperArray} `
10
+
11
+ - ** 例:**
12
+
13
+ ``` js
14
+ import { mount } from ' @vue/test-utils'
15
+ import Foo from ' ./Foo.vue'
16
+ import Bar from ' ./Bar.vue'
17
+
18
+ const wrapper = mount (Foo)
19
+ const bar = wrapper .findAllComponents (Bar).at (0 )
20
+ expect (bar .exists ()).toBeTruthy ()
21
+ const bars = wrapper .findAllComponents (Bar)
22
+ expect (bar).toHaveLength (1 )
23
+ ```
Original file line number Diff line number Diff line change
1
+ ## findComponent
2
+
3
+ 最初に一致した Vue コンポーネントの ` Wrapper ` を返します。
4
+
5
+ - ** 引数:**
6
+
7
+ - ` {Component|ref|name} selector `
8
+
9
+ - ** 戻り値:** ` {Wrapper} `
10
+
11
+ - ** 例:**
12
+
13
+ ``` js
14
+ import { mount } from ' @vue/test-utils'
15
+ import Foo from ' ./Foo.vue'
16
+ import Bar from ' ./Bar.vue'
17
+
18
+ const wrapper = mount (Foo)
19
+
20
+ const bar = wrapper .findComponent (Bar) // => コンポーネントインスタンスによってバーを検索します
21
+ expect (bar .exists ()).toBe (true )
22
+ const barByName = wrapper .findComponent ({ name: ' bar' }) // => `name` でバーを検索します
23
+ expect (barByName .exists ()).toBe (true )
24
+ const barRef = wrapper .findComponent ({ ref: ' bar' }) // => `ref` でバーを検索します
25
+ expect (barRef .exists ()).toBe (true )
26
+ ```
You can’t perform that action at this time.
0 commit comments