Skip to content

Commit

Permalink
fix: sort dependencies (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed Mar 31, 2018
1 parent 881588a commit c91c989
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/test-utils/src/set-watchers-to-sync.js
@@ -1,4 +1,5 @@
function setDepsSync (dep) {
dep.subs = dep.subs.sort((a, b) => a.id - b.id)
dep.subs.forEach(setWatcherSync)
}

Expand Down
30 changes: 29 additions & 1 deletion test/specs/wrapper/setData.spec.js
Expand Up @@ -83,7 +83,35 @@ describeWithShallowAndMount('setData', (mountingMethod) => {
expect(fn2).to.throw().with.property('message', message)
})

it('should not run watchers if data updated is null', () => {
it('updates watchers if computed is updated', () => {
const TestComponent = {
template: `
<em>{{ computedText }}</em>
`,
data () {
return {
text: '',
basket: []
}
},
computed: {
computedText () {
return this.text
}
},
watch: {
text () {
this.basket.push(this.computedText)
}
}
}
const wrapper = mountingMethod(TestComponent)

wrapper.setData({ text: 'hello' })
expect(wrapper.vm.basket[0]).to.equal('hello')
})

it('should update watchers correctly', () => {
const TestComponent = {
template: `
<div>
Expand Down

0 comments on commit c91c989

Please sign in to comment.