Skip to content

Commit c91c989

Browse files
authored
fix: sort dependencies (#505)
1 parent 881588a commit c91c989

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

packages/test-utils/src/set-watchers-to-sync.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function setDepsSync (dep) {
2+
dep.subs = dep.subs.sort((a, b) => a.id - b.id)
23
dep.subs.forEach(setWatcherSync)
34
}
45

test/specs/wrapper/setData.spec.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,35 @@ describeWithShallowAndMount('setData', (mountingMethod) => {
8383
expect(fn2).to.throw().with.property('message', message)
8484
})
8585

86-
it('should not run watchers if data updated is null', () => {
86+
it('updates watchers if computed is updated', () => {
87+
const TestComponent = {
88+
template: `
89+
<em>{{ computedText }}</em>
90+
`,
91+
data () {
92+
return {
93+
text: '',
94+
basket: []
95+
}
96+
},
97+
computed: {
98+
computedText () {
99+
return this.text
100+
}
101+
},
102+
watch: {
103+
text () {
104+
this.basket.push(this.computedText)
105+
}
106+
}
107+
}
108+
const wrapper = mountingMethod(TestComponent)
109+
110+
wrapper.setData({ text: 'hello' })
111+
expect(wrapper.vm.basket[0]).to.equal('hello')
112+
})
113+
114+
it('should update watchers correctly', () => {
87115
const TestComponent = {
88116
template: `
89117
<div>

0 commit comments

Comments
 (0)