diff --git a/packages/ember-application/tests/system/application_test.js b/packages/ember-application/tests/system/application_test.js index 7491f7282ef..490c4fd5fff 100644 --- a/packages/ember-application/tests/system/application_test.js +++ b/packages/ember-application/tests/system/application_test.js @@ -15,6 +15,7 @@ import jQuery from 'ember-views/system/jquery'; import compile from 'ember-template-compiler/system/compile'; import { _loaded } from 'ember-runtime/system/lazy_load'; import { getDebugFunction, setDebugFunction } from 'ember-metal/debug'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var trim = jQuery.trim; @@ -123,7 +124,7 @@ QUnit.module('Ember.Application initialization', { if (app) { run(app, 'destroy'); } - Ember.TEMPLATES = {}; + setTemplates({}); ENV.LOG_VERSION = originalLogVersion; } }); @@ -142,9 +143,9 @@ QUnit.test('initialized application goes to initial route', function() { compile('{{outlet}}') ); - Ember.TEMPLATES.index = compile( + setTemplate('index', compile( '

Hi from index

' - ); + )); }); equal(jQuery('#qunit-fixture h1').text(), 'Hi from index'); diff --git a/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js b/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js index 068d2ed7617..a1ad9c999e5 100644 --- a/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js +++ b/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js @@ -1,5 +1,4 @@ /* globals EmberDev */ -import Ember from 'ember-metal/core'; // Ember.TEMPLATES import { context } from 'ember-environment'; import { getDebugFunction, setDebugFunction } from 'ember-metal/debug'; import run from 'ember-metal/run_loop'; @@ -16,6 +15,7 @@ import makeHTMLBarsBoundHelper from 'ember-htmlbars/system/make_bound_helper'; import { registerHelper } from 'ember-htmlbars/helpers'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var registry, locator, application, originalLookup, originalInfo; @@ -30,7 +30,7 @@ QUnit.module('Ember.Application Dependency Injection - default resolver', { }, teardown() { - Ember.TEMPLATES = {}; + setTemplates({}); context.lookup = originalLookup; run(application, 'destroy'); var UserInterfaceNamespace = Namespace.NAMESPACES_BY_ID['UserInterface']; @@ -58,9 +58,9 @@ QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', functio function fooBarTemplate() {} function fooBarBazTemplate() {} - Ember.TEMPLATES['foo'] = fooTemplate; - Ember.TEMPLATES['fooBar'] = fooBarTemplate; - Ember.TEMPLATES['fooBar/baz'] = fooBarBazTemplate; + setTemplate('foo', fooTemplate); + setTemplate('fooBar', fooBarTemplate); + setTemplate('fooBar/baz', fooBarBazTemplate); equal(locator.lookup('template:foo'), fooTemplate, 'resolves template:foo'); equal(locator.lookup('template:fooBar'), fooBarTemplate, 'resolves template:foo_bar'); diff --git a/packages/ember-htmlbars/tests/helpers/yield_test.js b/packages/ember-htmlbars/tests/helpers/yield_test.js index c299bd7e5ae..0aba8360fbc 100644 --- a/packages/ember-htmlbars/tests/helpers/yield_test.js +++ b/packages/ember-htmlbars/tests/helpers/yield_test.js @@ -1,5 +1,3 @@ -import Ember from 'ember-metal/core'; -import run from 'ember-metal/run_loop'; import EmberView from 'ember-views/views/view'; import Component from 'ember-views/components/component'; import ComponentLookup from 'ember-views/component_lookup'; @@ -33,9 +31,6 @@ QUnit.module('ember-htmlbars: Support for {{yield}} helper', { originalViewKeyword = registerKeyword('view', viewKeyword); }, teardown() { - run(function() { - Ember.TEMPLATES = {}; - }); runDestroy(view); commonTeardown(); resetKeyword('view', originalViewKeyword); diff --git a/packages/ember-htmlbars/tests/system/bootstrap_test.js b/packages/ember-htmlbars/tests/system/bootstrap_test.js index 9e04a32bd52..342aea9625f 100644 --- a/packages/ember-htmlbars/tests/system/bootstrap_test.js +++ b/packages/ember-htmlbars/tests/system/bootstrap_test.js @@ -1,12 +1,10 @@ -import Ember from 'ember-metal/core'; import { context } from 'ember-environment'; import run from 'ember-metal/run_loop'; -import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; import EmberView from 'ember-views/views/view'; import { runDestroy } from 'ember-runtime/tests/utils'; import bootstrap from 'ember-htmlbars/system/bootstrap'; -import Application from 'ember-application/system/application'; +import { setTemplates, get as getTemplate } from 'ember-htmlbars/template_registry'; var trim = jQuery.trim; @@ -17,7 +15,7 @@ function checkTemplate(templateName) { run(function() { bootstrap(jQuery('#qunit-fixture')); }); - var template = Ember.TEMPLATES[templateName]; + var template = getTemplate(templateName); ok(template, 'template is available on Ember.TEMPLATES'); equal(jQuery('#qunit-fixture script').length, 0, 'script removed'); var view = EmberView.create({ @@ -40,10 +38,10 @@ if (!isEnabled('ember-glimmer')) { QUnit.module('ember-htmlbars: bootstrap', { setup() { - context.lookup = lookup = { Ember: Ember }; + context.lookup = lookup = {}; }, teardown() { - Ember.TEMPLATES = {}; + setTemplates({}); context.lookup = originalLookup; runDestroy(App); runDestroy(view); @@ -76,10 +74,12 @@ if (typeof Handlebars === 'object') { bootstrap(jQuery('#qunit-fixture')); }); - ok(Ember.TEMPLATES['funkyTemplate'], 'template with name funkyTemplate available'); + let template = getTemplate('funkyTemplate'); + + ok(template, 'template with name funkyTemplate available'); // This won't even work with Ember templates - equal(trim(Ember.TEMPLATES['funkyTemplate']({ name: 'Tobias' })), 'Tobias'); + equal(trim(template({ name: 'Tobias' })), 'Tobias'); }); } @@ -133,42 +133,4 @@ QUnit.test('duplicated template data-template-name should throw exception', func 'duplicate templates should not be allowed'); }); -if (Ember.component) { - QUnit.test('registerComponents initializer', function() { - Ember.TEMPLATES['components/x-apple'] = 'asdf'; - - App = run(Application, 'create'); - - ok(Ember.Handlebars.helpers['x-apple'], 'x-apple helper is present'); - ok(App.__container__.has('component:x-apple'), 'the container is aware of x-apple'); - }); - - QUnit.test('registerComponents and generated components', function() { - Ember.TEMPLATES['components/x-apple'] = 'asdf'; - - App = run(Application, 'create'); - view = App.__container__.lookup('component:x-apple'); - equal(view.get('layoutName'), 'components/x-apple', 'has correct layout name'); - }); - - QUnit.test('registerComponents and non-generated components', function() { - Ember.TEMPLATES['components/x-apple'] = 'asdf'; - - run(function() { - App = Application.create(); - - // currently Component code must be loaded before initializers - // this is mostly due to how they are bootstrapped. We will hopefully - // sort this out soon. - App.XAppleComponent = Component.extend({ - isCorrect: true - }); - }); - - view = App.__container__.lookup('component:x-apple'); - equal(view.get('layoutName'), 'components/x-apple', 'has correct layout name'); - ok(view.get('isCorrect'), 'ensure a non-generated component'); - }); -} - } diff --git a/packages/ember-routing-htmlbars/tests/helpers/render_test.js b/packages/ember-routing-htmlbars/tests/helpers/render_test.js index 5e380726a03..a6ecebebadb 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/render_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/render_test.js @@ -1,4 +1,3 @@ -import Ember from 'ember-metal/core'; // TEMPLATES import { ENV } from 'ember-environment'; import { set } from 'ember-metal/property_set'; import run from 'ember-metal/run_loop'; @@ -6,10 +5,10 @@ import { observer } from 'ember-metal/mixin'; import EmberController from 'ember-runtime/controllers/controller'; import compile from 'ember-template-compiler/system/compile'; import EmberView from 'ember-views/views/view'; - import { buildAppInstance } from 'ember-routing-htmlbars/tests/utils'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import { OWNER } from 'container/owner'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; function runSet(object, key, value) { run(function() { @@ -33,8 +32,7 @@ QUnit.module('ember-routing-htmlbars: {{render}} helper', { ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT = ORIGINAL_LEGACY_CONTROLLER_FLAG; runDestroy(appInstance); runDestroy(view); - - Ember.TEMPLATES = {}; + setTemplates({}); } }); @@ -48,7 +46,7 @@ QUnit.test('{{render}} helper should render given template', function() { template: compile(template) }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); runAppend(view); @@ -68,9 +66,9 @@ QUnit.test('{{render}} helper should render nested helpers', function() { template: compile(template) }); - Ember.TEMPLATES['foo'] = compile('

FOO

{{render \'bar\'}}'); - Ember.TEMPLATES['bar'] = compile('

BAR

{{render \'baz\'}}'); - Ember.TEMPLATES['baz'] = compile('

BAZ

'); + setTemplate('foo', compile('

FOO

{{render \'bar\'}}')); + setTemplate('bar', compile('

BAR

{{render \'baz\'}}')); + setTemplate('baz', compile('

BAZ

')); runAppend(view); @@ -140,7 +138,7 @@ QUnit.test('{{render}} helper should render given template with a supplied model }); appInstance.register('controller:post', PostController); - Ember.TEMPLATES['post'] = compile('

{{model.title}}

'); + setTemplate('post', compile('

{{model.title}}

')); runAppend(view); @@ -179,7 +177,7 @@ QUnit.test('{{render}} helper with a supplied model should not fire observers on appInstance.register('controller:post', PostController); - Ember.TEMPLATES['post'] = compile('

{{title}}

'); + setTemplate('post', compile('

{{title}}

')); var modelDidChange = 0; runAppend(view); @@ -201,7 +199,7 @@ QUnit.test('{{render}} helper should raise an error when a given controller name template: compile(template) }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); expectAssertion(function() { runAppend(view); @@ -231,7 +229,7 @@ QUnit.test('{{render}} helper should render with given controller', function() { template: compile(template) }); - Ember.TEMPLATES['home'] = compile('{{uniqueId}}'); + setTemplate('home', compile('{{uniqueId}}')); runAppend(view); @@ -266,7 +264,7 @@ QUnit.test('{{render}} helper should rerender with given controller', function() template: compile(template) }); - Ember.TEMPLATES['home'] = compile('{{uniqueId}}'); + setTemplate('home', compile('{{uniqueId}}')); runAppend(view); run(() => { @@ -295,7 +293,7 @@ QUnit.test('{{render}} helper should render a template without a model only once template: compile(template) }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); expectAssertion(function() { runAppend(view); @@ -341,7 +339,7 @@ QUnit.test('{{render}} helper should render templates with models multiple times }); appInstance.register('controller:post', PostController, { singleton: false }); - Ember.TEMPLATES['post'] = compile('

{{model.title}}

'); + setTemplate('post', compile('

{{model.title}}

')); runAppend(view); @@ -386,7 +384,7 @@ QUnit.test('{{render}} helper should not leak controllers', function() { }); appInstance.register('controller:post', PostController); - Ember.TEMPLATES['post'] = compile('

{{title}}

'); + setTemplate('post', compile('

{{title}}

')); runAppend(view); @@ -424,7 +422,7 @@ QUnit.test('{{render}} helper should not treat invocations with falsy contexts a }); appInstance.register('controller:post', PostController, { singleton: false }); - Ember.TEMPLATES['post'] = compile('

{{#unless model}}NOTHING{{/unless}}

'); + setTemplate('post', compile('

{{#unless model}}NOTHING{{/unless}}

')); runAppend(view); @@ -468,7 +466,7 @@ QUnit.test('{{render}} helper should render templates both with and without mode }); appInstance.register('controller:post', PostController, { singleton: false }); - Ember.TEMPLATES['post'] = compile('

Title:{{model.title}}

'); + setTemplate('post', compile('

Title:{{model.title}}

')); runAppend(view); @@ -493,7 +491,7 @@ QUnit.test('{{render}} helper should be able to render a template again when it [OWNER]: appInstance }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); var liveRoutes = { render: { @@ -553,7 +551,7 @@ QUnit.test('{{render}} works with dot notation', function() { template: compile(template) }); - Ember.TEMPLATES['blog.post'] = compile('{{uniqueId}}'); + setTemplate('blog.post', compile('{{uniqueId}}')); runAppend(view); @@ -573,7 +571,7 @@ QUnit.test('throws an assertion if {{render}} is called with an unquoted templat template: compile(template) }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); expectAssertion(function() { runAppend(view); @@ -593,7 +591,7 @@ QUnit.test('throws an assertion if {{render}} is called with a literal for a mod template: compile(template) }); - Ember.TEMPLATES['home'] = compile('

BYE

'); + setTemplate('home', compile('

BYE

')); expectAssertion(function() { runAppend(view); diff --git a/packages/ember-routing-htmlbars/tests/utils.js b/packages/ember-routing-htmlbars/tests/utils.js index d54efb08a1b..e0917948ce1 100644 --- a/packages/ember-routing-htmlbars/tests/utils.js +++ b/packages/ember-routing-htmlbars/tests/utils.js @@ -1,4 +1,3 @@ -import Ember from 'ember-metal/core'; import { get } from 'ember-metal/property_get'; import { classify, @@ -19,6 +18,7 @@ import EmberObject from 'ember-runtime/system/object'; import Registry from 'container/registry'; import RegistryProxy from 'ember-runtime/mixins/registry_proxy'; import ContainerProxy from 'ember-runtime/mixins/container_proxy'; +import { get as getTemplate, has as hasTemplate } from 'ember-htmlbars/template_registry'; function resolverFor(namespace) { return { @@ -29,8 +29,8 @@ function resolverFor(namespace) { if (type === 'template') { var templateName = decamelize(name); - if (Ember.TEMPLATES[templateName]) { - return Ember.TEMPLATES[templateName]; + if (hasTemplate(templateName)) { + return getTemplate(templateName); } } diff --git a/packages/ember-testing/tests/helpers_test.js b/packages/ember-testing/tests/helpers_test.js index b58578477bf..010ab28d20b 100644 --- a/packages/ember-testing/tests/helpers_test.js +++ b/packages/ember-testing/tests/helpers_test.js @@ -1,10 +1,10 @@ -import Ember from 'ember-metal/core'; import Route from 'ember-routing/system/route'; import Controller from 'ember-runtime/controllers/controller'; import run from 'ember-metal/run_loop'; import EmberObject from 'ember-runtime/system/object'; import RSVP from 'ember-runtime/ext/rsvp'; import EmberView from 'ember-views/views/view'; +import Checkbox from 'ember-views/views/checkbox'; import jQuery from 'ember-views/system/jquery'; import Test from 'ember-testing/test'; @@ -18,6 +18,7 @@ import compile from 'ember-template-compiler/system/compile'; import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var App; var originalAdapter = Test.adapter; @@ -42,7 +43,7 @@ function cleanup() { App = null; } - Ember.TEMPLATES = {}; + setTemplates({}); } function assertHelpers(application, helperContainer, expected) { @@ -108,12 +109,12 @@ QUnit.test('Ember.Application#injectTestHelpers/#removeTestHelpers', function() App.injectTestHelpers(); assertHelpers(App); - ok(Ember.Test.Promise.prototype.LeakyMcLeakLeak, 'helper in question SHOULD be present'); + ok(Test.Promise.prototype.LeakyMcLeakLeak, 'helper in question SHOULD be present'); App.removeTestHelpers(); assertNoHelpers(App); - equal(Ember.Test.Promise.prototype.LeakyMcLeakLeak, undefined, 'should NOT leak test promise extensions'); + equal(Test.Promise.prototype.LeakyMcLeakLeak, undefined, 'should NOT leak test promise extensions'); }); @@ -352,7 +353,7 @@ QUnit.test('`click` triggers appropriate events in order', function() { }); }, - Checkbox: Ember.Checkbox.extend({ + Checkbox: Checkbox.extend({ click() { events.push('click:' + this.get('checked')); }, @@ -363,7 +364,7 @@ QUnit.test('`click` triggers appropriate events in order', function() { }) }); - Ember.TEMPLATES.index = compile('{{input type="text"}} {{view view.Checkbox}} {{textarea}}
'); + setTemplate('index', compile('{{input type="text"}} {{view view.Checkbox}} {{textarea}}
')); run(App, App.advanceReadiness); @@ -426,7 +427,7 @@ QUnit.test('`click` triggers native events with simulated X/Y coordinates', func }); - Ember.TEMPLATES.index = compile('some text'); + setTemplate('index', compile('some text')); run(App, App.advanceReadiness); @@ -461,7 +462,7 @@ QUnit.test('`triggerEvent` with mouseenter triggers native events with simulated }); - Ember.TEMPLATES.index = compile('some text'); + setTemplate('index', compile('some text')); run(App, App.advanceReadiness); diff --git a/packages/ember/tests/component_registration_test.js b/packages/ember/tests/component_registration_test.js index ef8033c5500..38cae57e158 100644 --- a/packages/ember/tests/component_registration_test.js +++ b/packages/ember/tests/component_registration_test.js @@ -1,8 +1,8 @@ -import Ember from 'ember-metal/core'; import Controller from 'ember-runtime/controllers/controller'; import run from 'ember-metal/run_loop'; import Application from 'ember-application/system/application'; +import Router from 'ember-routing/system/router'; import compile from 'ember-template-compiler/system/compile'; import helpers from 'ember-htmlbars/helpers'; import { OutletView } from 'ember-routing-views/views/outlet'; @@ -10,6 +10,7 @@ import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; import { A as emberA } from 'ember-runtime/system/native_array'; import isEnabled from 'ember-metal/features'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var App, appInstance; var originalHelpers; @@ -17,8 +18,8 @@ var originalHelpers; const keys = Object.keys; function prepare() { - Ember.TEMPLATES['components/expand-it'] = compile('

hello {{yield}}

'); - Ember.TEMPLATES.application = compile('Hello world {{#expand-it}}world{{/expand-it}}'); + setTemplate('components/expand-it', compile('

hello {{yield}}

')); + setTemplate('application', compile('Hello world {{#expand-it}}world{{/expand-it}}')); originalHelpers = emberA(keys(helpers)); } @@ -31,8 +32,7 @@ function cleanup() { } App = appInstance = null; } finally { - Ember.TEMPLATES = {}; - + setTemplates({}); cleanupHelpers(); } }); @@ -61,7 +61,7 @@ function boot(callback, startURL='/') { App.deferReadiness(); - App.Router = Ember.Router.extend({ + App.Router = Router.extend({ location: 'none' }); @@ -102,7 +102,7 @@ if (!isEnabled('ember-glimmer')) { // jscs:disable QUnit.test('Late-registered components can be rendered with custom `layout` property', function() { - Ember.TEMPLATES.application = compile('
there goes {{my-hero}}
'); + setTemplate('application', compile('
there goes {{my-hero}}
')); boot(function() { appInstance.register('component:my-hero', Component.extend({ @@ -116,7 +116,7 @@ QUnit.test('Late-registered components can be rendered with custom `layout` prop }); QUnit.test('Late-registered components can be rendered with template registered on the container', function() { - Ember.TEMPLATES.application = compile('
hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}
'); + setTemplate('application', compile('
hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}
')); boot(function() { appInstance.register('template:components/sally-rutherford', compile('funkytowny{{yield}}')); @@ -130,7 +130,7 @@ QUnit.test('Late-registered components can be rendered with template registered } QUnit.test('Late-registered components can be rendered with ONLY the template registered on the container', function() { - Ember.TEMPLATES.application = compile('
hello world {{borf-snorlax}}-{{#borf-snorlax}}!!!{{/borf-snorlax}}
'); + setTemplate('application', compile('
hello world {{borf-snorlax}}-{{#borf-snorlax}}!!!{{/borf-snorlax}}
')); boot(function() { appInstance.register('template:components/borf-snorlax', compile('goodfreakingTIMES{{yield}}')); @@ -141,7 +141,7 @@ QUnit.test('Late-registered components can be rendered with ONLY the template re }); QUnit.test('Component-like invocations are treated as bound paths if neither template nor component are registered on the container', function() { - Ember.TEMPLATES.application = compile('
{{user-name}} hello {{api-key}} world
'); + setTemplate('application', compile('
{{user-name}} hello {{api-key}} world
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -158,8 +158,8 @@ if (!isEnabled('ember-glimmer')) { QUnit.test('Assigning layoutName to a component should setup the template as a layout', function() { expect(1); - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); - Ember.TEMPLATES['foo-bar-baz'] = compile('{{text}}-{{yield}}'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); + setTemplate('foo-bar-baz', compile('{{text}}-{{yield}}')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -178,8 +178,8 @@ QUnit.test('Assigning layoutName to a component should setup the template as a l QUnit.test('Assigning layoutName and layout to a component should use the `layout` value', function() { expect(1); - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); - Ember.TEMPLATES['foo-bar-baz'] = compile('No way!'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); + setTemplate('foo-bar-baz', compile('No way!')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -199,7 +199,7 @@ QUnit.test('Assigning layoutName and layout to a component should use the `layou QUnit.test('Assigning defaultLayout to a component should set it up as a layout if no layout was found [DEPRECATED]', function() { expect(2); - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); expectDeprecation(function() { boot(function() { @@ -220,8 +220,8 @@ QUnit.test('Assigning defaultLayout to a component should set it up as a layout QUnit.test('Assigning defaultLayout to a component should set it up as a layout if layout was found [DEPRECATED]', function() { expect(2); - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); - Ember.TEMPLATES['components/my-component'] = compile('{{text}}-{{yield}}'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); + setTemplate('components/my-component', compile('{{text}}-{{yield}}')); expectDeprecation(function() { boot(function() { @@ -240,7 +240,7 @@ QUnit.test('Assigning defaultLayout to a component should set it up as a layout }); QUnit.test('Using name of component that does not exist', function () { - Ember.TEMPLATES.application = compile('
{{#no-good}} {{/no-good}}
'); + setTemplate('application', compile('
{{#no-good}} {{/no-good}}
')); expectAssertion(function () { boot(); @@ -253,8 +253,8 @@ QUnit.module('Application Lifecycle - Component Context', { }); QUnit.test('Components with a block should have the proper content when a template is provided', function() { - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); - Ember.TEMPLATES['components/my-component'] = compile('{{text}}-{{yield}}'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); + setTemplate('components/my-component', compile('{{text}}-{{yield}}')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -270,7 +270,7 @@ QUnit.test('Components with a block should have the proper content when a templa }); QUnit.test('Components with a block should yield the proper content without a template provided', function() { - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -286,8 +286,8 @@ QUnit.test('Components with a block should yield the proper content without a te }); QUnit.test('Components without a block should have the proper content when a template is provided', function() { - Ember.TEMPLATES.application = compile('
{{my-component}}
'); - Ember.TEMPLATES['components/my-component'] = compile('{{text}}'); + setTemplate('application', compile('
{{my-component}}
')); + setTemplate('components/my-component', compile('{{text}}')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -303,7 +303,7 @@ QUnit.test('Components without a block should have the proper content when a tem }); QUnit.test('Components without a block should have the proper content', function() { - Ember.TEMPLATES.application = compile('
{{my-component}}
'); + setTemplate('application', compile('
{{my-component}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -322,7 +322,7 @@ QUnit.test('Components without a block should have the proper content', function // The test following this one is the non-deprecated version QUnit.test('properties of a component without a template should not collide with internal structures [DEPRECATED]', function() { - Ember.TEMPLATES.application = compile('
{{my-component data=foo}}
'); + setTemplate('application', compile('
{{my-component data=foo}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -341,7 +341,7 @@ QUnit.test('properties of a component without a template should not collide with }); QUnit.test('attrs property of a component without a template should not collide with internal structures', function() { - Ember.TEMPLATES.application = compile('
{{my-component attrs=foo}}
'); + setTemplate('application', compile('
{{my-component attrs=foo}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -361,7 +361,7 @@ QUnit.test('attrs property of a component without a template should not collide }); QUnit.test('Components trigger actions in the parents context when called from within a block', function() { - Ember.TEMPLATES.application = compile('
{{#my-component}}Fizzbuzz{{/my-component}}
'); + setTemplate('application', compile('
{{#my-component}}Fizzbuzz{{/my-component}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -381,8 +381,8 @@ QUnit.test('Components trigger actions in the parents context when called from w }); QUnit.test('Components trigger actions in the components context when called from within its template', function() { - Ember.TEMPLATES.application = compile('
{{#my-component}}{{text}}{{/my-component}}
'); - Ember.TEMPLATES['components/my-component'] = compile('Fizzbuzz'); + setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); + setTemplate('components/my-component', compile('Fizzbuzz')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -406,9 +406,9 @@ QUnit.test('Components trigger actions in the components context when called fro }); QUnit.test('Components receive the top-level view as their ownerView', function(assert) { - Ember.TEMPLATES.application = compile('{{outlet}}'); - Ember.TEMPLATES.index = compile('{{my-component}}'); - Ember.TEMPLATES['components/my-component'] = compile('
'); + setTemplate('application', compile('{{outlet}}')); + setTemplate('index', compile('{{my-component}}')); + setTemplate('components/my-component', compile('
')); let component; diff --git a/packages/ember/tests/controller_test.js b/packages/ember/tests/controller_test.js index e231473d01f..24ae14abd8e 100644 --- a/packages/ember/tests/controller_test.js +++ b/packages/ember/tests/controller_test.js @@ -1,4 +1,3 @@ -import Ember from 'ember-metal/core'; import Controller from 'ember-runtime/controllers/controller'; import Route from 'ember-routing/system/route'; import run from 'ember-metal/run_loop'; @@ -8,6 +7,7 @@ import EmberView from 'ember-views/views/view'; import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; import isEnabled from 'ember-metal/features'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; /* In Ember 1.x, controllers subtly affect things like template scope @@ -17,12 +17,11 @@ import isEnabled from 'ember-metal/features'; from the runtime up to the templating layer. */ -var App, $fixture, templates; +var App, $fixture; QUnit.module('Template scoping examples', { setup() { run(function() { - templates = Ember.TEMPLATES; App = Application.create({ name: 'App', rootElement: '#qunit-fixture' @@ -46,7 +45,7 @@ QUnit.module('Template scoping examples', { App = null; - Ember.TEMPLATES = {}; + setTemplates({}); } }); @@ -56,7 +55,7 @@ if (!isEnabled('ember-glimmer')) { QUnit.test('Actions inside an outlet go to the associated controller', function() { expect(1); - templates.index = compile('{{component-with-action action=\'componentAction\'}}'); + setTemplate('index', compile('{{component-with-action action=\'componentAction\'}}')); App.IndexController = Controller.extend({ actions: { diff --git a/packages/ember/tests/helpers/helper_registration_test.js b/packages/ember/tests/helpers/helper_registration_test.js index ca6b131791d..73a564cc429 100644 --- a/packages/ember/tests/helpers/helper_registration_test.js +++ b/packages/ember/tests/helpers/helper_registration_test.js @@ -1,16 +1,17 @@ -import Ember from 'ember-metal/core'; import Controller from 'ember-runtime/controllers/controller'; import run from 'ember-metal/run_loop'; import helpers from 'ember-htmlbars/helpers'; import { compile } from 'ember-template-compiler'; import Helper, { helper } from 'ember-htmlbars/helper'; import Application from 'ember-application/system/application'; +import Router from 'ember-routing/system/router'; +import Service from 'ember-runtime/system/service'; import jQuery from 'ember-views/system/jquery'; import inject from 'ember-runtime/inject'; import isEnabled from 'ember-metal/features'; - import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var App, appInstance, originalViewKeyword; @@ -25,7 +26,7 @@ QUnit.module('Application Lifecycle - Helper Registration', { } App = appInstance = null; - Ember.TEMPLATES = {}; + setTemplates({}); }); delete helpers['foo-bar-baz-widget']; resetKeyword('view', originalViewKeyword); @@ -41,7 +42,7 @@ var boot = function(callback) { App.deferReadiness(); - App.Router = Ember.Router.extend({ + App.Router = Router.extend({ location: 'none' }); @@ -59,7 +60,7 @@ var boot = function(callback) { }; QUnit.test('Unbound dashed helpers registered on the container can be late-invoked', function() { - Ember.TEMPLATES.application = compile('
{{x-borf}} {{x-borf \'YES\'}}
'); + setTemplate('application', compile('
{{x-borf}} {{x-borf \'YES\'}}
')); let myHelper = helper(function(params) { return params[0] || 'BORF'; }); @@ -73,7 +74,7 @@ QUnit.test('Unbound dashed helpers registered on the container can be late-invok }); QUnit.test('Bound helpers registered on the container can be late-invoked', function() { - Ember.TEMPLATES.application = compile('
{{x-reverse}} {{x-reverse foo}}
'); + setTemplate('application', compile('
{{x-reverse}} {{x-reverse foo}}
')); boot(function() { appInstance.register('controller:application', Controller.extend({ @@ -90,7 +91,7 @@ QUnit.test('Bound helpers registered on the container can be late-invoked', func }); QUnit.test('Undashed helpers registered on the container can be invoked', function() { - Ember.TEMPLATES.application = compile('
{{omg}}|{{yorp \'boo\'}}|{{yorp \'ya\'}}
'); + setTemplate('application', compile('
{{omg}}|{{yorp \'boo\'}}|{{yorp \'ya\'}}
')); boot(function() { appInstance.register('helper:omg', helper(function() { @@ -110,11 +111,11 @@ if (!isEnabled('ember-glimmer')) { // needs glimmer Helper QUnit.test('Helpers can receive injections', function() { - Ember.TEMPLATES.application = compile('
{{full-name}}
'); + setTemplate('application', compile('
{{full-name}}
')); var serviceCalled = false; boot(function() { - appInstance.register('service:name-builder', Ember.Service.extend({ + appInstance.register('service:name-builder', Service.extend({ build() { serviceCalled = true; } diff --git a/packages/ember/tests/helpers/link_to_test.js b/packages/ember/tests/helpers/link_to_test.js index b56922bce35..9c752c9046f 100644 --- a/packages/ember/tests/helpers/link_to_test.js +++ b/packages/ember/tests/helpers/link_to_test.js @@ -1,4 +1,3 @@ -import Ember from 'ember-metal/core'; import Logger from 'ember-metal/logger'; import Controller from 'ember-runtime/controllers/controller'; import { set } from 'ember-metal/property_set'; @@ -15,9 +14,9 @@ import inject from 'ember-runtime/inject'; import { A as emberA } from 'ember-runtime/system/native_array'; import NoneLocation from 'ember-routing/location/none_location'; import { OWNER } from 'container/owner'; - import { compile } from 'ember-template-compiler'; import EmberView from 'ember-views/views/view'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var Router, App, AppView, router, appInstance; @@ -75,7 +74,7 @@ function sharedSetup() { function sharedTeardown() { run(function() { App.destroy(); }); - Ember.TEMPLATES = {}; + setTemplates({}); } if (!isEnabled('ember-glimmer')) { @@ -86,10 +85,10 @@ QUnit.module('The {{link-to}} helper', { run(function() { sharedSetup(); - Ember.TEMPLATES.app = compile('{{outlet}}'); - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\'}}About{{/link-to}}{{#link-to \'index\' id=\'self-link\'}}Self{{/link-to}}'); - Ember.TEMPLATES.about = compile('

About

{{#link-to \'index\' id=\'home-link\'}}Home{{/link-to}}{{#link-to \'about\' id=\'self-link\'}}Self{{/link-to}}'); - Ember.TEMPLATES.item = compile('

Item

{{model.name}}

{{#link-to \'index\' id=\'home-link\'}}Home{{/link-to}}'); + setTemplate('app', compile('{{outlet}}')); + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}`)); + setTemplate('about', compile(`

About

{{#link-to 'index' id='home-link'}}Home{{/link-to}}{{#link-to 'about' id='self-link'}}Self{{/link-to}}`)); + setTemplate('item', compile(`

Item

{{model.name}}

{{#link-to 'index' id='home-link'}}Home{{/link-to}}`)); AppView = EmberView.extend({ templateName: 'app' @@ -169,7 +168,7 @@ QUnit.test('The {{link-to}} helper moves into the named route', function() { }); QUnit.test('The {{link-to}} helper supports URL replacement', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\' replace=true}}About{{/link-to}}'); + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=true}}About{{/link-to}}`)); Router.map(function() { this.route('about'); @@ -193,7 +192,7 @@ QUnit.test('The {{link-to}} helper supports URL replacement', function() { }); QUnit.test('The {{link-to}} helper supports URL replacement via replace=boundTruthyThing', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\' replace=boundTruthyThing}}About{{/link-to}}'); + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=boundTruthyThing}}About{{/link-to}}`)); App.IndexController = Controller.extend({ boundTruthyThing: true @@ -221,7 +220,7 @@ QUnit.test('The {{link-to}} helper supports URL replacement via replace=boundTru }); QUnit.test('The {{link-to}} helper supports setting replace=boundFalseyThing', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\' replace=boundFalseyThing}}About{{/link-to}}'); + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=boundFalseyThing}}About{{/link-to}}`)); App.IndexController = Controller.extend({ boundFalseyThing: false @@ -248,8 +247,8 @@ QUnit.test('The {{link-to}} helper supports setting replace=boundFalseyThing', f equal(replaceCount, 0, 'replaceURL should not be called'); }); -QUnit.test('the {{link-to}} helper doesn\'t add an href when the tagName isn\'t \'a\'', function() { - Ember.TEMPLATES.index = compile('{{#link-to \'about\' id=\'about-link\' tagName=\'div\'}}About{{/link-to}}'); +QUnit.test("the {{link-to}} helper doesn't add an href when the tagName isn't 'a'", function() { + setTemplate('index', compile(`{{#link-to 'about' id='about-link' tagName='div'}}About{{/link-to}}`)); Router.map(function() { this.route('about'); @@ -265,11 +264,11 @@ QUnit.test('the {{link-to}} helper doesn\'t add an href when the tagName isn\'t }); -QUnit.test('the {{link-to}} applies a \'disabled\' class when disabled', function () { - Ember.TEMPLATES.index = compile(` +QUnit.test("the {{link-to}} applies a 'disabled' class when disabled", function () { + setTemplate('index', compile(` {{#link-to "about" id="about-link-static" disabledWhen="shouldDisable"}}About{{/link-to}} {{#link-to "about" id="about-link-dynamic" disabledWhen=dynamicDisabledWhen}}About{{/link-to}} - `); + `)); App.IndexController = Controller.extend({ shouldDisable: true, @@ -296,8 +295,8 @@ QUnit.test('the {{link-to}} applies a \'disabled\' class when disabled', functio equal(jQuery('#about-link-dynamic.disabled', '#qunit-fixture').length, 0, 'The dynamic link is re-enabled when its disabledWhen becomes false'); }); -QUnit.test('the {{link-to}} doesn\'t apply a \'disabled\' class if disabledWhen is not provided', function () { - Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link"}}About{{/link-to}}'); +QUnit.test("the {{link-to}} doesn't apply a 'disabled' class if disabledWhen is not provided", function () { + setTemplate('index', compile(`{{#link-to "about" id="about-link"}}About{{/link-to}}`)); Router.map(function() { this.route('about'); @@ -313,7 +312,7 @@ QUnit.test('the {{link-to}} doesn\'t apply a \'disabled\' class if disabledWhen }); QUnit.test('the {{link-to}} helper supports a custom disabledClass', function () { - Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass="do-not-want"}}About{{/link-to}}'); + setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass="do-not-want"}}About{{/link-to}}')); Router.map(function() { this.route('about'); @@ -329,7 +328,7 @@ QUnit.test('the {{link-to}} helper supports a custom disabledClass', function () }); QUnit.test('the {{link-to}} helper supports a custom disabledClass set via bound param', function () { - Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass=disabledClass}}About{{/link-to}}'); + setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass=disabledClass}}About{{/link-to}}')); Router.map(function() { this.route('about'); @@ -349,7 +348,7 @@ QUnit.test('the {{link-to}} helper supports a custom disabledClass set via bound }); QUnit.test('the {{link-to}} helper does not respond to clicks when disabled', function () { - Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=true}}About{{/link-to}}'); + setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true}}About{{/link-to}}')); Router.map(function() { this.route('about'); @@ -369,7 +368,7 @@ QUnit.test('the {{link-to}} helper does not respond to clicks when disabled', fu }); QUnit.test('the {{link-to}} helper responds to clicks according to its disabledWhen bound param', function () { - Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen=disabledWhen}}About{{/link-to}}'); + setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=disabledWhen}}About{{/link-to}}')); Router.map(function() { this.route('about'); @@ -402,7 +401,7 @@ QUnit.test('the {{link-to}} helper responds to clicks according to its disabledW }); QUnit.test('The {{link-to}} helper supports a custom activeClass', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\'}}About{{/link-to}}{{#link-to \'index\' id=\'self-link\' activeClass=\'zomg-active\'}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link' activeClass='zomg-active'}}Self{{/link-to}}")); Router.map(function() { this.route('about'); @@ -420,7 +419,7 @@ QUnit.test('The {{link-to}} helper supports a custom activeClass', function() { }); QUnit.test('The {{link-to}} helper supports a custom activeClass from a bound param', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\'}}About{{/link-to}}{{#link-to \'index\' id=\'self-link\' activeClass=activeClass}}Self{{/link-to}}'); + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link' activeClass=activeClass}}Self{{/link-to}}`)); Router.map(function() { this.route('about'); @@ -441,8 +440,8 @@ QUnit.test('The {{link-to}} helper supports a custom activeClass from a bound pa equal(jQuery('#about-link:not(.active)', '#qunit-fixture').length, 1, 'The other link was rendered without active class'); }); -QUnit.test('The {{link-to}} helper supports \'classNameBindings\' with custom values [GH #11699]', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'about\' id=\'about-link\' classNameBindings=\'foo:foo-is-true:foo-is-false\'}}About{{/link-to}}'); +QUnit.test("The {{link-to}} helper supports 'classNameBindings' with custom values [GH #11699]", function() { + setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' classNameBindings='foo:foo-is-true:foo-is-false'}}About{{/link-to}}`)); Router.map(function() { this.route('about'); @@ -475,9 +474,9 @@ QUnit.test('The {{link-to}} helper supports leaving off .index for nested routes }); }); - Ember.TEMPLATES.about = compile('

About

{{outlet}}'); - Ember.TEMPLATES['about/index'] = compile('
Index
'); - Ember.TEMPLATES['about/item'] = compile('
{{#link-to \'about\'}}About{{/link-to}}
'); + setTemplate('about', compile('

About

{{outlet}}')); + setTemplate('about/index', compile("
Index
")); + setTemplate('about/item', compile("
{{#link-to 'about'}}About{{/link-to}}
")); bootApplication(); @@ -497,8 +496,8 @@ QUnit.test('The {{link-to}} helper supports currentWhen (DEPRECATED)', function( this.route('item'); }); - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'item\' id=\'other-link\' currentWhen=\'index\'}}ITEM{{/link-to}}'); + setTemplate('index', compile('

Home

{{outlet}}')); + setTemplate('index/about', compile("{{#link-to 'item' id='other-link' currentWhen='index'}}ITEM{{/link-to}}")); bootApplication(); @@ -518,8 +517,8 @@ QUnit.test('The {{link-to}} helper supports custom, nested, current-when', funct this.route('item'); }); - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'item\' id=\'other-link\' current-when=\'index\'}}ITEM{{/link-to}}'); + setTemplate('index', compile('

Home

{{outlet}}')); + setTemplate('index/about', compile("{{#link-to 'item' id='other-link' current-when='index'}}ITEM{{/link-to}}")); bootApplication(); @@ -541,8 +540,8 @@ QUnit.test('The {{link-to}} helper does not disregard current-when when it is gi }); }); - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'items\' id=\'other-link\' current-when=\'index\'}}ITEM{{/link-to}}'); + setTemplate('index', compile('

Home

{{outlet}}')); + setTemplate('index/about', compile("{{#link-to 'items' id='other-link' current-when='index'}}ITEM{{/link-to}}")); bootApplication(); @@ -568,8 +567,8 @@ QUnit.test('The {{link-to}} helper does not disregard current-when when it is se currentWhen: 'index' }); - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'items\' id=\'other-link\' current-when=currentWhen}}ITEM{{/link-to}}'); + setTemplate('index', compile('

Home

{{outlet}}')); + setTemplate('index/about', compile("{{#link-to 'items' id='other-link' current-when=currentWhen}}ITEM{{/link-to}}")); bootApplication(); @@ -589,10 +588,10 @@ QUnit.test('The {{link-to}} helper supports multiple current-when routes', funct this.route('foo'); }); - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'item\' id=\'link1\' current-when=\'item index\'}}ITEM{{/link-to}}'); - Ember.TEMPLATES['item'] = compile('{{#link-to \'item\' id=\'link2\' current-when=\'item index\'}}ITEM{{/link-to}}'); - Ember.TEMPLATES['foo'] = compile('{{#link-to \'item\' id=\'link3\' current-when=\'item index\'}}ITEM{{/link-to}}'); + setTemplate('index', compile('

Home

{{outlet}}')); + setTemplate('index/about', compile("{{#link-to 'item' id='link1' current-when='item index'}}ITEM{{/link-to}}")); + setTemplate('item', compile("{{#link-to 'item' id='link2' current-when='item index'}}ITEM{{/link-to}}")); + setTemplate('foo', compile("{{#link-to 'item' id='link3' current-when='item index'}}ITEM{{/link-to}}")); bootApplication(); @@ -616,8 +615,8 @@ QUnit.test('The {{link-to}} helper supports multiple current-when routes', funct }); QUnit.test('The {{link-to}} helper defaults to bubbling', function() { - Ember.TEMPLATES.about = compile('
{{#link-to \'about.contact\' id=\'about-contact\'}}About{{/link-to}}
{{outlet}}'); - Ember.TEMPLATES['about/contact'] = compile('

Contact

'); + setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact'}}About{{/link-to}}
{{outlet}}")); + setTemplate('about/contact', compile("

Contact

")); Router.map(function() { this.route('about', function() { @@ -651,8 +650,8 @@ QUnit.test('The {{link-to}} helper defaults to bubbling', function() { }); QUnit.test('The {{link-to}} helper supports bubbles=false', function() { - Ember.TEMPLATES.about = compile('
{{#link-to \'about.contact\' id=\'about-contact\' bubbles=false}}About{{/link-to}}
{{outlet}}'); - Ember.TEMPLATES['about/contact'] = compile('

Contact

'); + setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact' bubbles=false}}About{{/link-to}}
{{outlet}}")); + setTemplate('about/contact', compile("

Contact

")); Router.map(function() { this.route('about', function() { @@ -682,12 +681,12 @@ QUnit.test('The {{link-to}} helper supports bubbles=false', function() { equal(jQuery('#contact', '#qunit-fixture').text(), 'Contact', 'precond - the link worked'); - equal(hidden, 0, 'The link didn\'t bubble'); + equal(hidden, 0, "The link didn't bubble"); }); QUnit.test('The {{link-to}} helper supports bubbles=boundFalseyThing', function() { - Ember.TEMPLATES.about = compile('
{{#link-to \'about.contact\' id=\'about-contact\' bubbles=boundFalseyThing}}About{{/link-to}}
{{outlet}}'); - Ember.TEMPLATES['about/contact'] = compile('

Contact

'); + setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact' bubbles=boundFalseyThing}}About{{/link-to}}
{{outlet}}")); + setTemplate('about/contact', compile("

Contact

")); App.AboutController = Controller.extend({ boundFalseyThing: false @@ -721,7 +720,7 @@ QUnit.test('The {{link-to}} helper supports bubbles=boundFalseyThing', function( equal(jQuery('#contact', '#qunit-fixture').text(), 'Contact', 'precond - the link worked'); - equal(hidden, 0, 'The link didn\'t bubble'); + equal(hidden, 0, "The link didn't bubble"); }); QUnit.test('The {{link-to}} helper moves into the named route with context', function() { @@ -730,7 +729,7 @@ QUnit.test('The {{link-to}} helper moves into the named route with context', fun this.route('item', { path: '/item/:id' }); }); - Ember.TEMPLATES.about = compile('

List

{{#link-to \'index\' id=\'home-link\'}}Home{{/link-to}}'); + setTemplate('about', compile("

List

{{#link-to 'index' id='home-link'}}Home{{/link-to}}")); App.AboutRoute = Route.extend({ model() { @@ -774,7 +773,7 @@ QUnit.test('The {{link-to}} helper moves into the named route with context', fun }); QUnit.test('The {{link-to}} helper binds some anchor html tag common attributes', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'index\' id=\'self-link\' title=\'title-attr\' rel=\'rel-attr\' tabindex=\'-1\'}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' title='title-attr' rel='rel-attr' tabindex='-1'}}Self{{/link-to}}")); bootApplication(); run(function() { @@ -788,7 +787,7 @@ QUnit.test('The {{link-to}} helper binds some anchor html tag common attributes' }); QUnit.test('The {{link-to}} helper supports `target` attribute', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'index\' id=\'self-link\' target=\'_blank\'}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}")); bootApplication(); run(function() { @@ -800,7 +799,7 @@ QUnit.test('The {{link-to}} helper supports `target` attribute', function() { }); QUnit.test('The {{link-to}} helper supports `target` attribute specified as a bound param', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'index\' id=\'self-link\' target=boundLinkTarget}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target=boundLinkTarget}}Self{{/link-to}}")); App.IndexController = Controller.extend({ boundLinkTarget: '_blank' @@ -817,7 +816,7 @@ QUnit.test('The {{link-to}} helper supports `target` attribute specified as a bo }); QUnit.test('The {{link-to}} helper does not call preventDefault if `target` attribute is provided', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'index\' id=\'self-link\' target=\'_blank\'}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}")); bootApplication(); run(function() { @@ -831,7 +830,7 @@ QUnit.test('The {{link-to}} helper does not call preventDefault if `target` attr }); QUnit.test('The {{link-to}} helper should preventDefault when `target = _self`', function() { - Ember.TEMPLATES.index = compile('

Home

{{#link-to \'index\' id=\'self-link\' target=\'_self\'}}Self{{/link-to}}'); + setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_self'}}Self{{/link-to}}")); bootApplication(); run(function() { @@ -845,7 +844,7 @@ QUnit.test('The {{link-to}} helper should preventDefault when `target = _self`', }); QUnit.test('The {{link-to}} helper should not transition if target is not equal to _self or empty', function() { - Ember.TEMPLATES.index = compile('{{#link-to \'about\' id=\'about-link\' replace=true target=\'_blank\'}}About{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'about' id='about-link' replace=true target='_blank'}}About{{/link-to}}")); Router.map(function() { this.route('about'); @@ -876,9 +875,9 @@ QUnit.test('The {{link-to}} helper accepts string/numeric arguments', function() repo: EmberObject.create({ owner: 'ember', name: 'ember.js' }), post_id: 123 }); - Ember.TEMPLATES.filter = compile('

{{filter}}

{{#link-to "filter" "unpopular" id="link"}}Unpopular{{/link-to}}{{#link-to "filter" filter id="path-link"}}Unpopular{{/link-to}}{{#link-to "post" post_id id="post-path-link"}}Post{{/link-to}}{{#link-to "post" 123 id="post-number-link"}}Post{{/link-to}}{{#link-to "repo" repo id="repo-object-link"}}Repo{{/link-to}}'); + setTemplate('filter', compile('

{{filter}}

{{#link-to "filter" "unpopular" id="link"}}Unpopular{{/link-to}}{{#link-to "filter" filter id="path-link"}}Unpopular{{/link-to}}{{#link-to "post" post_id id="post-path-link"}}Post{{/link-to}}{{#link-to "post" 123 id="post-number-link"}}Post{{/link-to}}{{#link-to "repo" repo id="repo-object-link"}}Repo{{/link-to}}')); - Ember.TEMPLATES.index = compile(' '); + setTemplate('index', compile(' ')); bootApplication(); @@ -891,7 +890,7 @@ QUnit.test('The {{link-to}} helper accepts string/numeric arguments', function() equal(normalizeUrl(jQuery('#repo-object-link', '#qunit-fixture').attr('href')), '/repo/ember/ember.js'); }); -QUnit.test('Issue 4201 - Shorthand for route.index shouldn\'t throw errors about context arguments', function() { +QUnit.test("Issue 4201 - Shorthand for route.index shouldn't throw errors about context arguments", function() { expect(2); Router.map(function() { this.route('lobby', function() { @@ -907,9 +906,9 @@ QUnit.test('Issue 4201 - Shorthand for route.index shouldn\'t throw errors about } }); - Ember.TEMPLATES['lobby/index'] = compile('{{#link-to \'lobby\' \'foobar\' id=\'lobby-link\'}}Lobby{{/link-to}}'); - Ember.TEMPLATES.index = compile(''); - Ember.TEMPLATES['lobby/list'] = compile('{{#link-to \'lobby\' \'foobar\' id=\'lobby-link\'}}Lobby{{/link-to}}'); + setTemplate('lobby/index', compile("{{#link-to 'lobby' 'foobar' id='lobby-link'}}Lobby{{/link-to}}")); + setTemplate('index', compile('')); + setTemplate('lobby/list', compile("{{#link-to 'lobby' 'foobar' id='lobby-link'}}Lobby{{/link-to}}")); bootApplication(); run(router, 'handleURL', '/lobby/list'); run(jQuery('#lobby-link'), 'click'); @@ -956,8 +955,8 @@ QUnit.test('The {{link-to}} helper unwraps controllers', function() { } }); - Ember.TEMPLATES.filter = compile('

{{model.filter}}

'); - Ember.TEMPLATES.index = compile('{{#link-to "filter" this id="link"}}Filter{{/link-to}}'); + setTemplate('filter', compile('

{{model.filter}}

')); + setTemplate('index', compile('{{#link-to "filter" this id="link"}}Filter{{/link-to}}')); expectDeprecation(function() { bootApplication(); @@ -968,14 +967,14 @@ QUnit.test('The {{link-to}} helper unwraps controllers', function() { jQuery('#link', '#qunit-fixture').trigger('click'); }); -QUnit.test('The {{link-to}} helper doesn\'t change view context', function() { +QUnit.test("The {{link-to}} helper doesn't change view context", function() { App.IndexView = EmberView.extend({ elementId: 'index', name: 'test', isTrue: true }); - Ember.TEMPLATES.index = compile('{{view.name}}-{{#link-to \'index\' id=\'self-link\'}}Link: {{view.name}}-{{#if view.isTrue}}{{view.name}}{{/if}}{{/link-to}}'); + setTemplate('index', compile("{{view.name}}-{{#link-to 'index' id='self-link'}}Link: {{view.name}}-{{#if view.isTrue}}{{view.name}}{{/if}}{{/link-to}}")); bootApplication(); @@ -987,7 +986,7 @@ QUnit.test('The {{link-to}} helper doesn\'t change view context', function() { }); QUnit.test('Quoteless route param performs property lookup', function() { - Ember.TEMPLATES.index = compile('{{#link-to \'index\' id=\'string-link\'}}string{{/link-to}}{{#link-to foo id=\'path-link\'}}path{{/link-to}}{{#link-to view.foo id=\'view-link\'}}{{view.foo}}{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' id='string-link'}}string{{/link-to}}{{#link-to foo id='path-link'}}path{{/link-to}}{{#link-to view.foo id='view-link'}}{{view.foo}}{{/link-to}}")); function assertEquality(href) { equal(normalizeUrl(jQuery('#string-link', '#qunit-fixture').attr('href')), '/'); @@ -1030,7 +1029,7 @@ QUnit.test('link-to with null/undefined dynamic parameters are put in a loading var oldWarn = Logger.warn; var warnCalled = false; Logger.warn = function() { warnCalled = true; }; - Ember.TEMPLATES.index = compile('{{#link-to destinationRoute routeContext loadingClass=\'i-am-loading\' id=\'context-link\'}}string{{/link-to}}{{#link-to secondRoute loadingClass=loadingClass id=\'static-link\'}}string{{/link-to}}'); + setTemplate('index', compile("{{#link-to destinationRoute routeContext loadingClass='i-am-loading' id='context-link'}}string{{/link-to}}{{#link-to secondRoute loadingClass=loadingClass id='static-link'}}string{{/link-to}}")); var thing = EmberObject.create({ id: 123 }); @@ -1060,7 +1059,7 @@ QUnit.test('link-to with null/undefined dynamic parameters are put in a loading equal(normalizeUrl($link.attr('href')), url, 'loaded link-to has expected href'); ok(!$link.hasClass('i-am-loading'), 'loaded linkComponent has no loadingClass'); } else { - equal(normalizeUrl($link.attr('href')), '#', 'unloaded link-to has href=\'#\''); + equal(normalizeUrl($link.attr('href')), '#', "unloaded link-to has href='#'"); ok($link.hasClass('i-am-loading'), 'loading linkComponent has loadingClass'); } } @@ -1121,7 +1120,7 @@ QUnit.test('The {{link-to}} helper refreshes href element when one of params cha var post = EmberObject.create({ id: '1' }); var secondPost = EmberObject.create({ id: '2' }); - Ember.TEMPLATES.index = compile('{{#link-to "post" post id="post"}}post{{/link-to}}'); + setTemplate('index', compile('{{#link-to "post" post id="post"}}post{{/link-to}}')); App.IndexController = Controller.extend(); var indexController = appInstance.lookup('controller:index'); @@ -1151,9 +1150,9 @@ QUnit.test('The {{link-to}} helper is active when a route is active', function() }); }); - Ember.TEMPLATES.about = compile('
{{#link-to \'about\' id=\'about-link\'}}About{{/link-to}} {{#link-to \'about.item\' id=\'item-link\'}}Item{{/link-to}} {{outlet}}
'); - Ember.TEMPLATES['about/item'] = compile(' '); - Ember.TEMPLATES['about/index'] = compile(' '); + setTemplate('about', compile("
{{#link-to 'about' id='about-link'}}About{{/link-to}} {{#link-to 'about.item' id='item-link'}}Item{{/link-to}} {{outlet}}
")); + setTemplate('about/item', compile(' ')); + setTemplate('about/index', compile(' ')); bootApplication(); @@ -1168,7 +1167,7 @@ QUnit.test('The {{link-to}} helper is active when a route is active', function() equal(jQuery('#item-link.active', '#qunit-fixture').length, 1, 'The item route link is active'); }); -QUnit.test('The {{link-to}} helper works in an #each\'d array of string route names', function() { +QUnit.test("The {{link-to}} helper works in an #each'd array of string route names", function() { Router.map(function() { this.route('foo'); this.route('bar'); @@ -1181,9 +1180,7 @@ QUnit.test('The {{link-to}} helper works in an #each\'d array of string route na route2: 'foo' }); - Ember.TEMPLATES = { - index: compile('{{#each routeNames as |routeName|}}{{#link-to routeName}}{{routeName}}{{/link-to}}{{/each}}{{#each routeNames as |r|}}{{#link-to r}}{{r}}{{/link-to}}{{/each}}{{#link-to route1}}a{{/link-to}}{{#link-to route2}}b{{/link-to}}') - }; + setTemplate('index', compile('{{#each routeNames as |routeName|}}{{#link-to routeName}}{{routeName}}{{/link-to}}{{/each}}{{#each routeNames as |r|}}{{#link-to r}}{{r}}{{/link-to}}{{/each}}{{#link-to route1}}a{{/link-to}}{{#link-to route2}}b{{/link-to}}')); bootApplication(); @@ -1194,7 +1191,7 @@ QUnit.test('The {{link-to}} helper works in an #each\'d array of string route na for (idx = 0; idx < $links.length; idx++) { var href = jQuery($links[idx]).attr('href'); // Old IE includes the whole hostname as well - equal(href.slice(-expected[idx].length), expected[idx], 'Expected link to be \'' + expected[idx] + '\', but was \'' + href + '\''); + equal(href.slice(-expected[idx].length), expected[idx], `Expected link to be '${expected[idx]}', but was '${href}'`); } } @@ -1216,8 +1213,8 @@ QUnit.test('The non-block form {{link-to}} helper moves into the named route', f this.route('contact'); }); - Ember.TEMPLATES.index = compile('

Home

{{link-to \'Contact us\' \'contact\' id=\'contact-link\'}}{{#link-to \'index\' id=\'self-link\'}}Self{{/link-to}}'); - Ember.TEMPLATES.contact = compile('

Contact

{{link-to \'Home\' \'index\' id=\'home-link\'}}{{link-to \'Self\' \'contact\' id=\'self-link\'}}'); + setTemplate('index', compile("

Home

{{link-to 'Contact us' 'contact' id='contact-link'}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}")); + setTemplate('contact', compile("

Contact

{{link-to 'Home' 'index' id='home-link'}}{{link-to 'Self' 'contact' id='self-link'}}")); bootApplication(); @@ -1240,8 +1237,8 @@ QUnit.test('The non-block form {{link-to}} helper updates the link text when it contactName: 'Jane' }); - Ember.TEMPLATES.index = compile('

Home

{{link-to contactName \'contact\' id=\'contact-link\'}}{{#link-to \'index\' id=\'self-link\'}}Self{{/link-to}}'); - Ember.TEMPLATES.contact = compile('

Contact

{{link-to \'Home\' \'index\' id=\'home-link\'}}{{link-to \'Self\' \'contact\' id=\'self-link\'}}'); + setTemplate('index', compile("

Home

{{link-to contactName 'contact' id='contact-link'}}{{#link-to 'index' id='self-link'}}Self{{/link-to}}")); + setTemplate('contact', compile("

Contact

{{link-to 'Home' 'index' id='home-link'}}{{link-to 'Self' 'contact' id='self-link'}}")); bootApplication(); @@ -1295,8 +1292,8 @@ QUnit.test('The non-block form {{link-to}} helper moves into the named route wit } }); - Ember.TEMPLATES.index = compile('

Home

'); - Ember.TEMPLATES.item = compile('

Item

{{model.name}}

{{#link-to \'index\' id=\'home-link\'}}Home{{/link-to}}'); + setTemplate('index', compile("

Home

")); + setTemplate('item', compile("

Item

{{model.name}}

{{#link-to 'index' id='home-link'}}Home{{/link-to}}")); bootApplication(); @@ -1315,7 +1312,7 @@ QUnit.test('The non-block form {{link-to}} helper moves into the named route wit }); QUnit.test('The non-block form {{link-to}} performs property lookup', function() { - Ember.TEMPLATES.index = compile('{{link-to \'string\' \'index\' id=\'string-link\'}}{{link-to path foo id=\'path-link\'}}{{link-to view.foo view.foo id=\'view-link\'}}'); + setTemplate('index', compile("{{link-to 'string' 'index' id='string-link'}}{{link-to path foo id='path-link'}}{{link-to view.foo view.foo id='view-link'}}")); function assertEquality(href) { equal(normalizeUrl(jQuery('#string-link', '#qunit-fixture').attr('href')), '/'); @@ -1353,7 +1350,7 @@ QUnit.test('The non-block form {{link-to}} performs property lookup', function() }); QUnit.test('The non-block form {{link-to}} protects against XSS', function() { - Ember.TEMPLATES.application = compile('{{link-to display \'index\' id=\'link\'}}'); + setTemplate('application', compile("{{link-to display 'index' id='link'}}")); App.ApplicationController = Controller.extend({ display: 'blahzorz' @@ -1390,7 +1387,7 @@ QUnit.test('the {{link-to}} helper calls preventDefault', function() { }); QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefault=false` is passed as an option', function() { - Ember.TEMPLATES.index = compile('{{#link-to \'about\' id=\'about-link\' preventDefault=false}}About{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'about' id='about-link' preventDefault=false}}About{{/link-to}}")); Router.map(function() { this.route('about'); @@ -1407,7 +1404,7 @@ QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefau }); QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefault=boundFalseyThing` is passed as an option', function() { - Ember.TEMPLATES.index = compile('{{#link-to \'about\' id=\'about-link\' preventDefault=boundFalseyThing}}About{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'about' id='about-link' preventDefault=boundFalseyThing}}About{{/link-to}}")); App.IndexController = Controller.extend({ boundFalseyThing: false @@ -1430,7 +1427,7 @@ QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefau QUnit.test('the {{link-to}} helper does not throw an error if its route has exited', function() { expect(0); - Ember.TEMPLATES.application = compile('{{#link-to \'index\' id=\'home-link\'}}Home{{/link-to}}{{#link-to \'post\' defaultPost id=\'default-post-link\'}}Default Post{{/link-to}}{{#if currentPost}}{{#link-to \'post\' id=\'post-link\'}}Post{{/link-to}}{{/if}}'); + setTemplate('application', compile("{{#link-to 'index' id='home-link'}}Home{{/link-to}}{{#link-to 'post' defaultPost id='default-post-link'}}Default Post{{/link-to}}{{#if currentPost}}{{#link-to 'post' id='post-link'}}Post{{/link-to}}{{/if}}")); App.ApplicationController = Controller.extend({ postController: inject.controller('post'), @@ -1459,9 +1456,9 @@ QUnit.test('the {{link-to}} helper does not throw an error if its route has exit }); QUnit.test('{{link-to}} active property respects changing parent route context', function() { - Ember.TEMPLATES.application = compile( - '{{link-to \'OMG\' \'things\' \'omg\' id=\'omg-link\'}} ' + - '{{link-to \'LOL\' \'things\' \'lol\' id=\'lol-link\'}} '); + setTemplate('application', compile( + "{{link-to 'OMG' 'things' 'omg' id='omg-link'}} " + + "{{link-to 'LOL' 'things' 'lol' id='lol-link'}} ")); Router.map(function() { @@ -1498,7 +1495,7 @@ QUnit.test('{{link-to}} populates href with default query param values even with }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' id='the-link'}}Index{{/link-to}}")); bootApplication(); equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); @@ -1519,7 +1516,7 @@ QUnit.test('{{link-to}} populates href with default query param values with empt }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' (query-params) id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' (query-params) id='the-link'}}Index{{/link-to}}")); bootApplication(); equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); @@ -1540,7 +1537,7 @@ QUnit.test('{{link-to}} populates href with supplied query param values', functi }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' (query-params foo=\'456\') id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); equal(jQuery('#the-link').attr('href'), '/?foo=456', 'link has right href'); }); @@ -1565,7 +1562,7 @@ QUnit.test('{{link-to}} populates href with partially supplied query param value }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' (query-params foo=\'456\') id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); equal(jQuery('#the-link').attr('href'), '/?foo=456', 'link has right href'); }); @@ -1586,7 +1583,7 @@ QUnit.test('{{link-to}} populates href with partially supplied query param value }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' (query-params foo=\'123\') id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile("{{#link-to 'index' (query-params foo='123') id='the-link'}}Index{{/link-to}}")); bootApplication(); equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); @@ -1611,7 +1608,7 @@ QUnit.test('{{link-to}} populates href with fully supplied query param values', }); } - Ember.TEMPLATES.index = compile('{{#link-to \'index\' (query-params foo=\'456\' bar=\'NAW\') id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('index', compile(`{{#link-to 'index' (query-params foo='456' bar='NAW') id='the-link'}}Index{{/link-to}}`)); bootApplication(); equal(jQuery('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href'); }); @@ -1640,7 +1637,7 @@ QUnit.test('{{link-to}} with only query-params and a block updates when route ch }); } - Ember.TEMPLATES.application = compile('{{#link-to (query-params foo=\'456\' bar=\'NAW\') id=\'the-link\'}}Index{{/link-to}}'); + setTemplate('application', compile(`{{#link-to (query-params foo='456' bar='NAW') id='the-link'}}Index{{/link-to}}`)); bootApplication(); equal(jQuery('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href'); @@ -1674,7 +1671,7 @@ QUnit.test('Block-less {{link-to}} with only query-params updates when route cha }); } - Ember.TEMPLATES.application = compile('{{link-to "Index" (query-params foo=\'456\' bar=\'NAW\') id=\'the-link\'}}'); + setTemplate('application', compile(`{{link-to "Index" (query-params foo='456' bar='NAW') id='the-link'}}`)); bootApplication(); equal(jQuery('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href'); @@ -1705,11 +1702,11 @@ QUnit.test('The {{link-to}} helper can use dynamic params', function() { } }); - Ember.TEMPLATES.index = compile(` + setTemplate('index', compile(`

Home

{{#link-to params=dynamicLinkParams id="dynamic-link"}}Dynamic{{/link-to}} - `); + `)); bootApplication(); @@ -1748,9 +1745,9 @@ QUnit.test('GJ: {{link-to}} to a parent root model hook which performs a `transi } }); - Ember.TEMPLATES.application = compile(` + setTemplate('application', compile(` {{link-to 'Parent' 'parent' id='parent-link'}} - `); + `)); bootApplication(); diff --git a/packages/ember/tests/view_instrumentation_test.js b/packages/ember/tests/view_instrumentation_test.js index 48d3b96f749..2ebd936cd2a 100644 --- a/packages/ember/tests/view_instrumentation_test.js +++ b/packages/ember/tests/view_instrumentation_test.js @@ -1,17 +1,17 @@ -import Ember from 'ember-metal/core'; import run from 'ember-metal/run_loop'; import $ from 'ember-views/system/jquery'; import Application from 'ember-application/system/application'; import { subscribe, unsubscribe } from 'ember-metal/instrumentation'; import { compile } from 'ember-template-compiler'; +import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var App, $fixture; function setupExample() { // setup templates - Ember.TEMPLATES.application = compile('{{outlet}}'); - Ember.TEMPLATES.index = compile('

Node 1

'); - Ember.TEMPLATES.posts = compile('

Node 1

'); + setTemplate('application', compile('{{outlet}}')); + setTemplate('index', compile('

Node 1

')); + setTemplate('posts', compile('

Node 1

')); App.Router.map(function() { this.route('posts'); @@ -51,7 +51,7 @@ QUnit.module('View Instrumentation', { } run(App, 'destroy'); App = null; - Ember.TEMPLATES = {}; + setTemplates({}); } });