You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/extending-vtu/plugins.md
+50-4Lines changed: 50 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,9 @@ Some use cases for plugins:
10
10
1. Attaching matchers to the Wrapper instance
11
11
1. Attaching functionality to the Wrapper
12
12
13
-
## Using a Plugin
13
+
## Wrapper Plugin
14
+
15
+
### Using a Plugin
14
16
15
17
Install plugins by calling the `config.plugins.VueWrapper.install()` method
16
18
. This has to be done before you call `mount`.
@@ -43,12 +45,12 @@ once. Follow the instructions of the plugin you're installing.
43
45
44
46
Check out the [Vue Community Guide](https://vue-community.org/v2/guide/ecosystem/testing.html) or [awesome-vue](https://github.com/vuejs/awesome-vue#test) for a collection of community-contributed plugins and libraries.
45
47
46
-
## Writing a Plugin
48
+
###Writing a Plugin
47
49
48
50
A Vue Test Utils plugin is simply a function that receives the mounted
49
51
`VueWrapper` or `DOMWrapper` instance and can modify it.
50
52
51
-
### Basic Plugin
53
+
####Basic Plugin
52
54
53
55
Below is a simple plugin to add a convenient alias to map `wrapper.element` to `wrapper.$el`
The below plugin adds a method `findByTestId` to the `VueWrapper` instance. This encourages using a selector strategy relying on test-only attributes on your Vue Components.
0 commit comments