From bf12bb54a7a7b268a7dd0ab2b01592798fffb40d Mon Sep 17 00:00:00 2001 From: mrkishi Date: Sat, 3 Dec 2016 22:09:38 -0200 Subject: [PATCH] Fix typo in generator's contextualise; solves #46 --- compiler/generate/index.js | 2 +- test/compiler/component-data-dynamic/Widget.html | 1 + test/compiler/component-data-dynamic/_config.js | 10 ++++++---- test/compiler/component-data-dynamic/main.html | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/compiler/generate/index.js b/compiler/generate/index.js index 347d7062cf..cf2e17bbf7 100644 --- a/compiler/generate/index.js +++ b/compiler/generate/index.js @@ -101,7 +101,7 @@ export default function generate ( parsed, source, options ) { const context = indexes[ name ]; if ( !~usedContexts.indexOf( context ) ) usedContexts.push( context ); } else { - dependencies.push( node.name ); + dependencies.push( name ); generator.code.prependRight( node.start, `root.` ); if ( !~usedContexts.indexOf( 'root' ) ) usedContexts.push( 'root' ); } diff --git a/test/compiler/component-data-dynamic/Widget.html b/test/compiler/component-data-dynamic/Widget.html index 5886087d16..43184b9ad8 100644 --- a/test/compiler/component-data-dynamic/Widget.html +++ b/test/compiler/component-data-dynamic/Widget.html @@ -1,3 +1,4 @@

foo: {{foo}}

baz: {{baz}} ({{typeof baz}})

qux: {{qux}}

+

quux: {{quux}}

diff --git a/test/compiler/component-data-dynamic/_config.js b/test/compiler/component-data-dynamic/_config.js index 514faf667e..48c8fff2bf 100644 --- a/test/compiler/component-data-dynamic/_config.js +++ b/test/compiler/component-data-dynamic/_config.js @@ -2,16 +2,18 @@ export default { data: { bar: 'lol', x: 2, - compound: 'piece of' + compound: 'piece of', + go: { deeper: 'core' } }, - html: `

foo: lol

\n

baz: 42 (number)

\n

qux: this is a piece of string

`, + html: `

foo: lol

\n

baz: 42 (number)

\n

qux: this is a piece of string

\n

quux: core

`, test ( assert, component, target ) { component.set({ bar: 'wut', x: 3, - compound: 'rather boring' + compound: 'rather boring', + go: { deeper: 'heart' } }); - assert.equal( target.innerHTML, `

foo: wut

\n

baz: 43 (number)

\n

qux: this is a rather boring string

` ); + assert.equal( target.innerHTML, `

foo: wut

\n

baz: 43 (number)

\n

qux: this is a rather boring string

\n

quux: heart

` ); } }; diff --git a/test/compiler/component-data-dynamic/main.html b/test/compiler/component-data-dynamic/main.html index 118ba7b76e..12d5f3208b 100644 --- a/test/compiler/component-data-dynamic/main.html +++ b/test/compiler/component-data-dynamic/main.html @@ -1,5 +1,5 @@
- +