File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ The `vue-testing-library` is a very light-weight solution for testing Vue
17
17
components. It provides light utility functions on top of ` @vue/test-utils ` , in a way that encourages better testing practices.
18
18
It's primary guiding principle is:
19
19
20
- > [ The more your tests resemble the way your software is used, the more confidence they can give you.] [ guiding-principle ]
20
+ The more your tests resemble the way your software is used, the more confidence they can give you.
21
21
22
22
## LICENSE
23
23
Original file line number Diff line number Diff line change @@ -2,23 +2,34 @@ export default {
2
2
click ( elem ) {
3
3
if ( elem ) {
4
4
if ( elem . trigger ) {
5
- elem . trigger ( 'submit' )
5
+ return elem . trigger ( 'submit' )
6
6
}
7
7
8
8
if ( elem . click ) {
9
- elem . click ( )
9
+ return elem . click ( )
10
10
}
11
11
}
12
12
} ,
13
13
submit ( elem ) {
14
14
if ( elem ) {
15
15
if ( elem . trigger ) {
16
- elem . trigger ( 'submit' )
16
+ return elem . trigger ( 'submit' )
17
17
}
18
18
19
19
if ( elem . submit ) {
20
- elem . submit ( )
20
+ return elem . submit ( )
21
21
}
22
22
}
23
+ } ,
24
+ change ( elem , value ) {
25
+ if ( elem ) {
26
+ if ( elem . trigger ) {
27
+ return elem . trigger ( 'change' , value )
28
+ }
29
+
30
+ if ( elem . value ) {
31
+ return elem . value = value
32
+ }
33
+ }
23
34
}
24
35
}
Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ test('login form submits', () => {
14
14
const formNode = wrapper . find ( 'form' )
15
15
const submitButtonNode = getByText ( 'submit' )
16
16
17
- // Act
17
+ // Act - this is waiting on an issue in @vue/test-utils to allow v-model to be updated by
18
+ // changes to DOM elements
19
+
20
+ // Simulate.change(usernameNode, fakeUser.username)
21
+ // Simulate.change(passwordNode, fakeUser.password)
18
22
wrapper . setData ( fakeUser )
19
23
20
24
// NOTE: in jsdom, it's not possible to trigger a form submission
You can’t perform that action at this time.
0 commit comments