Skip to content

Commit eb49441

Browse files
committed
test for props option alternative syntax
1 parent 81911b4 commit eb49441

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/specs/directives/prop_spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,5 +356,33 @@ if (_.inBrowser) {
356356
})
357357

358358
})
359+
360+
it('alternative syntax', function () {
361+
var vm = new Vue({
362+
el: el,
363+
template: '<test b="{{a}}" c="{{d}}"></test>',
364+
data: {
365+
a: 'AAA',
366+
d: 'DDD'
367+
},
368+
components: {
369+
test: {
370+
props: {
371+
b: String,
372+
c: {
373+
type: Number
374+
},
375+
d: {
376+
required: true
377+
}
378+
},
379+
template: '<p>{{b}}</p><p>{{c}}</p>'
380+
}
381+
}
382+
})
383+
expect(hasWarned(_, 'Missing required prop')).toBe(true)
384+
expect(hasWarned(_, 'Expected Number')).toBe(true)
385+
expect(el.textContent).toBe('AAA')
386+
})
359387
})
360388
}

0 commit comments

Comments
 (0)