Skip to content

Commit f14289d

Browse files
committed
Use ember-test-selectors
- Use ember-test-selectors across entire app - Upgrade ember-test-selectors
1 parent 974fa28 commit f14289d

14 files changed

Lines changed: 1018 additions & 55 deletions

app/templates/components/component-tree-item.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<button
9797
class="component-tree-item__action inline-flex items-center h-full p-0 border-0 cursor-pointer bg-transparent z-10"
9898
title="Scroll into view"
99-
data-test="scroll-into-view"
99+
data-test-scroll-into-view
100100
{{on "click" @item.scrollIntoView}}
101101
>
102102
{{svg-jar "eye" width="20px" height="20px"}}

app/templates/components/deprecation-item.hbs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Ui::Disclosure as |disclosure|>
2-
<div class="deprecation-item px-3" data-test="deprecation-item">
2+
<div class="deprecation-item px-3" data-test-deprecation-item>
33
<div class="flex items-center">
44
<div
55
class="flex items-center flex-grow py-2"
@@ -12,12 +12,12 @@
1212
{{/if}}
1313

1414
<div class="w-12 flex-shrink-0 pr-2 text-right">
15-
<span class="pill" data-test="deprecation-count">
15+
<span class="pill" data-test-deprecation-count>
1616
{{@model.count}}
1717
</span>
1818
</div>
1919

20-
<span class="flex-grow font-bold" data-test="deprecation-message">
20+
<span class="flex-grow font-bold" data-test-deprecation-message>
2121
{{@model.message}}
2222
</span>
2323
</div>
@@ -26,7 +26,7 @@
2626
<button
2727
class="send-to-console send-to-console--chevron-only mr-2"
2828
title="Trace deprecations in console"
29-
data-test="full-trace-deprecations-btn"
29+
data-test-full-trace-deprecations-btn
3030
{{on "click" (fn @traceDeprecations @model)}}
3131
>
3232
{{svg-jar "send-with-chevron" width="6px" height="9px"}}
@@ -50,11 +50,11 @@
5050
{{#if (and @model.hasSourceMap disclosure.isExpanded)}}
5151
{{#each @model.sources as |single|}}
5252
<DeprecationItemSource @model={{single}} as |source|>
53-
<div class="deprecation-source pb-2" data-test="deprecation-source">
53+
<div class="deprecation-source pb-2" data-test-deprecation-source>
5454
<button
5555
class="send-to-console send-to-console--chevron-only mr-3"
5656
title="Trace deprecations in console"
57-
data-test="trace-deprecations-btn"
57+
data-test-trace-deprecations-btn
5858
{{on "click" (fn @traceSource @model source.model)}}
5959
>
6060
{{svg-jar "send-with-chevron" width="6px" height="9px"}}
@@ -65,13 +65,13 @@
6565
<a
6666
class="font-mono"
6767
href="#"
68-
data-test="deprecation-source-link"
68+
data-test-deprecation-source-link
6969
{{action @openResource source.model.map}}
7070
>
7171
{{source.url}}
7272
</a>
7373
{{else}}
74-
<span class="font-mono" data-test="deprecation-source-text">
74+
<span class="font-mono" data-test-deprecation-source-text>
7575
{{source.url}}
7676
</span>
7777
{{/if}}

app/templates/deprecations-toolbar.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
<Ui::ToolbarSearchField
2121
@value={{this.searchValue}}
22-
data-test="deprecations-search"
22+
data-test-deprecations-search
2323
/>
2424
</div>

app/templates/records.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
as |h|
77
>
88
<h.row as |r|>
9-
<r.cell data-test-table-header-column="" />
9+
<r.cell data-test-table-header-column />
1010
</h.row>
1111
</t.head>
1212
<t.body
@@ -18,10 +18,10 @@
1818
>
1919
<b.row
2020
class={{if (mod b.rowMeta.index 2) "striped"}}
21-
data-test-table-row=""
21+
data-test-table-row
2222
as |r|
2323
>
24-
<r.cell data-test-table-cell="" as |value column row|>
24+
<r.cell data-test-table-cell as |value column row|>
2525
<span class={{row.color}}>
2626
{{value}}
2727
</span>

lib/ui/addon/components/toolbar-search-field.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<button
1212
class="toolbar__icon-button toolbar__search-clear-button absolute right-0 w-auto h-auto"
1313
title="clear"
14-
data-test="search-field-clear-button"
14+
data-test-search-field-clear-button
1515
{{on "click" this.clear}}
1616
>
1717
{{svg-jar "clear" width="14px" height="14px"}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"ember-svg-jar": "^2.2.2",
8787
"ember-table": "^2.2.2",
8888
"ember-template-lint": "^1.5.0",
89-
"ember-test-selectors": "^2.1.0",
89+
"ember-test-selectors": "^4.0.0",
9090
"ember-truth-helpers": "^2.1.0",
9191
"ember-try": "^1.1.0",
9292
"ensure-posix-path": "^1.1.1",

tests/acceptance/component-tree-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module('Component Tab', function (hooks) {
198198
treeNodes = findAll('.component-tree-item');
199199
assert.equal(treeNodes.length, 0, 'expected filtered tree nodes');
200200

201-
await click('[data-test="search-field-clear-button"]');
201+
await click('[data-test-search-field-clear-button]');
202202
treeNodes = findAll('.component-tree-item');
203203
assert.equal(treeNodes.length, 4, 'expected all tree nodes');
204204
});
@@ -246,7 +246,7 @@ module('Component Tab', function (hooks) {
246246
return false;
247247
});
248248

249-
await click('[data-test="scroll-into-view"]');
249+
await click('[data-test-scroll-into-view]');
250250
});
251251

252252
test('View DOM element in Elements panel', async function (assert) {

tests/acceptance/container-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ module('Container Tab', function(outer) {
125125
rows = findAll('.js-container-instance-list-item');
126126
assert.equal(rows.length, 0, 'expected filtered rows');
127127

128-
await click('[data-test="search-field-clear-button"]');
128+
await click('[data-test-search-field-clear-button]');
129129
rows = findAll('.js-container-instance-list-item');
130130
assert.equal(rows.length, 2, 'expected all rows');
131131
});

tests/acceptance/data-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ module('Data Tab', function(outer) {
438438
rows = findAll('[data-test-table-row]');
439439
assert.equal(rows.length, 1);
440440

441-
await click('[data-test="search-field-clear-button"]');
441+
await click('[data-test-search-field-clear-button]');
442442
rows = findAll('[data-test-table-row]');
443443
assert.equal(rows.length, 2);
444444
});

tests/acceptance/deprecation-test.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { enableOpenResource, respondWith, expectOpenResource, disableDefaultResp
88
disclosure triangle, count, or message
99
*/
1010
async function toggleDeprecationSource() {
11-
await click('[data-test="deprecation-count"]');
11+
await click('[data-test-deprecation-count]');
1212
}
1313

1414
function deprecationsWithoutSource() {
@@ -77,18 +77,18 @@ module('Deprecation Tab', function(outer) {
7777

7878
await toggleDeprecationSource();
7979

80-
assert.dom('[data-test="deprecation-source"]').doesNotExist('no sources');
81-
assert.dom(findAll('[data-test="deprecation-message"]')[0]).hasText('Deprecation 1', 'message shown');
82-
assert.dom(findAll('[data-test="deprecation-count"]')[0]).hasText('2', 'Count correct');
83-
assert.dom('[data-test="full-trace-deprecations-btn"]').exists('Full trace button shown');
80+
assert.dom('[data-test-deprecation-source]').doesNotExist('no sources');
81+
assert.dom(findAll('[data-test-deprecation-message]')[0]).hasText('Deprecation 1', 'message shown');
82+
assert.dom(findAll('[data-test-deprecation-count]')[0]).hasText('2', 'Count correct');
83+
assert.dom('[data-test-full-trace-deprecations-btn]').exists('Full trace button shown');
8484

8585
respondWith('deprecation:sendStackTraces', ({ deprecation }) => {
8686
assert.equal(deprecation.message, 'Deprecation 1');
8787
assert.equal(deprecation.sources.length, 2);
8888
return false;
8989
});
9090

91-
await click('[data-test="full-trace-deprecations-btn"]');
91+
await click('[data-test-full-trace-deprecations-btn]');
9292
});
9393
});
9494

@@ -110,32 +110,32 @@ module('Deprecation Tab', function(outer) {
110110

111111
await toggleDeprecationSource();
112112

113-
assert.dom('[data-test="deprecation-message"]').hasText('Deprecation 1', 'message shown');
114-
assert.dom('[data-test="deprecation-count"]').hasText('2', 'Count correct');
115-
assert.dom('[data-test="full-trace-deprecations-btn"]').doesNotExist('Full trace button not shown');
113+
assert.dom('[data-test-deprecation-message').hasText('Deprecation 1', 'message shown');
114+
assert.dom('[data-test-deprecation-count]').hasText('2', 'Count correct');
115+
assert.dom('[data-test-full-trace-deprecations-btn]').doesNotExist('Full trace button not shown');
116116

117-
let sources = findAll('[data-test="deprecation-source"]');
117+
let sources = findAll('[data-test-deprecation-source]');
118118
assert.equal(sources.length, 2, 'shows all sources');
119-
assert.notOk(sources[0].querySelector('[data-test="deprecation-source-link"]'), 'source not clickable');
120-
assert.dom(sources[0].querySelector('[data-test="deprecation-source-text"]')).hasText('path-to-file.js:1');
121-
assert.notOk(sources[1].querySelector('[data-test="deprecation-source-link"]'), 'source not clickable');
122-
assert.dom(sources[1].querySelector('[data-test="deprecation-source-text"]')).hasText('path-to-second-file.js:2');
119+
assert.notOk(sources[0].querySelector('[data-test-deprecation-source-link]'), 'source not clickable');
120+
assert.dom(sources[0].querySelector('[data-test-deprecation-source-text]')).hasText('path-to-file.js:1');
121+
assert.notOk(sources[1].querySelector('[data-test-deprecation-source-link]'), 'source not clickable');
122+
assert.dom(sources[1].querySelector('[data-test-deprecation-source-text]')).hasText('path-to-second-file.js:2');
123123

124124
respondWith('deprecation:sendStackTraces', ({ deprecation }) => {
125125
assert.equal(deprecation.message, 'Deprecation 1');
126126
assert.equal(deprecation.sources.length, 1);
127127
return false;
128128
});
129129

130-
await click(sources[0].querySelector('[data-test="trace-deprecations-btn"]'));
130+
await click(sources[0].querySelector('[data-test-trace-deprecations-btn]'));
131131

132132
respondWith('deprecation:sendStackTraces', ({ deprecation }) => {
133133
assert.equal(deprecation.message, 'Deprecation 1');
134134
assert.equal(deprecation.sources.length, 1);
135135
return false;
136136
});
137137

138-
await click(sources[1].querySelector('[data-test="trace-deprecations-btn"]'));
138+
await click(sources[1].querySelector('[data-test-trace-deprecations-btn]'));
139139
});
140140

141141
test("With source map, source found, can open resource", async function(assert) {
@@ -145,41 +145,41 @@ module('Deprecation Tab', function(outer) {
145145

146146
await toggleDeprecationSource();
147147

148-
assert.dom('[data-test="deprecation-message"]').hasText('Deprecation 1', 'message shown');
149-
assert.dom('[data-test="deprecation-count"]').hasText('2', 'Count correct');
150-
assert.dom('[data-test="full-trace-deprecations-btn"]').doesNotExist('Full trace button not shown');
148+
assert.dom('[data-test-deprecation-message]').hasText('Deprecation 1', 'message shown');
149+
assert.dom('[data-test-deprecation-count]').hasText('2', 'Count correct');
150+
assert.dom('[data-test-full-trace-deprecations-btn]').doesNotExist('Full trace button not shown');
151151

152-
let sources = findAll('[data-test="deprecation-source"]');
152+
let sources = findAll('[data-test-deprecation-source]');
153153
assert.equal(sources.length, 2, 'shows all sources');
154-
assert.notOk(sources[0].querySelector('[data-test="deprecation-source-text"]'), 'source clickable');
155-
assert.dom(sources[0].querySelector('[data-test="deprecation-source-link"]')).hasText('path-to-file.js:1');
156-
assert.notOk(sources[1].querySelector('[data-test="deprecation-source-text"]'), 'source clickable');
157-
assert.dom(sources[1].querySelector('[data-test="deprecation-source-link"]')).hasText('path-to-second-file.js:2');
154+
assert.notOk(sources[0].querySelector('[data-test-deprecation-source-text]'), 'source clickable');
155+
assert.dom(sources[0].querySelector('[data-test-deprecation-source-link]')).hasText('path-to-file.js:1');
156+
assert.notOk(sources[1].querySelector('[data-test-deprecation-source-text]'), 'source clickable');
157+
assert.dom(sources[1].querySelector('[data-test-deprecation-source-link]')).hasText('path-to-second-file.js:2');
158158

159159
expectOpenResource('http://path-to-file.js', 1);
160160

161-
await click(sources[0].querySelector('[data-test="deprecation-source-link"]'));
161+
await click(sources[0].querySelector('[data-test-deprecation-source-link]'));
162162

163163
expectOpenResource('http://path-to-second-file.js', 2);
164164

165-
await click(sources[1].querySelector('[data-test="deprecation-source-link"]'));
165+
await click(sources[1].querySelector('[data-test-deprecation-source-link]'));
166166
});
167167

168168
test("It should clear the search filter when the clear button is clicked", async function(assert) {
169169
await visit('/deprecations');
170170

171171
await toggleDeprecationSource();
172172

173-
let sources = findAll('[data-test="deprecation-source"]');
173+
let sources = findAll('[data-test-deprecation-source]');
174174
assert.equal(sources.length, 2, 'shows all sources');
175175

176-
await fillIn('[data-test="deprecations-search"] input', 'xxxx');
177-
sources = findAll('[data-test="deprecation-source"]');
176+
await fillIn('[data-test-deprecations-search] input', 'xxxx');
177+
sources = findAll('[data-test-deprecation-source]');
178178
assert.equal(sources.length, 0, 'sources filtered');
179179

180-
await click('[data-test="search-field-clear-button"]');
181-
await click('[data-test="deprecation-item"] .disclosure-triangle');
182-
sources = findAll('[data-test="deprecation-source"]');
180+
await click('[data-test-search-field-clear-button]');
181+
await click('[data-test-deprecation-item] .disclosure-triangle');
182+
sources = findAll('[data-test-deprecation-source]');
183183
assert.equal(sources.length, 2, 'show all sources');
184184
});
185185
});

0 commit comments

Comments
 (0)