Skip to content

Commit

Permalink
Merge pull request #11786 from pdud/pd-with-foo-as-bar
Browse files Browse the repository at this point in the history
[CLEANUP BETA] Remove {{with foo as bar}} support
  • Loading branch information
rwjblue committed Jul 17, 2015
2 parents 8e03e3a + fefbdd9 commit ddd139c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 116 deletions.
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/lib/keywords/with.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {

Ember.assert(
'{{#with foo}} must be called with a single argument or the use the ' +
'{{#with foo as bar}} syntax',
'{{#with foo as |bar|}} syntax',
params.length === 1
);

Expand Down
16 changes: 7 additions & 9 deletions packages/ember-htmlbars/tests/helpers/with_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ function testWithAs(moduleName, templateString, deprecated) {
});
}

testWithAs('ember-htmlbars: {{#with}} helper', '{{#with person as tom}}{{title}}: {{tom.name}}{{/with}}', true);

QUnit.module('Multiple Handlebars {{with foo as bar}} helpers', {
QUnit.module('Multiple Handlebars {{with foo as |bar|}} helpers', {
setup() {
Ember.lookup = lookup = { Ember: Ember };
},
Expand Down Expand Up @@ -147,7 +145,7 @@ QUnit.module('Handlebars {{#with}} globals helper [DEPRECATED]', {
}
});

QUnit.test('it should support #with Foo.bar as qux [DEPRECATED]', function() {
QUnit.test('it should support #with Foo.bar as |qux| [DEPRECATED]', function() {
expectDeprecation(function() {
runAppend(view);
}, /Global lookup of Foo from a Handlebars template is deprecated/);
Expand All @@ -163,7 +161,7 @@ QUnit.test('it should support #with Foo.bar as qux [DEPRECATED]', function() {

QUnit.module('Handlebars {{#with keyword as |foo|}}');

QUnit.test('it should support #with view as foo', function() {
QUnit.test('it should support #with view as |foo|', function() {
var view = EmberView.create({
template: compile('{{#with view as |myView|}}{{myView.name}}{{/with}}'),
name: 'Sonics'
Expand All @@ -181,7 +179,7 @@ QUnit.test('it should support #with view as foo', function() {
runDestroy(view);
});

QUnit.test('it should support #with name as foo, then #with foo as bar', function() {
QUnit.test('it should support #with name as |foo|, then #with foo as |bar|', function() {
var view = EmberView.create({
template: compile('{{#with name as |foo|}}{{#with foo as |bar|}}{{bar}}{{/with}}{{/with}}'),
context: { name: 'caterpillar' }
Expand All @@ -201,7 +199,7 @@ QUnit.test('it should support #with name as foo, then #with foo as bar', functio

QUnit.module('Handlebars {{#with this as |foo|}}');

QUnit.test('it should support #with this as qux', function() {
QUnit.test('it should support #with this as |qux|', function() {
var view = EmberView.create({
template: compile('{{#with this as |person|}}{{person.name}}{{/with}}'),
controller: EmberObject.create({ name: 'Los Pivots' })
Expand All @@ -219,9 +217,9 @@ QUnit.test('it should support #with this as qux', function() {
runDestroy(view);
});

QUnit.module('Handlebars {{#with foo as bar}} with defined controller');
QUnit.module('Handlebars {{#with foo as |bar|}} with defined controller');

QUnit.test('destroys the controller generated with {{with foo as bar controller=\'blah\'}}', function() {
QUnit.test('destroys the controller generated with {{with foo as |bar| controller=\'blah\'}}', function() {
var destroyed = false;
var Controller = EmberController.extend({
willDestroy() {
Expand Down
2 changes: 0 additions & 2 deletions packages/ember-template-compiler/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import compile from 'ember-template-compiler/system/compile';
import template from 'ember-template-compiler/system/template';
import { registerPlugin } from 'ember-template-compiler/plugins';

import TransformWithAsToHash from 'ember-template-compiler/plugins/transform-with-as-to-hash';
import TransformEachIntoCollection from 'ember-template-compiler/plugins/transform-each-into-collection';
import TransformOldBindingSyntax from 'ember-template-compiler/plugins/transform-old-binding-syntax';
import TransformOldClassBindingSyntax from 'ember-template-compiler/plugins/transform-old-class-binding-syntax';
Expand All @@ -20,7 +19,6 @@ import DeprecateViewHelper from 'ember-template-compiler/plugins/deprecate-view-
// used for adding Ember.Handlebars.compile for backwards compat
import 'ember-template-compiler/compat';

registerPlugin('ast', TransformWithAsToHash);
registerPlugin('ast', TransformEachIntoCollection);
registerPlugin('ast', TransformOldBindingSyntax);
registerPlugin('ast', TransformOldClassBindingSyntax);
Expand Down

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions packages/ember-template-compiler/tests/system/compile_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,3 @@ QUnit.test('the template revision is different than the HTMLBars default revisio

ok(actual.meta.revision !== expected.meta.revision, 'revision differs from default');
});

QUnit.test('{{with}} template deprecation includes moduleName if provided', function() {
var templateString = '{{#with foo as bar}} {{bar}} {{/with}}';

expectDeprecation(function() {
compile(templateString, {
moduleName: 'foo/bar/baz'
});
}, /foo\/bar\/baz/);
});
8 changes: 0 additions & 8 deletions tests/node/template-compiler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ test('can be required', function() {
ok(typeof templateCompiler.template === 'function', 'template function is present');
});

test('uses plugins with precompile', function() {
var templateOutput;
var templateCompiler = require(path.join(distPath, 'ember-template-compiler'));

templateOutput = templateCompiler.precompile('{{#with foo as bar}}{{/with}}');
ok(templateOutput.match(/locals: \["bar"\]/), 'transform with as to block params');
});

test('allows enabling of features', function() {
var templateOutput;
var templateCompiler = require(path.join(distPath, 'ember-template-compiler'));
Expand Down

0 comments on commit ddd139c

Please sign in to comment.