Skip to content

Commit 9f40996

Browse files
committed
fix: add a failing test
1 parent e7b8d50 commit 9f40996

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
})

0 commit comments

Comments
 (0)