ember-inspector 4.4.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +20 -12
  3. package/.github/workflows/build.yml +1 -0
  4. package/.tool-versions +1 -0
  5. package/CHANGELOG.md +31 -2
  6. package/app/{templates → components}/component-tree-toolbar.hbs +5 -5
  7. package/app/{templates → components}/container-type-toolbar.hbs +3 -3
  8. package/app/{templates/container-types/index-toolbar.hbs → components/container-types-toolbar.hbs} +2 -2
  9. package/app/components/date-property-field.js +4 -10
  10. package/app/{templates → components}/deprecations-toolbar.hbs +4 -4
  11. package/app/{templates → components}/libraries-toolbar.hbs +0 -0
  12. package/app/{templates → components}/model-types-toolbar.hbs +4 -4
  13. package/app/{templates → components}/promise-tree-toolbar.hbs +13 -13
  14. package/app/components/records-toolbar.hbs +26 -0
  15. package/app/components/render-tree-toolbar.hbs +33 -0
  16. package/app/components/route-cell-name.js +1 -1
  17. package/app/{templates → components}/route-tree-toolbar.hbs +3 -3
  18. package/app/components/scroll-container.js +3 -1
  19. package/app/computed/debounce.js +1 -3
  20. package/app/controllers/deprecations.js +1 -0
  21. package/app/controllers/render-tree.js +19 -4
  22. package/app/controllers/route-tree.js +51 -44
  23. package/app/initializers/setup.js +7 -18
  24. package/app/models/promise.js +3 -4
  25. package/app/routes/application.js +2 -14
  26. package/app/routes/component-tree.js +3 -0
  27. package/app/routes/deprecations.js +4 -0
  28. package/app/routes/launch.js +1 -0
  29. package/app/routes/libraries.js +1 -0
  30. package/app/routes/promise-tree.js +6 -0
  31. package/app/routes/render-tree.js +27 -10
  32. package/app/routes/route-tree.js +3 -2
  33. package/app/routes/tab.js +9 -9
  34. package/app/routes/whats-new.js +2 -0
  35. package/app/{adapters → services/adapters}/basic.js +3 -3
  36. package/app/{adapters → services/adapters}/bookmarklet.js +0 -0
  37. package/app/{adapters → services/adapters}/chrome.js +0 -0
  38. package/app/{adapters → services/adapters}/firefox.js +0 -0
  39. package/app/{adapters → services/adapters}/web-extension.js +0 -0
  40. package/app/{adapters → services/adapters}/websocket.js +0 -0
  41. package/app/services/port.js +3 -2
  42. package/app/templates/application.hbs +1 -1
  43. package/app/templates/component-tree.hbs +20 -4
  44. package/app/templates/container-type.hbs +10 -0
  45. package/app/templates/container-types/index.hbs +10 -0
  46. package/app/templates/deprecations.hbs +13 -10
  47. package/app/templates/libraries.hbs +12 -11
  48. package/app/templates/model-types.hbs +15 -2
  49. package/app/templates/promise-tree.hbs +22 -7
  50. package/app/templates/records.hbs +15 -7
  51. package/app/templates/render-tree.hbs +32 -9
  52. package/app/templates/route-tree.hbs +23 -14
  53. package/app/templates/whats-new.hbs +8 -4
  54. package/config/ember-cli-update.json +1 -1
  55. package/config/ember-try.js +8 -0
  56. package/config/targets.js +14 -6
  57. package/dist/bookmarklet/panes-3-4-0/assets/chunk.143.701794df61367d9c0beb.js +146 -0
  58. package/dist/bookmarklet/panes-3-4-0/assets/chunk.178.1fa501a69a8888639ff4.js +20 -0
  59. package/dist/bookmarklet/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js +505 -0
  60. package/dist/bookmarklet/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js.LICENSE.txt +8 -0
  61. package/dist/bookmarklet/panes-3-4-0/assets/ember-inspector.js +617 -1512
  62. package/dist/bookmarklet/panes-3-4-0/assets/vendor.css +9 -2
  63. package/dist/bookmarklet/panes-3-4-0/assets/vendor.js +6132 -7501
  64. package/dist/bookmarklet/panes-3-4-0/ember_debug.js +731 -416
  65. package/dist/bookmarklet/panes-3-4-0/index.html +2 -1
  66. package/dist/chrome/manifest.json +1 -1
  67. package/dist/chrome/panes-3-4-0/assets/chunk.143.701794df61367d9c0beb.js +146 -0
  68. package/dist/chrome/panes-3-4-0/assets/chunk.178.1fa501a69a8888639ff4.js +20 -0
  69. package/dist/chrome/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js +505 -0
  70. package/dist/chrome/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js.LICENSE.txt +8 -0
  71. package/dist/chrome/panes-3-4-0/assets/ember-inspector.js +617 -1512
  72. package/dist/chrome/panes-3-4-0/assets/vendor.css +9 -2
  73. package/dist/chrome/panes-3-4-0/assets/vendor.js +6132 -7501
  74. package/dist/chrome/panes-3-4-0/ember_debug.js +731 -416
  75. package/dist/chrome/panes-3-4-0/index.html +2 -1
  76. package/dist/firefox/manifest.json +1 -1
  77. package/dist/firefox/panes-3-4-0/assets/chunk.143.701794df61367d9c0beb.js +146 -0
  78. package/dist/firefox/panes-3-4-0/assets/chunk.178.1fa501a69a8888639ff4.js +20 -0
  79. package/dist/firefox/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js +505 -0
  80. package/dist/firefox/panes-3-4-0/assets/chunk.916.cfdae71ef87e943d7ad0.js.LICENSE.txt +8 -0
  81. package/dist/firefox/panes-3-4-0/assets/ember-inspector.js +617 -1512
  82. package/dist/firefox/panes-3-4-0/assets/vendor.css +9 -2
  83. package/dist/firefox/panes-3-4-0/assets/vendor.js +6132 -7501
  84. package/dist/firefox/panes-3-4-0/ember_debug.js +731 -416
  85. package/dist/firefox/panes-3-4-0/index.html +2 -1
  86. package/dist/websocket/assets/chunk.143.701794df61367d9c0beb.js +146 -0
  87. package/dist/websocket/assets/chunk.178.1fa501a69a8888639ff4.js +20 -0
  88. package/dist/websocket/assets/chunk.916.cfdae71ef87e943d7ad0.js +505 -0
  89. package/dist/websocket/assets/chunk.916.cfdae71ef87e943d7ad0.js.LICENSE.txt +8 -0
  90. package/dist/websocket/assets/ember-inspector.js +617 -1512
  91. package/dist/websocket/assets/vendor.css +9 -2
  92. package/dist/websocket/assets/vendor.js +6132 -7501
  93. package/dist/websocket/ember_debug.js +731 -416
  94. package/dist/websocket/index.html +2 -1
  95. package/ember_debug/adapters/basic.js +4 -3
  96. package/ember_debug/adapters/web-extension.js +2 -1
  97. package/ember_debug/adapters/websocket.js +4 -7
  98. package/ember_debug/container-debug.js +2 -3
  99. package/ember_debug/data-debug.js +4 -3
  100. package/ember_debug/deprecation-debug.js +12 -15
  101. package/ember_debug/general-debug.js +3 -4
  102. package/ember_debug/libs/promise-assembler.js +12 -14
  103. package/ember_debug/libs/source-map.js +3 -8
  104. package/ember_debug/main.js +11 -11
  105. package/ember_debug/mixins/port-mixin.js +1 -3
  106. package/ember_debug/models/profile-manager.js +135 -3
  107. package/ember_debug/models/profile-node.js +2 -4
  108. package/ember_debug/models/promise.js +3 -4
  109. package/ember_debug/object-inspector.js +15 -19
  110. package/ember_debug/port.js +7 -5
  111. package/ember_debug/promise-debug.js +16 -17
  112. package/ember_debug/render-debug.js +11 -4
  113. package/ember_debug/route-debug.js +5 -10
  114. package/ember_debug/services/session.js +1 -3
  115. package/ember_debug/utils/ember/application.js +11 -0
  116. package/ember_debug/utils/ember/array/index.js +11 -0
  117. package/ember_debug/utils/ember/array/mutable.js +11 -0
  118. package/ember_debug/utils/ember/array/proxy.js +11 -0
  119. package/ember_debug/utils/ember/component.js +11 -0
  120. package/ember_debug/utils/ember/debug.js +15 -0
  121. package/ember_debug/utils/{ember.js → ember/index.js} +1 -0
  122. package/ember_debug/utils/ember/instrumentation.js +11 -0
  123. package/ember_debug/utils/ember/object/computed.js +11 -0
  124. package/ember_debug/utils/ember/object/evented.js +11 -0
  125. package/ember_debug/utils/ember/object/index.js +15 -0
  126. package/ember_debug/utils/ember/object/internals.js +11 -0
  127. package/ember_debug/utils/ember/object/mixin.js +11 -0
  128. package/ember_debug/utils/ember/object/observable.js +11 -0
  129. package/ember_debug/utils/ember/object/promise-proxy-mixin.js +13 -0
  130. package/ember_debug/utils/ember/runloop.js +17 -0
  131. package/ember_debug/utils/ember/utils.js +11 -0
  132. package/ember_debug/utils/rsvp.js +14 -0
  133. package/ember_debug/vendor/startup-wrapper.js +21 -12
  134. package/ember_debug/view-debug.js +2 -3
  135. package/package.json +43 -37
  136. package/tests/acceptance/app-picker-test.js +3 -3
  137. package/tests/acceptance/component-tree-test.js +17 -3
  138. package/tests/acceptance/container-test.js +8 -6
  139. package/tests/acceptance/data-test.js +2 -0
  140. package/tests/acceptance/deprecation-test.js +4 -0
  141. package/tests/acceptance/object-inspector-test.js +29 -1
  142. package/tests/acceptance/promise-test.js +11 -1
  143. package/tests/acceptance/route-tree-test.js +10 -0
  144. package/tests/acceptance/whats-new-test.js +1 -1
  145. package/tests/ember_debug/ember-debug-test.js +2 -0
  146. package/tests/ember_debug/object-inspector-test.js +54 -22
  147. package/tests/ember_debug/profile-manager-test.js +563 -6
  148. package/tests/ember_debug/profile-node-test.js +5 -5
  149. package/tests/ember_debug/promise-assembler-test.js +2 -0
  150. package/tests/ember_debug/promise-debug-test.js +7 -5
  151. package/tests/ember_debug/render-debug-test.js +1 -1
  152. package/tests/ember_debug/view-debug-test.js +8 -8
  153. package/tests/helpers/setup-ember-debug-test.js +11 -6
  154. package/tests/index.html +8 -1
  155. package/tests/integration/components/component-tree-arg-test.js +1 -1
  156. package/tests/test-adapter.js +1 -1
  157. package/tests/test-helper.js +5 -1
  158. package/tests/unit/check-current-route-test.js +4 -0
  159. package/tests/unit/is-route-substate-test.js +8 -8
  160. package/tests/unit/match-test.js +2 -2
  161. package/app/templates/records-toolbar.hbs +0 -26
  162. package/app/templates/render-tree-toolbar.hbs +0 -20
  163. package/tests/.eslintrc.js +0 -8
@@ -1,8 +1,565 @@
1
- import { test } from 'qunit';
2
- import ProfileManager from 'ember-debug/models/profile-manager';
1
+ import { find, visit, waitUntil, getSettledState } from '@ember/test-helpers';
2
+ import EmberComponent from '@ember/component';
3
+ import GlimmerComponent from '@glimmer/component';
4
+ import EmberRoute from '@ember/routing/route';
5
+ import Controller from '@ember/controller';
6
+ import { module, test } from 'qunit';
7
+ import { hbs } from 'ember-cli-htmlbars';
8
+ import EmberDebug from 'ember-debug/main';
9
+ import setupEmberDebugTest from '../helpers/setup-ember-debug-test';
10
+ import { run } from '@ember/runloop';
11
+ import Ember from 'ember-debug/utils/ember';
12
+ import { compareVersion } from 'ember-debug/utils/version';
3
13
 
4
- test('Ember Debug - Construction', function (assert) {
5
- let manager = new ProfileManager();
6
- assert.ok(!!manager, 'it was created');
7
- assert.equal(manager.profiles.length, 0, 'it has no profiles');
14
+ const { VERSION } = Ember;
15
+
16
+ const isComponentHighlightSupported = compareVersion(VERSION, '3.20.0') !== -1;
17
+
18
+ const getRounded = (value) => {
19
+ let data = value;
20
+ if (typeof data === 'string') {
21
+ // remove unit px
22
+ if (data.indexOf('px') !== -1) {
23
+ data.replace('px', '');
24
+ }
25
+ data = parseFloat(data);
26
+ }
27
+ return Math.floor(data);
28
+ };
29
+ class OneRootGlimmer extends GlimmerComponent {
30
+ classNames = 'simple-component';
31
+ }
32
+
33
+ const mockedComponents = {
34
+ text: {
35
+ component: EmberComponent.extend({
36
+ tagName: '',
37
+ }),
38
+ template: hbs('text only', {
39
+ moduleName: 'my-app/templates/components/text.hbs',
40
+ }),
41
+ },
42
+ 'text-glimmer': {
43
+ component: GlimmerComponent,
44
+ template: hbs('text only', {
45
+ moduleName: 'my-app/templates/components/text-glimmer.hbs',
46
+ }),
47
+ },
48
+ comment: {
49
+ component: EmberComponent.extend({
50
+ tagName: '',
51
+ }),
52
+ template: hbs('<!-- comment -->', {
53
+ moduleName: 'my-app/templates/components/comment.hbs',
54
+ }),
55
+ },
56
+ 'comment-glimmer': {
57
+ component: GlimmerComponent,
58
+ template: hbs('<!-- comment -->', {
59
+ moduleName: 'my-app/templates/components/comment-glimmer.hbs',
60
+ }),
61
+ },
62
+ 'one-root': {
63
+ component: EmberComponent.extend({
64
+ tagName: '',
65
+ }),
66
+ template: hbs('<div class="simple-component">one root</div>', {
67
+ moduleName: 'my-app/templates/components/one-root.hbs',
68
+ }),
69
+ },
70
+ 'one-root-glimmer': {
71
+ component: OneRootGlimmer,
72
+ template: hbs('<div class={{this.classNames}}>one root</div>', {
73
+ moduleName: 'my-app/templates/components/one-root-glimmer.hbs',
74
+ }),
75
+ },
76
+ 'two-root': {
77
+ component: EmberComponent.extend({
78
+ tagName: '',
79
+ }),
80
+ template: hbs(
81
+ '<div class="simple-component">one</div><div class="another-component">two</div>',
82
+ { moduleName: 'my-app/templates/components/two-root.hbs' }
83
+ ),
84
+ },
85
+ 'two-root-glimmer': {
86
+ component: GlimmerComponent,
87
+ template: hbs(
88
+ '<div class="simple-component">one</div><div class="another-component">two</div>',
89
+ { moduleName: 'my-app/templates/components/two-root-glimmer.hbs' }
90
+ ),
91
+ },
92
+ 'root-comment-root': {
93
+ component: EmberComponent.extend({
94
+ tagName: '',
95
+ }),
96
+ template: hbs(
97
+ '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>',
98
+ { moduleName: 'my-app/templates/components/root-comment-root.hbs' }
99
+ ),
100
+ },
101
+ 'root-comment-root-glimmer': {
102
+ component: GlimmerComponent,
103
+ template: hbs(
104
+ '<div class="simple-component">one</div><!-- comment --><div class="another-component">two</div>',
105
+ {
106
+ moduleName: 'my-app/templates/components/root-comment-root-glimmer.hbs',
107
+ }
108
+ ),
109
+ },
110
+ 'comment-root-comment': {
111
+ component: EmberComponent.extend({
112
+ tagName: '',
113
+ }),
114
+ template: hbs(
115
+ '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->',
116
+ { moduleName: 'my-app/templates/components/comment-root-comment.hbs' }
117
+ ),
118
+ },
119
+ 'comment-root-comment-glimmer': {
120
+ component: GlimmerComponent,
121
+ template: hbs(
122
+ '<!-- comment 1 --><div class="simple-component">one</div><!-- comment 2 -->',
123
+ { moduleName: 'my-app/templates/components/comment-root-comment.hbs' }
124
+ ),
125
+ },
126
+ 'div-tag': {
127
+ component: EmberComponent.extend({
128
+ classNames: ['simple-component'],
129
+ }),
130
+ template: hbs('text in div', {
131
+ moduleName: 'my-app/templates/components/div-tag.hbs',
132
+ }),
133
+ },
134
+ 'div-roots': {
135
+ component: EmberComponent.extend({
136
+ classNames: ['simple-component'],
137
+ }),
138
+ template: hbs('<div>one</div><div>two</div>', {
139
+ moduleName: 'my-app/templates/components/div-roots.hbs',
140
+ }),
141
+ },
142
+ };
143
+
144
+ const mockedRoutes = {
145
+ 'text-route': {
146
+ template: hbs('<Text />', {
147
+ moduleName: 'my-app/templates/text-route.hbs',
148
+ }),
149
+ expectedRender: [],
150
+ },
151
+ 'text-glimmer-route': {
152
+ template: hbs('<TextGlimmer />', {
153
+ moduleName: 'my-app/templates/text-glimmer-route.hbs',
154
+ }),
155
+ expectedRender: [],
156
+ },
157
+ 'comment-route': {
158
+ template: hbs('<Comment />', {
159
+ moduleName: 'my-app/templates/comment-route.hbs',
160
+ }),
161
+ expectedRender: [],
162
+ },
163
+ 'comment-glimmer-route': {
164
+ template: hbs('<CommentGlimmer />', {
165
+ moduleName: 'my-app/templates/comment-glimmer-route.hbs',
166
+ }),
167
+ expectedRender: [],
168
+ },
169
+ 'one-root-route': {
170
+ template: hbs('<OneRoot />', {
171
+ moduleName: 'my-app/templates/one-root-route.hbs',
172
+ }),
173
+ expectedRender: ['.simple-component'],
174
+ },
175
+ 'one-root-glimmer-route': {
176
+ template: hbs('<OneRootGlimmer />', {
177
+ moduleName: 'my-app/templates/one-root-glimmer-route.hbs',
178
+ }),
179
+ expectedRender: ['.simple-component'],
180
+ },
181
+ 'two-root-route': {
182
+ template: hbs('<TwoRoot />', {
183
+ moduleName: 'my-app/templates/two-root-route.hbs',
184
+ }),
185
+ expectedRender: ['.simple-component', '.another-component'],
186
+ },
187
+ 'two-root-glimmer-route': {
188
+ template: hbs('<TwoRootGlimmer />', {
189
+ moduleName: 'my-app/templates/two-root-glimmer-route.hbs',
190
+ }),
191
+ expectedRender: ['.simple-component', '.another-component'],
192
+ },
193
+ 'root-comment-root-route': {
194
+ template: hbs('<RootCommentRoot />', {
195
+ moduleName: 'my-app/templates/root-comment-root-route.hbs',
196
+ }),
197
+ expectedRender: ['.simple-component', '.another-component'],
198
+ },
199
+ 'root-comment-root-glimmer-route': {
200
+ template: hbs('<RootCommentRootGlimmer />', {
201
+ moduleName: 'my-app/templates/root-comment-root-glimmer-route.hbs',
202
+ }),
203
+ expectedRender: ['.simple-component', '.another-component'],
204
+ },
205
+ 'comment-root-comment-route': {
206
+ template: hbs('<CommentRootComment />', {
207
+ moduleName: 'my-app/templates/comment-root-comment-route.hbs',
208
+ }),
209
+ expectedRender: ['.simple-component'],
210
+ },
211
+ 'comment-root-comment-glimmer-route': {
212
+ template: hbs('<CommentRootCommentGlimmer />', {
213
+ moduleName: 'my-app/templates/comment-root-comment-glimmer-route.hbs',
214
+ }),
215
+ expectedRender: ['.simple-component'],
216
+ },
217
+ 'div-tag-route': {
218
+ template: hbs('<DivTag />', {
219
+ moduleName: 'my-app/templates/div-tag-route.hbs',
220
+ }),
221
+ expectedRender: ['.simple-component'],
222
+ },
223
+ 'div-roots-route': {
224
+ template: hbs('<DivRoots />', {
225
+ moduleName: 'my-app/templates/div-roots-route.hbs',
226
+ }),
227
+ expectedRender: ['.simple-component'],
228
+ },
229
+ };
230
+
231
+ const constructBase = (owner) => {
232
+ owner.register('route:application', EmberRoute);
233
+
234
+ owner.register('controller:application', Controller);
235
+
236
+ owner.register(
237
+ 'template:application',
238
+ hbs(
239
+ '<div class="application" style="line-height: normal;">{{outlet}}</div>',
240
+ { moduleName: 'my-app/templates/application.hbs' }
241
+ )
242
+ );
243
+
244
+ owner.register('route:home', EmberRoute);
245
+
246
+ owner.register(
247
+ 'template:home',
248
+ hbs('Home', { moduleName: 'my-app/templates/home.hbs' })
249
+ );
250
+ };
251
+
252
+ const constructComponents = (owner, componentsMap) => {
253
+ for (const componentKey in componentsMap) {
254
+ if (componentsMap[componentKey].component) {
255
+ owner.register(
256
+ `component:${componentKey}`,
257
+ componentsMap[componentKey].component
258
+ );
259
+ }
260
+ if (componentsMap[componentKey].template) {
261
+ owner.register(
262
+ `template:components/${componentKey}`,
263
+ componentsMap[componentKey].template
264
+ );
265
+ }
266
+ }
267
+ };
268
+
269
+ const constructRoutes = (owner, routes) => {
270
+ routes.forEach((routeKey) => {
271
+ if (mockedRoutes[routeKey].route) {
272
+ owner.register(`route:${routeKey}`, mockedRoutes[routeKey].route);
273
+ }
274
+ if (mockedRoutes[routeKey].controller) {
275
+ owner.register(
276
+ `controller:${routeKey}`,
277
+ mockedRoutes[routeKey].controller
278
+ );
279
+ }
280
+ if (mockedRoutes[routeKey].template) {
281
+ owner.register(`template:${routeKey}`, mockedRoutes[routeKey].template);
282
+ }
283
+ });
284
+ };
285
+
286
+ const assertNodeSizes = (assert, synthetic, real) => {
287
+ const style = synthetic.style;
288
+ const box = real.getBoundingClientRect();
289
+ const dimensions = [
290
+ ['left', 'x'],
291
+ ['top', 'y'],
292
+ ['width', 'width'],
293
+ ['height', 'height'],
294
+ ];
295
+ for (const [styleKey, boxKey] of dimensions) {
296
+ assert.equal(
297
+ getRounded(style[styleKey]),
298
+ getRounded(box[boxKey]),
299
+ `same ${boxKey} as component`
300
+ );
301
+ }
302
+ };
303
+
304
+ const matchHighlights = (
305
+ assert,
306
+ testedRoute,
307
+ newHighlights,
308
+ isGlimmerComponent
309
+ ) => {
310
+ const renderedComponents = mockedRoutes[testedRoute].expectedRender.map(
311
+ (selector) => {
312
+ const component = find(selector);
313
+ assert.ok(
314
+ component,
315
+ isComponentHighlightSupported
316
+ ? 'expected component is rendered'
317
+ : 'expected component is rendered but the component highlight is not supported'
318
+ );
319
+ return component;
320
+ }
321
+ );
322
+
323
+ if (isComponentHighlightSupported && !isGlimmerComponent) {
324
+ renderedComponents.forEach((renderedComponent, index) => {
325
+ assertNodeSizes(assert, newHighlights[index], renderedComponent);
326
+ });
327
+ } else {
328
+ assert.notOk(
329
+ newHighlights.length,
330
+ 'Should not have any highlight if highlight is not supported'
331
+ );
332
+ }
333
+ };
334
+
335
+ const enableHighlight = () => {
336
+ run(() =>
337
+ EmberDebug.port.trigger('render:updateShouldHighlightRender', {
338
+ shouldHighlightRender: true,
339
+ })
340
+ );
341
+ };
342
+
343
+ async function highlightsPromise(testedRoute, isGlimmerComponent) {
344
+ await visit('/home');
345
+ enableHighlight();
346
+ // Glimmer component does support highlight. so there should not be any highlights
347
+ const numberOfHighlights = isGlimmerComponent
348
+ ? 0
349
+ : mockedRoutes[testedRoute].expectedRender.length;
350
+ const observedHighlights = [];
351
+ if (!isComponentHighlightSupported) {
352
+ await visit('/' + testedRoute);
353
+ return observedHighlights;
354
+ }
355
+ const observer = new MutationObserver(function (records) {
356
+ records.forEach((record) => {
357
+ record.addedNodes.forEach((node) => {
358
+ if (node.className === 'ember-inspector-render-highlight') {
359
+ observedHighlights.push(node);
360
+ }
361
+ });
362
+ });
363
+ });
364
+ observer.observe(document.body, { childList: true });
365
+ await visit('/' + testedRoute);
366
+ if (numberOfHighlights > 0) {
367
+ await waitUntil(() => observedHighlights.length === numberOfHighlights, {
368
+ timeout: 2000,
369
+ });
370
+ } else {
371
+ await waitUntil(() => {
372
+ // Check for the settled state minus hasPendingTimers
373
+ let { hasRunLoop, hasPendingRequests, hasPendingWaiters } =
374
+ getSettledState();
375
+ if (hasRunLoop || hasPendingRequests || hasPendingWaiters) {
376
+ return false;
377
+ }
378
+ return true;
379
+ });
380
+ }
381
+ observer.disconnect();
382
+ return observedHighlights;
383
+ }
384
+
385
+ module('Ember Debug - profile manager component highlight', function (hooks) {
386
+ setupEmberDebugTest(hooks, {
387
+ routes() {
388
+ this.route('home');
389
+ Object.keys(mockedRoutes).forEach((route) => {
390
+ this.route(route);
391
+ });
392
+ },
393
+ });
394
+
395
+ hooks.beforeEach(async function () {
396
+ EmberDebug.IGNORE_DEPRECATIONS = true;
397
+ constructBase(this.owner);
398
+ constructComponents(this.owner, mockedComponents);
399
+ });
400
+
401
+ hooks.afterEach(function (assert) {
402
+ const highlights = document.getElementsByClassName(
403
+ 'ember-inspector-render-highlight'
404
+ );
405
+
406
+ assert.notOk(
407
+ highlights?.length,
408
+ 'highlights should be destroyed after execution'
409
+ );
410
+ });
411
+
412
+ test('Should not show highlights for text component - Ember component', async function (assert) {
413
+ assert.expect(2);
414
+
415
+ const testedRoute = 'text-route';
416
+ constructRoutes(this.owner, [testedRoute]);
417
+
418
+ const newHighlights = await highlightsPromise(testedRoute);
419
+
420
+ assert.notOk(newHighlights.length, 'should not render highlight');
421
+ });
422
+
423
+ test('Should not show highlights for text component - Glimmer component', async function (assert) {
424
+ assert.expect(2);
425
+
426
+ const testedRoute = 'text-glimmer-route';
427
+ constructRoutes(this.owner, [testedRoute]);
428
+
429
+ const newHighlights = await highlightsPromise(testedRoute, true);
430
+
431
+ assert.notOk(newHighlights.length, 'should not render highlight');
432
+ });
433
+
434
+ test('Should not show highlights for comment component - Ember component', async function (assert) {
435
+ assert.expect(2);
436
+
437
+ const testedRoute = 'comment-route';
438
+ constructRoutes(this.owner, [testedRoute]);
439
+
440
+ const newHighlights = await highlightsPromise(testedRoute);
441
+
442
+ assert.notOk(newHighlights.length, 'should not render highlight');
443
+ });
444
+
445
+ test('Should not show highlights for comment component - Glimmer component', async function (assert) {
446
+ assert.expect(2);
447
+
448
+ const testedRoute = 'comment-glimmer-route';
449
+ constructRoutes(this.owner, [testedRoute]);
450
+
451
+ const newHighlights = await highlightsPromise(testedRoute, true);
452
+
453
+ assert.notOk(newHighlights.length, 'should not render highlight');
454
+ });
455
+
456
+ test('Should highlight one rootNode Ember component', async function (assert) {
457
+ assert.expect(isComponentHighlightSupported ? 6 : 3);
458
+
459
+ const testedRoute = 'one-root-route';
460
+ constructRoutes(this.owner, [testedRoute]);
461
+
462
+ const newHighlights = await highlightsPromise(testedRoute);
463
+
464
+ matchHighlights(assert, testedRoute, newHighlights);
465
+ });
466
+
467
+ test('Highlight is not supported, should not highlight one rootNode Glimmer component', async function (assert) {
468
+ assert.expect(3);
469
+
470
+ const testedRoute = 'one-root-glimmer-route';
471
+ constructRoutes(this.owner, [testedRoute]);
472
+
473
+ const newHighlights = await highlightsPromise(testedRoute, true);
474
+
475
+ matchHighlights(assert, testedRoute, newHighlights, true);
476
+ });
477
+
478
+ test('Should highlight two rootNode ([rootNode, rootNode] and no tagName) Ember component', async function (assert) {
479
+ assert.expect(isComponentHighlightSupported ? 11 : 4);
480
+
481
+ const testedRoute = 'two-root-route';
482
+ constructRoutes(this.owner, [testedRoute]);
483
+
484
+ const newHighlights = await highlightsPromise(testedRoute);
485
+
486
+ matchHighlights(assert, testedRoute, newHighlights);
487
+ });
488
+
489
+ test('Highlight is not supported, should not highlight two rootNode ([rootNode, rootNode] and no tagName) Glimmer component', async function (assert) {
490
+ assert.expect(4);
491
+
492
+ const testedRoute = 'two-root-glimmer-route';
493
+ constructRoutes(this.owner, [testedRoute]);
494
+
495
+ const newHighlights = await highlightsPromise(testedRoute, true);
496
+
497
+ matchHighlights(assert, testedRoute, newHighlights, true);
498
+ });
499
+
500
+ test('Should highlight two rootNode with one comment ([rootNode, commentNode, rootNode] and no tagName) Ember component', async function (assert) {
501
+ assert.expect(isComponentHighlightSupported ? 11 : 4);
502
+
503
+ const testedRoute = 'root-comment-root-route';
504
+ constructRoutes(this.owner, [testedRoute]);
505
+
506
+ const newHighlights = await highlightsPromise(testedRoute);
507
+
508
+ matchHighlights(assert, testedRoute, newHighlights);
509
+ });
510
+
511
+ test('Highlight is not supported, should not highlight two rootNode with one comment ([rootNode, commentNode, rootNode] and no tagName) Glimmer component', async function (assert) {
512
+ assert.expect(4);
513
+
514
+ const testedRoute = 'root-comment-root-glimmer-route';
515
+ constructRoutes(this.owner, [testedRoute]);
516
+
517
+ const newHighlights = await highlightsPromise(testedRoute, true);
518
+
519
+ matchHighlights(assert, testedRoute, newHighlights, true);
520
+ });
521
+
522
+ test('Should highlight one rootNode with two comment ([commentNode, rootNode, commentNode] and no tagName) Ember component', async function (assert) {
523
+ assert.expect(isComponentHighlightSupported ? 6 : 3);
524
+
525
+ const testedRoute = 'comment-root-comment-route';
526
+ constructRoutes(this.owner, [testedRoute]);
527
+
528
+ const newHighlights = await highlightsPromise(testedRoute);
529
+
530
+ matchHighlights(assert, testedRoute, newHighlights);
531
+ });
532
+
533
+ test('Highlight is not supported, should not highlight one rootNode with two comment ([commentNode, rootNode, commentNode] and no tagName) Glimmer component', async function (assert) {
534
+ assert.expect(3);
535
+
536
+ const testedRoute = 'comment-root-comment-glimmer-route';
537
+ constructRoutes(this.owner, [testedRoute]);
538
+
539
+ const newHighlights = await highlightsPromise(testedRoute, true);
540
+
541
+ matchHighlights(assert, testedRoute, newHighlights, true);
542
+ });
543
+
544
+ test('Should highlight tagName div Ember component', async function (assert) {
545
+ assert.expect(isComponentHighlightSupported ? 6 : 3);
546
+
547
+ const testedRoute = 'div-tag-route';
548
+ constructRoutes(this.owner, [testedRoute]);
549
+
550
+ const newHighlights = await highlightsPromise(testedRoute);
551
+
552
+ matchHighlights(assert, testedRoute, newHighlights);
553
+ });
554
+
555
+ test('Should highlight two rootNode ([rootNode, rootNode] and tagName div) Ember component', async function (assert) {
556
+ assert.expect(isComponentHighlightSupported ? 6 : 3);
557
+
558
+ const testedRoute = 'div-roots-route';
559
+ constructRoutes(this.owner, [testedRoute]);
560
+
561
+ const newHighlights = await highlightsPromise(testedRoute);
562
+
563
+ matchHighlights(assert, testedRoute, newHighlights);
564
+ });
8
565
  });
@@ -9,7 +9,7 @@ module('Ember Debug - ProfileNode', function () {
9
9
  assert.equal(p.start, 1001, 'it stores the start time');
10
10
  assert.equal(p.name, 'application', 'it extracted the correct name');
11
11
  assert.equal(p.children.length, 0, 'it has no children by default');
12
- assert.ok(!p.time, "It has no time because it's unfinished");
12
+ assert.notOk(p.time, "It has no time because it's unfinished");
13
13
  });
14
14
 
15
15
  test('with no payload it has an unknown name', function (assert) {
@@ -33,13 +33,13 @@ module('Ember Debug - ProfileNode', function () {
33
33
  let p1 = new ProfileNode(new Date().getTime(), { template: 'items' });
34
34
  let p2 = new ProfileNode(new Date().getTime(), { template: 'item' }, p1);
35
35
 
36
- assert.ok(
37
- !p1.parent,
36
+ assert.notOk(
37
+ p1.parent,
38
38
  'Without a parent parameter, the attribute is not set'
39
39
  );
40
40
  assert.equal(p2.parent, p1, "If passed, p2's parent is assigned to p1");
41
- assert.ok(!p1.time, "p1 has no time because it's unfinished");
42
- assert.ok(!p2.time, "p2 has no time because it's unfinished");
41
+ assert.notOk(p1.time, "p1 has no time because it's unfinished");
42
+ assert.notOk(p2.time, "p2 has no time because it's unfinished");
43
43
  });
44
44
 
45
45
  test('It can finish the timer', function (assert) {
@@ -234,6 +234,8 @@ module('Ember Debug - PromiseAssembler', function (hooks) {
234
234
  });
235
235
 
236
236
  test('#stop', function (assert) {
237
+ assert.expect(3);
238
+
237
239
  startAssembler();
238
240
 
239
241
  fakeRSVP.trigger('created', {
@@ -73,6 +73,8 @@ module('Ember Debug - Promise Debug', function (hooks) {
73
73
  });
74
74
 
75
75
  test('Updates are published when they happen', function (assert) {
76
+ assert.expect(8);
77
+
76
78
  EmberDebug.port.trigger('promise:getAndObservePromises');
77
79
 
78
80
  let p;
@@ -122,23 +124,23 @@ module('Ember Debug - Promise Debug', function (hooks) {
122
124
 
123
125
  await settled();
124
126
  assert.equal(name, 'promise:instrumentWithStack');
125
- assert.equal(message.instrumentWithStack, false);
127
+ assert.false(message.instrumentWithStack);
126
128
  EmberDebug.port.trigger('promise:setInstrumentWithStack', {
127
129
  instrumentWithStack: true,
128
130
  });
129
131
 
130
132
  await settled();
131
133
  assert.equal(name, 'promise:instrumentWithStack');
132
- assert.equal(message.instrumentWithStack, true);
133
- assert.equal(withStack, true, 'persisted');
134
+ assert.true(message.instrumentWithStack);
135
+ assert.true(withStack, 'persisted');
134
136
  EmberDebug.port.trigger('promise:setInstrumentWithStack', {
135
137
  instrumentWithStack: false,
136
138
  });
137
139
 
138
140
  await settled();
139
141
  assert.equal(name, 'promise:instrumentWithStack');
140
- assert.equal(message.instrumentWithStack, false);
141
- assert.equal(withStack, false, 'persisted');
142
+ assert.false(message.instrumentWithStack);
143
+ assert.false(withStack, 'persisted');
142
144
  });
143
145
 
144
146
  skip('Responds even if no promises detected', function (assert) {
@@ -48,6 +48,6 @@ module('Ember Debug - Render Debug', function (hooks) {
48
48
  EmberDebug.port.trigger('render:clear');
49
49
  await settled();
50
50
 
51
- assert.ok(profiles.length === 0, 'it has cleared the profiles');
51
+ assert.strictEqual(profiles.length, 0, 'it has cleared the profiles');
52
52
  });
53
53
  });
@@ -507,8 +507,8 @@ module('Ember Debug - View', function (hooks) {
507
507
  let tooltip = findInspectorElement('tooltip');
508
508
  let highlight = findInspectorElement('highlight');
509
509
 
510
- assert.ok(!isVisible(tooltip), 'tooltip is not visible');
511
- assert.ok(!isVisible(highlight), 'highlight is not visible');
510
+ assert.notOk(isVisible(tooltip), 'tooltip is not visible');
511
+ assert.notOk(isVisible(highlight), 'highlight is not visible');
512
512
 
513
513
  run(() => EmberDebug.port.trigger('view:inspectViews', { inspect: true }));
514
514
 
@@ -554,8 +554,8 @@ module('Ember Debug - View', function (hooks) {
554
554
 
555
555
  await triggerEvent(document.body, 'mousemove');
556
556
 
557
- assert.ok(!isVisible(tooltip), 'tooltip is not visible');
558
- assert.ok(!isVisible(highlight), 'highlight is not visible');
557
+ assert.notOk(isVisible(tooltip), 'tooltip is not visible');
558
+ assert.notOk(isVisible(highlight), 'highlight is not visible');
559
559
 
560
560
  // Pin tooltip and stop inspecting
561
561
  await click('.simple-component');
@@ -598,12 +598,12 @@ module('Ember Debug - View', function (hooks) {
598
598
  // Dismiss tooltip
599
599
  await click(this.element);
600
600
 
601
- assert.ok(!isVisible(tooltip), 'tooltip is not visible');
602
- assert.ok(!isVisible(highlight), 'highlight is not visible');
601
+ assert.notOk(isVisible(tooltip), 'tooltip is not visible');
602
+ assert.notOk(isVisible(highlight), 'highlight is not visible');
603
603
 
604
604
  await triggerEvent('.bar-inner', 'mousemove');
605
605
 
606
- assert.ok(!isVisible(tooltip), 'tooltip is not visible');
607
- assert.ok(!isVisible(highlight), 'highlight is not visible');
606
+ assert.notOk(isVisible(tooltip), 'tooltip is not visible');
607
+ assert.notOk(isVisible(highlight), 'highlight is not visible');
608
608
  });
609
609
  });