a628e2969a
* variables.new initialized * Hacky but savey * Variable wildcard route and multiple creatable at a time * multiple KVs per variable * PR Prep cleanup and lintfix * Delog * Data mocking in mirage for variables * Linting fixes * Re-implement absent params * Adapter and model tests * Moves the path-as-id logic to a serializer instead of adapter * Classic to serializer and lint cleanup * Pluralized save button (#13140) * Autofocus modifier and better Add More button UX (#13145) * Secure Variables: show/hide functionality when adding new values (#13137) * Flight Icons added and show hide functionality * PR cleanup * Linting cleanup * Position of icon moved to the right of input * PR feedback addressed * Delete button and stylistic changes to show hide * Hmm, eslint doesnt like jsdoc-usage as only reason for import * More closely match the button styles and delete test * Simplified new.js model * Secure Variables: /variables/*path/edit route and functionality (#13170) * Variable edit page init * Significant change to where we house model methods * Lintfix * Edit a variable tests * Remove redundant tests * Asserts expected * Mirage factory updated to reflect model state
69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
|
|
module('Integration | Modifier | autofocus', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('Basic Usage', async function (assert) {
|
|
await render(hbs`
|
|
<form>
|
|
<label>
|
|
<input data-test-input-1 {{autofocus}} />
|
|
</label>
|
|
</form>`);
|
|
|
|
assert
|
|
.dom('[data-test-input-1]')
|
|
.isFocused('Autofocus on an element works');
|
|
});
|
|
|
|
test('Multiple foci', async function (assert) {
|
|
await render(hbs`
|
|
<form>
|
|
<label>
|
|
<input data-test-input-1 {{autofocus}} />
|
|
</label>
|
|
<label>
|
|
<input data-test-input-2 {{autofocus}} />
|
|
</label>
|
|
</form>`);
|
|
|
|
assert
|
|
.dom('[data-test-input-1]')
|
|
.isNotFocused('With multiple autofocus elements, priors are unfocused');
|
|
assert
|
|
.dom('[data-test-input-2]')
|
|
.isFocused('With multiple autofocus elements, posteriors are focused');
|
|
});
|
|
|
|
test('Ignore parameter', async function (assert) {
|
|
await render(hbs`
|
|
<form>
|
|
<label>
|
|
<input data-test-input-1 {{autofocus}} />
|
|
</label>
|
|
<label>
|
|
<input data-test-input-2 {{autofocus}} />
|
|
</label>
|
|
<label>
|
|
<input data-test-input-3 {{autofocus ignore=true}} />
|
|
</label>
|
|
<label>
|
|
<input data-test-input-4 {{autofocus ignore=true}} />
|
|
</label>
|
|
</form>`);
|
|
|
|
assert
|
|
.dom('[data-test-input-2]')
|
|
.isFocused('The last autofocus element without ignore is focused');
|
|
assert
|
|
.dom('[data-test-input-3]')
|
|
.isNotFocused('Ignore parameter is observed, prior');
|
|
assert
|
|
.dom('[data-test-input-4]')
|
|
.isNotFocused('Ignore parameter is observed, posterior');
|
|
});
|
|
});
|