Skip to content

Commit

Permalink
feat(compiler): Add test for get raw binding attr
Browse files Browse the repository at this point in the history
  • Loading branch information
gzzhanghao committed Nov 28, 2017
1 parent 7388789 commit ca71c0d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/unit/modules/compiler/compiler-options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ describe('compile options', () => {
expect(compiled.errors.length).toBe(1)
expect(compiled.errors[0].start).toBe(0)
expect(compiled.errors[0].end).toBeUndefined()
expect(compiled.errors[0].msg).toContain('root element')

compiled = compile('<div v-if="a----">{{ b++++ }}</div>', { outputSourceRange: true })
expect(compiled.errors.length).toBe(2)
Expand All @@ -140,4 +139,11 @@ describe('compile options', () => {
expect(compiled.errors[1].start).toBe(18)
expect(compiled.errors[1].end).toBe(29)
})

it('should collect source range for binding keys', () => {
const compiled = compile('<div><slot v-bind:key="key" /></div>', { outputSourceRange: true })
expect(compiled.errors.length).toBe(1)
expect(compiled.errors[0].start).toBe(11)
expect(compiled.errors[0].end).toBe(27)
})
})

0 comments on commit ca71c0d

Please sign in to comment.