decide.nolog.cz/tests/integration/components/autofocusable-element-test.js
Jeldrik Hanschke 174b6d493c refactor create/settings to avoid observer
This also fix a bug if user creates more than one croodle without reloading window
in between. In that case a data fragment is reused which throws.

It's also the first step in dropping {{simple-select}} which is very outdated.
2018-12-31 12:09:17 +01:00

28 lines
848 B
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | autofocusable-element', function(hooks) {
setupRenderingTest(hooks);
test('it supports block mode', async function(assert) {
await render(hbs`
{{#autofocusable-element}}
template block text
{{/autofocusable-element}}
`);
assert.equal(this.element.textContent.trim(), 'template block text');
});
test('it focus element', async function(assert) {
await render(hbs`
{{#autofocusable-element tagName='input' autofocus=true}}
template block text
{{/autofocusable-element}}
`);
assert.ok(this.element.querySelector('input') === document.activeElement);
});
});