File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,8 @@ import { mount } from "@vue/test-utils";
22
33const App = {
44 data : ( ) => ( {
5- msg : "Hello" ,
5+ count : 0 ,
66 } ) ,
7- props : {
8- count : {
9- type : Number ,
10- } ,
11- } ,
127 template : `
138 <div v-if="count % 2 === 0">
149 Count: {{ count }}. Count is even.
@@ -20,21 +15,30 @@ const App = {
2015 ` ,
2116} ;
2217
23- function factory ( props ) {
18+ function factory ( { data } ) {
2419 return mount ( App , {
25- props,
20+ data ( ) {
21+ return data ;
22+ } ,
2623 } ) ;
2724}
2825
2926describe ( "App" , ( ) => {
3027 it ( "render count when odd" , ( ) => {
31- const wrapper = factory ( { count : 1 } ) ;
32- console . log ( wrapper . vm ) ;
28+ const wrapper = factory ( {
29+ data : {
30+ count : 1 ,
31+ } ,
32+ } ) ;
3333 expect ( wrapper . html ( ) ) . toContain ( "Count: 1. Count is odd" ) ;
3434 } ) ;
3535
3636 it ( "render count when even" , ( ) => {
37- const wrapper = factory ( { count : 2 } ) ;
37+ const wrapper = factory ( {
38+ data : {
39+ count : 2 ,
40+ } ,
41+ } ) ;
3842 expect ( wrapper . html ( ) ) . toContain ( "Count: 2. Count is even" ) ;
3943 } ) ;
4044} ) ;
You can’t perform that action at this time.
0 commit comments