File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ Vue Test Utils is the official unit testing utility library for Vue.js.
4444 - [ destroy] ( api/wrapper/destroy.md )
4545 - [ find] ( api/wrapper/find.md )
4646 - [ findAll] ( api/wrapper/findAll.md )
47+ - [ get] ( api/wrapper/get.md )
4748 - [ html] ( api/wrapper/html.md )
4849 - [ is] ( api/wrapper/is.md )
4950 - [ isEmpty] ( api/wrapper/isEmpty.md )
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods
3636!!!include(docs/api/wrapper/find.md)!!!
3737!!!include(docs/api/wrapper/findAll.md)!!!
3838!!!include(docs/api/wrapper/html.md)!!!
39+ !!!include(docs/api/wrapper/get.md)!!!
3940!!!include(docs/api/wrapper/is.md)!!!
4041!!!include(docs/api/wrapper/isEmpty.md)!!!
4142!!!include(docs/api/wrapper/isVisible.md)!!!
Original file line number Diff line number Diff line change 1+ ## get
2+
3+ Works just like [ find] ( ../find.md ) but will throw an error if selector not
4+ matching anything. You should use ` find ` when searching for an element that
5+ may not exist. You should use this method when getting an element that should
6+ exist and it will provide a nice error message if that is not the case.
7+
8+ ``` js
9+ import { mount } from ' @vue/test-utils'
10+
11+ const wrapper = mount (Foo)
12+
13+ expect (() => wrapper .get (' .does-not-exist' ))
14+ .to .throw ()
15+ .with .property (
16+ ' message' ,
17+ ' Unable to find .does-not-exist within: <div>the actual DOM here...</div>'
18+ )
19+ ```
You can’t perform that action at this time.
0 commit comments