File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
test/specs/mounting-options Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ import {
2+ describeWithShallowAndMount ,
3+ isRunningPhantomJS ,
4+ vueVersion
5+ } from '~resources/utils'
6+ import { itSkipIf , itDoNotRunIf } from 'conditional-specs'
7+
8+ describeWithShallowAndMount ( 'options.watch' , mountingMethod => {
9+ it ( 'overrides a default watch handler' , async ( ) => {
10+ const TestComponent = {
11+ props : [ 'someProp' ] ,
12+ template : '<div>{{ foo }}</div>' ,
13+ data ( ) {
14+ return {
15+ foo : 'bar'
16+ }
17+ } ,
18+ watch : {
19+ someProp : {
20+ handler ( ) {
21+ this . foo = 'updated-bar'
22+ }
23+ }
24+ }
25+ }
26+ const wrapper = mountingMethod ( TestComponent , {
27+ watch : {
28+ someProp : {
29+ handler ( ) {
30+ // do nothing
31+ }
32+ }
33+ }
34+ } )
35+
36+ wrapper . setProps ( { someProp : 'some-new-val' } )
37+ await wrapper . vm . $nextTick ( )
38+
39+ expect ( wrapper . text ( ) ) . to . equal ( 'bar' )
40+ } )
41+ } )
You can’t perform that action at this time.
0 commit comments