@@ -12,7 +12,7 @@ import setupEmberDebugTest from '../helpers/setup-ember-debug-test';
1212import { run } from '@ember/runloop' ;
1313import Ember from 'ember-debug/utils/ember' ;
1414import { compareVersion } from 'ember-debug/utils/version' ;
15- import { setComponentTemplate , getComponentTemplate } from '@ember/component' ;
15+ import { setComponentTemplate } from '@ember/component' ;
1616
1717const { VERSION } = Ember ;
1818
@@ -29,119 +29,123 @@ const getRounded = (value) => {
2929 }
3030 return Math . floor ( data ) ;
3131} ;
32- class OneRootGlimmer extends GlimmerComponent {
33- classNames = 'simple-component' ;
34- }
3532
36- const mockedComponents = {
37- text : {
38- component : EmberComponent . extend ( {
39- tagName : '' ,
40- } ) ,
41- template : hbs ( 'text only' , {
42- moduleName : 'my-app/templates/components/text.hbs' ,
43- } ) ,
44- } ,
45- 'text-glimmer' : {
46- component : GlimmerComponent ,
47- template : hbs ( 'text only' , {
48- moduleName : 'my-app/templates/components/text-glimmer.hbs' ,
49- } ) ,
50- } ,
51- comment : {
52- component : EmberComponent . extend ( {
53- tagName : '' ,
54- } ) ,
55- template : hbs ( '<!-- comment -->' , {
56- moduleName : 'my-app/templates/components/comment.hbs' ,
57- } ) ,
58- } ,
59- 'comment-glimmer' : {
60- component : GlimmerComponent ,
61- template : hbs ( '<!-- comment -->' , {
62- moduleName : 'my-app/templates/components/comment-glimmer.hbs' ,
63- } ) ,
64- } ,
65- 'one-root' : {
66- component : EmberComponent . extend ( {
67- tagName : '' ,
68- } ) ,
69- template : hbs ( '<div class="simple-component">one root</div>' , {
70- moduleName : 'my-app/templates/components/one-root.hbs' ,
71- } ) ,
72- } ,
73- 'one-root-glimmer' : {
74- component : OneRootGlimmer ,
75- template : hbs ( '<div class={{this.classNames}}>one root</div>' , {
76- moduleName : 'my-app/templates/components/one-root-glimmer.hbs' ,
77- } ) ,
78- } ,
79- 'two-root' : {
80- component : EmberComponent . extend ( {
81- tagName : '' ,
82- } ) ,
83- template : hbs (
84- '<div class="simple-component">one</div><div class="another-component">two</div>' ,
85- { moduleName : 'my-app/templates/components/two-root.hbs' } ,
86- ) ,
87- } ,
88- 'two-root-glimmer' : {
89- component : GlimmerComponent ,
90- template : hbs (
91- '<div class="simple-component">one</div><div class="another-component">two</div>' ,
92- { moduleName : 'my-app/templates/components/two-root-glimmer.hbs' } ,
93- ) ,
94- } ,
95- 'root-comment-root' : {
96- component : EmberComponent . extend ( {
97- tagName : '' ,
98- } ) ,
99- template : hbs (
100- '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>' ,
101- { moduleName : 'my-app/templates/components/root-comment-root.hbs' } ,
102- ) ,
103- } ,
104- 'root-comment-root-glimmer' : {
105- component : GlimmerComponent ,
106- template : hbs (
107- '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>' ,
108- {
109- moduleName : 'my-app/templates/components/root-comment-root-glimmer.hbs' ,
110- } ,
111- ) ,
112- } ,
113- 'comment-root-comment' : {
114- component : EmberComponent . extend ( {
115- tagName : '' ,
116- } ) ,
117- template : hbs (
118- '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->' ,
119- { moduleName : 'my-app/templates/components/comment-root-comment.hbs' } ,
120- ) ,
121- } ,
122- 'comment-root-comment-glimmer' : {
123- component : GlimmerComponent ,
124- template : hbs (
125- '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->' ,
126- { moduleName : 'my-app/templates/components/comment-root-comment.hbs' } ,
127- ) ,
128- } ,
129- 'div-tag' : {
130- component : EmberComponent . extend ( {
131- classNames : [ 'simple-component' ] ,
132- } ) ,
133- template : hbs ( 'text in div' , {
134- moduleName : 'my-app/templates/components/div-tag.hbs' ,
135- } ) ,
136- } ,
137- 'div-roots' : {
138- component : EmberComponent . extend ( {
139- classNames : [ 'simple-component' ] ,
140- } ) ,
141- template : hbs ( '<div>one</div><div>two</div>' , {
142- moduleName : 'my-app/templates/components/div-roots.hbs' ,
143- } ) ,
144- } ,
33+ const mockedComponents = ( ) => {
34+ class OneRootGlimmer extends GlimmerComponent {
35+ classNames = 'simple-component' ;
36+ }
37+
38+ return {
39+ text : {
40+ component : EmberComponent . extend ( {
41+ tagName : '' ,
42+ } ) ,
43+ template : hbs ( 'text only' , {
44+ moduleName : 'my-app/templates/components/text.hbs' ,
45+ } ) ,
46+ } ,
47+ 'text-glimmer' : {
48+ component : class extends GlimmerComponent { } ,
49+ template : hbs ( 'text only' , {
50+ moduleName : 'my-app/templates/components/text-glimmer.hbs' ,
51+ } ) ,
52+ } ,
53+ comment : {
54+ component : EmberComponent . extend ( {
55+ tagName : '' ,
56+ } ) ,
57+ template : hbs ( '<!-- comment -->' , {
58+ moduleName : 'my-app/templates/components/comment.hbs' ,
59+ } ) ,
60+ } ,
61+ 'comment-glimmer' : {
62+ component : class extends GlimmerComponent { } ,
63+ template : hbs ( '<!-- comment -->' , {
64+ moduleName : 'my-app/templates/components/comment-glimmer.hbs' ,
65+ } ) ,
66+ } ,
67+ 'one-root' : {
68+ component : EmberComponent . extend ( {
69+ tagName : '' ,
70+ } ) ,
71+ template : hbs ( '<div class="simple-component">one root</div>' , {
72+ moduleName : 'my-app/templates/components/one-root.hbs' ,
73+ } ) ,
74+ } ,
75+ 'one-root-glimmer' : {
76+ component : OneRootGlimmer ,
77+ template : hbs ( '<div class={{this.classNames}}>one root</div>' , {
78+ moduleName : 'my-app/templates/components/one-root-glimmer.hbs' ,
79+ } ) ,
80+ } ,
81+ 'two-root' : {
82+ component : EmberComponent . extend ( {
83+ tagName : '' ,
84+ } ) ,
85+ template : hbs (
86+ '<div class="simple-component">one</div><div class="another-component">two</div>' ,
87+ { moduleName : 'my-app/templates/components/two-root.hbs' } ,
88+ ) ,
89+ } ,
90+ 'two-root-glimmer' : {
91+ component : class extends GlimmerComponent { } ,
92+ template : hbs (
93+ '<div class="simple-component">one</div><div class="another-component">two</div>' ,
94+ { moduleName : 'my-app/templates/components/two-root-glimmer.hbs' } ,
95+ ) ,
96+ } ,
97+ 'root-comment-root' : {
98+ component : EmberComponent . extend ( {
99+ tagName : '' ,
100+ } ) ,
101+ template : hbs (
102+ '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>' ,
103+ { moduleName : 'my-app/templates/components/root-comment-root.hbs' } ,
104+ ) ,
105+ } ,
106+ 'root-comment-root-glimmer' : {
107+ component : class extends GlimmerComponent { } ,
108+ template : hbs (
109+ '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>' ,
110+ {
111+ moduleName :
112+ 'my-app/templates/components/root-comment-root-glimmer.hbs' ,
113+ } ,
114+ ) ,
115+ } ,
116+ 'comment-root-comment' : {
117+ component : EmberComponent . extend ( {
118+ tagName : '' ,
119+ } ) ,
120+ template : hbs (
121+ '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->' ,
122+ { moduleName : 'my-app/templates/components/comment-root-comment.hbs' } ,
123+ ) ,
124+ } ,
125+ 'comment-root-comment-glimmer' : {
126+ component : class extends GlimmerComponent { } ,
127+ template : hbs (
128+ '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->' ,
129+ { moduleName : 'my-app/templates/components/comment-root-comment.hbs' } ,
130+ ) ,
131+ } ,
132+ 'div-tag' : {
133+ component : EmberComponent . extend ( {
134+ classNames : [ 'simple-component' ] ,
135+ } ) ,
136+ template : hbs ( 'text in div' , {
137+ moduleName : 'my-app/templates/components/div-tag.hbs' ,
138+ } ) ,
139+ } ,
140+ 'div-roots' : {
141+ component : EmberComponent . extend ( {
142+ classNames : [ 'simple-component' ] ,
143+ } ) ,
144+ template : hbs ( '<div>one</div><div>two</div>' , {
145+ moduleName : 'my-app/templates/components/div-roots.hbs' ,
146+ } ) ,
147+ } ,
148+ } ;
145149} ;
146150
147151const mockedRoutes = {
@@ -255,8 +259,6 @@ const constructBase = (owner) => {
255259const constructComponents = ( owner , componentsMap ) => {
256260 for ( const componentKey in componentsMap ) {
257261 if ( componentsMap [ componentKey ] . component ) {
258- class X extends componentsMap [ componentKey ] . component { }
259- componentsMap [ componentKey ] . component = X ;
260262 owner . register (
261263 `component:${ componentKey } ` ,
262264 componentsMap [ componentKey ] . component ,
@@ -267,12 +269,10 @@ const constructComponents = (owner, componentsMap) => {
267269 `template:components/${ componentKey } ` ,
268270 componentsMap [ componentKey ] . template ,
269271 ) ;
270- if ( ! getComponentTemplate ( componentsMap [ componentKey ] . component ) ) {
271- setComponentTemplate (
272- componentsMap [ componentKey ] . template ,
273- componentsMap [ componentKey ] . component ,
274- ) ;
275- }
272+ setComponentTemplate (
273+ componentsMap [ componentKey ] . template ,
274+ componentsMap [ componentKey ] . component ,
275+ ) ;
276276 }
277277 }
278278} ;
@@ -407,7 +407,7 @@ module('Ember Debug - profile manager component highlight', function (hooks) {
407407 hooks . beforeEach ( async function ( ) {
408408 EmberDebug . IGNORE_DEPRECATIONS = true ;
409409 constructBase ( this . owner ) ;
410- constructComponents ( this . owner , mockedComponents ) ;
410+ constructComponents ( this . owner , mockedComponents ( ) ) ;
411411 } ) ;
412412
413413 hooks . afterEach ( function ( assert ) {
0 commit comments