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

make yield renderer names globally unique #242

Merged
merged 1 commit into from
Jan 4, 2017
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 src/generators/dom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DomGenerator extends Generator {
properties.addBlock( deindent`
teardown: function ( detach ) {
${fragment.builders.teardown}
},
}
` );
}

Expand Down
2 changes: 1 addition & 1 deletion src/generators/dom/visitors/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {

// Component has children, put them in a separate {{yield}} block
if ( hasChildren ) {
const yieldName = generator.current.getUniqueName( `render${name}YieldFragment` );
const yieldName = generator.getUniqueName( `render${name}YieldFragment` );

generator.generateBlock( node, yieldName );

Expand Down
1 change: 1 addition & 0 deletions test/generator/component-yield-multiple-in-if/Widget.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p class='widget'>{{yield}}</p>
14 changes: 14 additions & 0 deletions test/generator/component-yield-multiple-in-if/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
solo: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☹️

Is there a way to make the CI job fail if there are any solo: true tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eek, good catch, thanks. I think process.env.CI is true in both Travis and Appveyor environments... let's find out! #244


html: `
<div><p class='widget'>Hello</p></div>
`,

test ( assert, component, target ) {
component.set({ arriving: false });
assert.htmlEqual( target.innerHTML, `<div><p class='widget'>Goodbye</p></div>` );

component.teardown();
}
};
23 changes: 23 additions & 0 deletions test/generator/component-yield-multiple-in-if/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div>
{{#if arriving}}
<Widget>Hello</Widget>
{{else}}
<Widget>Goodbye</Widget>
{{/if}}
</div>

<script>
import Widget from './Widget.html';

export default {
data () {
return {
arriving: true
}
},

components: {
Widget
}
};
</script>