diff --git a/packages/ember-glimmer/tests/integration/application/rendering-test.js b/packages/ember-glimmer/tests/integration/application/rendering-test.js index f7faeb6978d..478dc8bdf77 100644 --- a/packages/ember-glimmer/tests/integration/application/rendering-test.js +++ b/packages/ember-glimmer/tests/integration/application/rendering-test.js @@ -407,7 +407,7 @@ moduleFor('Application test: rendering', class extends ApplicationTest { template: 'Hi {{person.name}} from component' }); - let expectedBacktrackingMessage = /modified "model\.name" twice on \[object Object\] in a single render\. It was rendered in "template:routeWithError" and modified in "component:x-foo"/; + let expectedBacktrackingMessage = /modified "model\.name" twice on \[object Object\] in a single render\. It was rendered in "template:my-app\/templates\/routeWithError.hbs" and modified in "component:x-foo"/; return this.visit('/').then(() => { expectAssertion(() => { diff --git a/packages/ember-glimmer/tests/integration/components/local-lookup-test.js b/packages/ember-glimmer/tests/integration/components/local-lookup-test.js index e04e88f05fc..47e5f859f2a 100644 --- a/packages/ember-glimmer/tests/integration/components/local-lookup-test.js +++ b/packages/ember-glimmer/tests/integration/components/local-lookup-test.js @@ -202,14 +202,20 @@ function buildResolver() { let [sourceType, sourceName ] = sourceFullName.split(':'); let [type, name ] = fullName.split(':'); - if (type !== 'template' && sourceType === 'template' && sourceName.slice(0, 11) === 'components/') { - sourceName = sourceName.slice(11); + sourceName = sourceName.replace('my-app/', ''); + + if (sourceType === 'template' && sourceName.slice(0, 21) === 'templates/components/') { + sourceName = sourceName.slice(21); } - if (type === 'template' && sourceType === 'template' && name.slice(0, 11) === 'components/') { + name = name.replace('my-app/', ''); + + if (type === 'template' && name.slice(0, 11) === 'components/') { name = name.slice(11); + sourceName = `components/${sourceName}`; } + sourceName = sourceName.replace('.hbs', ''); let result = `${type}:${sourceName}/${name}`; @@ -229,13 +235,15 @@ moduleFor('Components test: local lookup with expandLocalLookup feature', class if (EMBER_MODULE_UNIFICATION) { class LocalLookupTestResolver extends ModuleBasedTestResolver { resolve(specifier, referrer) { + let [type, name ] = specifier.split(':'); let fullSpecifier = specifier; if (referrer) { - let namespace = referrer.split('template:components/')[1]; + let namespace = referrer.split('components/')[1] || ''; + namespace = namespace.replace('.hbs', ''); if (specifier.indexOf('template:components/') !== -1) { - let name = specifier.split('template:components/')[1]; - fullSpecifier = `template:components/${namespace}/${name}`; + name = name.replace('components/', ''); + fullSpecifier = `${type}:components/${namespace}/${name}`; } else if (specifier.indexOf(':') !== -1) { let [type, name] = specifier.split(':'); fullSpecifier = `${type}:${namespace}/${name}`; @@ -272,7 +280,7 @@ if (EMBER_MODULE_UNIFICATION) { if (typeof template === 'string') { resolver.add(`template:components/${name}`, this.compile(template, { - moduleName: `components/${name}` + moduleName: `my-name/templates/components/${name}.hbs` })); } } @@ -281,7 +289,7 @@ if (EMBER_MODULE_UNIFICATION) { let { resolver } = this; if (typeof template === 'string') { resolver.add(`template:${name}`, this.compile(template, { - moduleName: name + moduleName: `my-name/templates/${name}.hbs` })); } else { throw new Error(`Registered template "${name}" must be a string`); diff --git a/packages/ember-glimmer/tests/integration/mount-test.js b/packages/ember-glimmer/tests/integration/mount-test.js index 027173ec05c..768b2ab0a86 100644 --- a/packages/ember-glimmer/tests/integration/mount-test.js +++ b/packages/ember-glimmer/tests/integration/mount-test.js @@ -64,7 +64,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest { } ['@test it boots an engine, instantiates its application controller, and renders its application template'](assert) { - this.engineRegistrations['template:application'] = compile('

Chat here, {{username}}

', { moduleName: 'application' }); + this.engineRegistrations['template:application'] = compile('

Chat here, {{username}}

', { moduleName: 'my-app/templates/application.hbs' }); let controller; @@ -103,12 +103,12 @@ moduleFor('{{mount}} test', class extends ApplicationTest { this.addTemplate('index', ''); this.addTemplate('route-with-mount', '{{mount "chat"}}'); - this.engineRegistrations['template:application'] = compile('hi {{person.name}} [{{component-with-backtracking-set person=person}}]', { moduleName: 'application' }); + this.engineRegistrations['template:application'] = compile('hi {{person.name}} [{{component-with-backtracking-set person=person}}]', { moduleName: 'my-app/templates/application.hbs' }); this.engineRegistrations['controller:application'] = Controller.extend({ person: { name: 'Alex' } }); - this.engineRegistrations['template:components/component-with-backtracking-set'] = compile('[component {{person.name}}]', { moduleName: 'components/component-with-backtracking-set' }); + this.engineRegistrations['template:components/component-with-backtracking-set'] = compile('[component {{person.name}}]', { moduleName: 'my-app/templates/components/component-with-backtracking-set.hbs' }); this.engineRegistrations['component:component-with-backtracking-set'] = Component.extend({ init() { this._super(...arguments); @@ -116,7 +116,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest { } }); - let expectedBacktrackingMessage = /modified "person\.name" twice on \[object Object\] in a single render\. It was rendered in "template:route-with-mount" \(in "engine:chat"\) and modified in "component:component-with-backtracking-set" \(in "engine:chat"\)/; + let expectedBacktrackingMessage = /modified "person\.name" twice on \[object Object\] in a single render\. It was rendered in "template:my-app\/templates\/route-with-mount.hbs" \(in "engine:chat"\) and modified in "component:component-with-backtracking-set" \(in "engine:chat"\)/; return this.visit('/').then(() => { expectAssertion(() => { @@ -143,14 +143,14 @@ moduleFor('{{mount}} test', class extends ApplicationTest { router: null, init() { this._super(...arguments); - this.register('template:application', compile('

Foo Engine

', { moduleName: 'application' })); + this.register('template:application', compile('

Foo Engine

', { moduleName: 'my-app/templates/application.hbs' })); } })); this.add('engine:bar', Engine.extend({ router: null, init() { this._super(...arguments); - this.register('template:application', compile('

Bar Engine

', { moduleName: 'application' })); + this.register('template:application', compile('

Bar Engine

', { moduleName: 'my-app/templates/application.hbs' })); } })); @@ -203,7 +203,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest { router: null, init() { this._super(...arguments); - this.register('template:application', compile('

Foo Engine: {{tagless-component}}

', { moduleName: 'application' })); + this.register('template:application', compile('

Foo Engine: {{tagless-component}}

', { moduleName: 'my-app/templates/application.hbs' })); this.register('component:tagless-component', Component.extend({ tagName: "", init() { @@ -211,7 +211,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest { component = this; } })); - this.register('template:components/tagless-component', compile('Tagless Component', { moduleName: 'components/tagless-component' })); + this.register('template:components/tagless-component', compile('Tagless Component', { moduleName: 'my-app/templates/components/tagless-component.hbs' })); } })); @@ -236,7 +236,7 @@ if (EMBER_ENGINES_MOUNT_PARAMS) { router: null, init() { this._super(...arguments); - this.register('template:application', compile('

Param Engine: {{model.foo}}

', { moduleName: 'application' })); + this.register('template:application', compile('

Param Engine: {{model.foo}}

', { moduleName: 'my-app/templates/application.hbs' })); } })); } @@ -311,7 +311,7 @@ if (EMBER_ENGINES_MOUNT_PARAMS) { router: null, init() { this._super(...arguments); - this.register('template:application', compile('{{model.foo}}', { moduleName: 'application' })); + this.register('template:application', compile('{{model.foo}}', { moduleName: 'my-app/templates/application.hbs' })); } })); this.addTemplate('engine-params-contextual-component', '{{mount "componentParamEngine" model=(hash foo=(component "foo-component"))}}'); diff --git a/packages/ember-glimmer/tests/unit/template-factory-test.js b/packages/ember-glimmer/tests/unit/template-factory-test.js index 8320c085fa3..c56ab0f9c43 100644 --- a/packages/ember-glimmer/tests/unit/template-factory-test.js +++ b/packages/ember-glimmer/tests/unit/template-factory-test.js @@ -9,7 +9,7 @@ moduleFor('Template factory test', class extends RenderingTest { let { runtimeResolver } = this; let templateStr = 'Hello {{name}}'; - let options = { moduleName: 'some-module' }; + let options = { moduleName: 'my-app/templates/some-module.hbs' }; let spec = precompile(templateStr, options); let body = `exports.default = template(${spec});`; diff --git a/packages/ember/tests/integration/multiple-app-test.js b/packages/ember/tests/integration/multiple-app-test.js index 30dab2f5beb..a1139929833 100644 --- a/packages/ember/tests/integration/multiple-app-test.js +++ b/packages/ember/tests/integration/multiple-app-test.js @@ -61,7 +61,7 @@ moduleFor('View Integration', class extends ApplicationTestCase { this.compile(`

Node 1

{{special-button}} `, { - moduleName: 'index' + moduleName: 'my-app/templates/index.hbs' }) ); resolver.add( @@ -69,7 +69,7 @@ moduleFor('View Integration', class extends ApplicationTestCase { this.compile(` `, { - moduleName: 'components/special-button' + moduleName: 'my-app/templates/components/special-button.hbs' }) ); } diff --git a/packages/internal-test-helpers/lib/test-cases/abstract-rendering.js b/packages/internal-test-helpers/lib/test-cases/abstract-rendering.js index 26390a55b50..dba6aeaeb85 100644 --- a/packages/internal-test-helpers/lib/test-cases/abstract-rendering.js +++ b/packages/internal-test-helpers/lib/test-cases/abstract-rendering.js @@ -98,8 +98,7 @@ export default class AbstractRenderingTestCase extends AbstractTestCase { registerPartial(name, template) { let owner = this.env.owner || this.owner; if (typeof template === 'string') { - let moduleName = `template:${name}`; - owner.register(moduleName, this.compile(template, { moduleName })); + owner.register(`template:${name}`, this.compile(template, { moduleName: `my-app/templates/-${name}.hbs` })); } } @@ -112,7 +111,7 @@ export default class AbstractRenderingTestCase extends AbstractTestCase { if (typeof template === 'string') { owner.register(`template:components/${name}`, this.compile(template, { - moduleName: `components/${name}` + moduleName: `my-app/templates/components/${name}.hbs` })); } } @@ -121,7 +120,7 @@ export default class AbstractRenderingTestCase extends AbstractTestCase { let { owner } = this; if (typeof template === 'string') { owner.register(`template:${name}`, this.compile(template, { - moduleName: name + moduleName: `my-app/templates/${name}.hbs` })); } else { throw new Error(`Registered template "${name}" must be a string`); diff --git a/packages/internal-test-helpers/lib/test-cases/test-resolver-application.js b/packages/internal-test-helpers/lib/test-cases/test-resolver-application.js index 831cac2f091..af5ebcd2140 100644 --- a/packages/internal-test-helpers/lib/test-cases/test-resolver-application.js +++ b/packages/internal-test-helpers/lib/test-cases/test-resolver-application.js @@ -17,7 +17,7 @@ export default class TestResolverApplicationTestCase extends AbstractApplication addTemplate(templateName, templateString) { this.resolver.add(`template:${templateName}`, this.compile(templateString, { - moduleName: templateName + moduleName: `my-app/templates/${templateName}.hbs` })); } @@ -28,7 +28,7 @@ export default class TestResolverApplicationTestCase extends AbstractApplication if (typeof template === 'string') { this.resolver.add(`template:components/${name}`, this.compile(template, { - moduleName: `components/${name}` + moduleName: `my-app/templates/components/${name}.hbs` })); } } diff --git a/packages/internal-test-helpers/lib/test-resolver.js b/packages/internal-test-helpers/lib/test-resolver.js index 2f6dc3d6c6c..f3b5bb31a69 100644 --- a/packages/internal-test-helpers/lib/test-resolver.js +++ b/packages/internal-test-helpers/lib/test-resolver.js @@ -38,7 +38,7 @@ class Resolver { throw new Error(`You called addTemplate for "${templateName}" with a template argument of type of '${templateType}'. addTemplate expects an argument of an uncompiled template as a string.`); } return this._registered[serializeKey(`template:${templateName}`)] = compile(template, { - moduleName: templateName + moduleName: `my-app/templates/${templateName}.hbs` }); } static create() {