Skip to content

Commit 04fde70

Browse files
committed
test warn duplicate object on v-repeat diff
1 parent 453f438 commit 04fde70

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/unit/specs/directives/repeat_spec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ if (_.inBrowser) {
571571
}
572572
})
573573

574-
it('warn duplicate objects', function () {
574+
it('warn duplicate objects on initial render', function () {
575575
var obj = {}
576576
new Vue({
577577
el: el,
@@ -583,6 +583,23 @@ if (_.inBrowser) {
583583
expect(hasWarned(_, 'Duplicate objects')).toBe(true)
584584
})
585585

586+
it('warn duplicate objects on diff', function (done) {
587+
var obj = {}
588+
var vm = new Vue({
589+
el: el,
590+
template: '<div v-repeat="items"></div>',
591+
data: {
592+
items: [obj]
593+
}
594+
})
595+
expect(_.warn).not.toHaveBeenCalled()
596+
vm.items.push(obj)
597+
_.nextTick(function () {
598+
expect(hasWarned(_, 'Duplicate objects')).toBe(true)
599+
done()
600+
})
601+
})
602+
586603
it('warn duplicate trackby id', function () {
587604
new Vue({
588605
el: el,

0 commit comments

Comments
 (0)