Skip to content

Commit

Permalink
Fix typo in generator's contextualise; solves sveltejs#46
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkishi committed Dec 4, 2016
1 parent e09a39d commit bf12bb5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
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

0 comments on commit bf12bb5

Please sign in to comment.