Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in generator's contextualise; solves #46 #105

Merged
merged 1 commit into from
Dec 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
Expand Down
1 change: 1 addition & 0 deletions test/compiler/component-data-dynamic/Widget.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<p>foo: {{foo}}</p>
<p>baz: {{baz}} ({{typeof baz}})</p>
<p>qux: {{qux}}</p>
<p>quux: {{quux}}</p>
10 changes: 6 additions & 4 deletions test/compiler/component-data-dynamic/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ export default {
data: {
bar: 'lol',
x: 2,
compound: 'piece of'
compound: 'piece of',
go: { deeper: 'core' }
},
html: `<div><p>foo: lol</p>\n<p>baz: 42 (number)</p>\n<p>qux: this is a piece of string</p></div>`,
html: `<div><p>foo: lol</p>\n<p>baz: 42 (number)</p>\n<p>qux: this is a piece of string</p>\n<p>quux: core</p></div>`,
test ( assert, component, target ) {
component.set({
bar: 'wut',
x: 3,
compound: 'rather boring'
compound: 'rather boring',
go: { deeper: 'heart' }
});

assert.equal( target.innerHTML, `<div><p>foo: wut</p>\n<p>baz: 43 (number)</p>\n<p>qux: this is a rather boring string</p></div>` );
assert.equal( target.innerHTML, `<div><p>foo: wut</p>\n<p>baz: 43 (number)</p>\n<p>qux: this is a rather boring string</p>\n<p>quux: heart</p></div>` );
}
};
2 changes: 1 addition & 1 deletion test/compiler/component-data-dynamic/main.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
<Widget foo='{{bar}}' baz='{{40 + x}}' qux='this is a {{compound}} string'/>
<Widget foo='{{bar}}' baz='{{40 + x}}' qux='this is a {{compound}} string' quux='{{go.deeper}}'/>
</div>

<script>
Expand Down