Skip to content

Commit

Permalink
Merge pull request #11309 from splattne/patch-1
Browse files Browse the repository at this point in the history
Change {{each ...}} to {{#each ...}} in deprecation messages
  • Loading branch information
rwjblue committed May 30, 2015
2 parents e88ed22 + 23c36f5 commit 7e9cec4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TransformEachInToBlockParams.prototype.transform = function TransformEachInToBlo
moduleInfo = calculateLocationDisplay(moduleName, node.program.loc);

if (node.program.blockParams.length) {
throw new Error('You cannot use keyword (`{{each foo in bar}}`) and block params (`{{each bar as |foo|}}`) at the same time ' + moduleInfo + '.');
throw new Error('You cannot use keyword (`{{#each foo in bar}}`) and block params (`{{#each bar as |foo|}}`) at the same time ' + moduleInfo + '.');
}

node.program.blockParams = [keyword];
Expand All @@ -65,8 +65,8 @@ TransformEachInToBlockParams.prototype.transform = function TransformEachInToBlo
}

Ember.deprecate(
`Using the '{{each item in model}}' form of the {{each}} helper ${moduleInfo}is deprecated. ` +
`Please use the block param form instead ('{{each model as |item|}}').`,
`Using the '{{#each item in model}}' form of the {{#each}} helper ${moduleInfo}is deprecated. ` +
`Please use the block param form instead ('{{#each model as |item|}}').`,
false,
{ url: 'http://emberjs.com/guides/deprecations/#toc_code-in-code-syntax-for-code-each-code' }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ QUnit.test('cannot use block params and keyword syntax together', function() {

throws(function() {
compile('{{#each thing in controller as |other-thing|}}{{thing}}-{{other-thing}}{{/each}}', true);
}, /You cannot use keyword \(`{{each foo in bar}}`\) and block params \(`{{each bar as \|foo\|}}`\) at the same time\ ./);
}, /You cannot use keyword \(`{{#each foo in bar}}`\) and block params \(`{{#each bar as \|foo\|}}`\) at the same time\ ./);
});

QUnit.test('using {{each in}} syntax is deprecated for blocks', function() {
QUnit.test('using {{#each in}} syntax is deprecated for blocks', function() {
expect(1);

expectDeprecation(function() {
compile('\n\n {{#each foo in model}}{{/each}}', { moduleName: 'foo/bar/baz' });
}, `Using the '{{each item in model}}' form of the {{each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{each model as |item|}}').`);
}, `Using the '{{#each item in model}}' form of the {{#each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{#each model as |item|}}').`);
});

QUnit.test('using {{each in}} syntax is deprecated for non-block statemens', function() {
QUnit.test('using {{#each in}} syntax is deprecated for non-block statemens', function() {
expect(1);

expectDeprecation(function() {
compile('\n\n {{each foo in model}}', { moduleName: 'foo/bar/baz' });
}, `Using the '{{each item in model}}' form of the {{each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{each model as |item|}}').`);
}, `Using the '{{#each item in model}}' form of the {{#each}} helper ('foo/bar/baz' @ L3:C3) is deprecated. Please use the block param form instead ('{{#each model as |item|}}').`);
});

0 comments on commit 7e9cec4

Please sign in to comment.