Skip to content

Commit

Permalink
Merge pull request #13808 from asakusuma/global-local-lookup
Browse files Browse the repository at this point in the history
[Glimmer2] Complete local lookup
  • Loading branch information
krisselden committed Jul 12, 2016
2 parents cfb8ac8 + ceb1ca2 commit 2981ecf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default class Environment extends GlimmerEnvironment {
return generateBuiltInSyntax(statement, (path) => this.getComponentDefinition([path], parentMeta));
}

assert(`Could not find component named "${key}" (no component or template with that name was found)`, !isBlock || this.hasHelper(key, parentMeta));
assert(`A helper named "${key}" could not be found`, !isBlock || this.hasHelper(key, parentMeta));
}

assert(`Helpers may not be used in the block form, for example {{#${key}}}{{/${key}}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (${key})}}{{/if}}.`, !isBlock || !this.hasHelper(key, parentMeta));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ moduleFor('Components test: local lookup', class extends RenderingTest {
this.assertText('Who dat? Who dis?', 'Re-render works');
}

['@htmlbars it overrides global helper lookup']() {
['@test it overrides global helper lookup']() {
this.registerHelper('x-outer/x-helper', () => {
return 'Who dis?';
});
Expand All @@ -139,15 +139,15 @@ moduleFor('Components test: local lookup', class extends RenderingTest {
this.assertText('Who dat? Who dis? I dunno', 'Re-render works');
}

['@htmlbars lookup without match issues standard assertion (with local helper name)']() {
['@test lookup without match issues standard assertion (with local helper name)']() {
this.registerComponent('x-outer', { template: '{{#x-inner}}Hi!{{/x-inner}}' });

expectAssertion(() => {
this.render('{{x-outer}}');
}, /A helper named "x-inner" could not be found/);
}

['@htmlbars overrides global lookup']() {
['@test overrides global lookup']() {
this.registerComponent('x-outer', { template: '{{#x-inner}}Hi!{{/x-inner}}' });
this.registerComponent('x-outer/x-inner', { template: 'Nested template says (from local): {{yield}}' });
this.registerComponent('x-inner', { template: 'Nested template says (from global): {{yield}}' });
Expand Down

0 comments on commit 2981ecf

Please sign in to comment.