From d747469e1ae26190d364e5cc9c8112d3d865a0b9 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 26 Dec 2018 16:02:50 -0500 Subject: [PATCH] test: test case for v-for native collection support --- test/unit/features/directives/for.spec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/unit/features/directives/for.spec.js b/test/unit/features/directives/for.spec.js index 12921edd..eb28b09c 100644 --- a/test/unit/features/directives/for.spec.js +++ b/test/unit/features/directives/for.spec.js @@ -125,6 +125,26 @@ describe('Directive v-for', () => { }) if (hasSymbol) { + it('should render native iterables (Map)', () => { + const vm = new Vue({ + template: `
{{key}},{{val}}
`, + data: { + list: new Map([[1, 'foo'], [2, 'bar']]) + } + }).$mount() + expect(vm.$el.innerHTML).toBe(`1,foo2,bar`) + }) + + it('should render native iterables (Set)', () => { + const vm = new Vue({ + template: `
{{val}}
`, + data: { + list: new Set([1, 2, 3]) + } + }).$mount() + expect(vm.$el.innerHTML).toBe(`123`) + }) + it('should render iterable of primitive values', done => { const iterable = { models: ['a', 'b', 'c'],