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

[BUGFIX release] Fixes {{#with proxy as |foo|}} #13049

Merged
merged 2 commits into from
Mar 5, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions packages/ember-glimmer/tests/integration/syntax/with-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,34 @@ moduleFor('Syntax test: {{#with as}}', class extends TogglingSyntaxConditionalsT
this.assertText('No Thing bar');
}

['@test can access alias of a proxy']() {
this.render(`{{#with proxyThing as |person|}}{{person.name}}{{/with}}`, {
proxyThing: { isTruthy: true, name: 'Tom Dale' }
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I use a real proxy here? My concern is that we will remove the actual proxy implementations when the the addons get EOL'ed, and when we do that, we might end up removing this test.

(Actually, are the isTruthy stuff intrinsically important, or are they just there to help us implement proxies? i.e. can we remove support for isTruthy when we remove proxies?)

Copy link
Member Author

Choose a reason for hiding this comment

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

actually, I was confused – controllers were being removed but not proxies, so, ignore me!

});

this.assertText('Tom Dale');

this.runTask(() => this.rerender());

this.assertText('Tom Dale');

this.runTask(() => set(this.context, 'proxyThing.name', 'Yehuda Katz'));

this.assertText('Yehuda Katz');

this.runTask(() => set(this.context, 'proxyThing.isTruthy', false));

this.assertText('');

this.runTask(() => set(this.context, 'proxyThing.name', 'Godfrey Chan'));

this.assertText('');

this.runTask(() => set(this.context, 'proxyThing', { isTruthy: true, name: 'Tom Dale' }));

this.assertText('Tom Dale');
}

['@test can access alias of an array']() {
this.render(`{{#with arrayThing as |words|}}{{#each words as |word|}}{{word}}{{/each}}{{/with}}`, {
arrayThing: emberA(['Hello', ' ', 'world'])
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/hooks/link-render-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function shouldDisplay(predicate, coercer) {
}

if (typeof isTruthyVal === 'boolean') {
return isTruthyVal;
return isTruthyVal ? coercer(predicateVal) : false;
}

return coercer(predicateVal);
Expand Down