|
1 | 1 | import { render } from '@ember/test-helpers'; |
2 | 2 | import { setupRenderingTest } from 'ember-qunit'; |
3 | 3 | import { module, test } from 'qunit'; |
4 | | -import { gte } from 'ember-compatibility-helpers'; |
5 | 4 |
|
6 | 5 | import Component from '@glimmer/component'; |
7 | 6 | import { tracked } from '@glimmer/tracking'; |
@@ -205,41 +204,39 @@ module('Integration | Modifier | autofocus', function (hooks) { |
205 | 204 | .isNotFocused('The third non related input are not focused'); |
206 | 205 | }); |
207 | 206 |
|
208 | | - if (gte('3.16.0')) { |
209 | | - test('should not cause rerender assertions on Glimmer components when a focus modifier is present', async function (assert) { |
210 | | - class FooButtonComponent extends Component { |
211 | | - @tracked bar; |
| 207 | + test('should not cause rerender assertions on Glimmer components when a focus modifier is present', async function (assert) { |
| 208 | + class FooButtonComponent extends Component { |
| 209 | + @tracked bar; |
212 | 210 |
|
213 | | - @action |
214 | | - updateBar() { |
215 | | - this.bar = !this.bar; |
216 | | - } |
| 211 | + @action |
| 212 | + updateBar() { |
| 213 | + this.bar = !this.bar; |
217 | 214 | } |
218 | | - setComponentTemplate( |
219 | | - hbs` |
220 | | - <button |
221 | | - {{on "focus" this.updateBar}} |
222 | | - ...attributes |
223 | | - > |
224 | | - Foo: {{this.bar}} |
225 | | - </button> |
226 | | - `, |
227 | | - FooButtonComponent |
228 | | - ); |
229 | | - this.owner.register('component:foo-button', FooButtonComponent); |
230 | | - |
231 | | - await render(hbs` |
232 | | - <div {{autofocus "input,button"}}> |
233 | | - <span>this is not a focusable element</span> |
234 | | - <FooButton data-test-foo/> |
235 | | - <input data-test-input-1 /> |
236 | | - </div> |
237 | | - `); |
238 | | - |
239 | | - assert.dom('[data-test-foo]').isFocused('The button element is focused'); |
240 | | - assert |
241 | | - .dom('[data-test-input-1]') |
242 | | - .isNotFocused('The first non related input is not focused'); |
243 | | - }); |
244 | | - } |
| 215 | + } |
| 216 | + setComponentTemplate( |
| 217 | + hbs` |
| 218 | + <button |
| 219 | + {{on "focus" this.updateBar}} |
| 220 | + ...attributes |
| 221 | + > |
| 222 | + Foo: {{this.bar}} |
| 223 | + </button> |
| 224 | + `, |
| 225 | + FooButtonComponent |
| 226 | + ); |
| 227 | + this.owner.register('component:foo-button', FooButtonComponent); |
| 228 | + |
| 229 | + await render(hbs` |
| 230 | + <div {{autofocus "input,button"}}> |
| 231 | + <span>this is not a focusable element</span> |
| 232 | + <FooButton data-test-foo/> |
| 233 | + <input data-test-input-1 /> |
| 234 | + </div> |
| 235 | + `); |
| 236 | + |
| 237 | + assert.dom('[data-test-foo]').isFocused('The button element is focused'); |
| 238 | + assert |
| 239 | + .dom('[data-test-input-1]') |
| 240 | + .isNotFocused('The first non related input is not focused'); |
| 241 | + }); |
245 | 242 | }); |
0 commit comments