Skip to content

Commit

Permalink
test case for v-t with a choice of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Jacoutot committed May 18, 2020
1 parent fccd7f2 commit e7d9edb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unit/directive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,26 @@ describe('custom directive', () => {
assert.strictEqual(vm.$refs.text._vt, 'cars')
}).then(done)
})

it('should allow a zero choice', done => {
const vm = createVM({
i18n,
render (h) {
// <p ref="text" v-t="{path: 'plurals.apple', choice: 0}"></p>
return h('p', { ref: 'text', directives: [{
name: 't', rawName: 'v-t', value: ({ path: 'plurals.apple', choice: 0 }), expression: { path: 'plurals.apple', choice: 0 }
}] })
}
})
nextTick(() => {
assert.strictEqual(vm.$refs.text.textContent, 'no apples')
assert.strictEqual(vm.$refs.text._vt, 'no apples')
vm.$forceUpdate()
}).then(() => {
assert.strictEqual(vm.$refs.text.textContent, 'no apples')
assert.strictEqual(vm.$refs.text._vt, 'no apples')
}).then(done)
})
})

describe('preserve content', () => {
Expand Down

0 comments on commit e7d9edb

Please sign in to comment.