You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/autofocus/_config.js

37 lines
1004 B

export default {
html: '',
test({ assert, component, target, window }) {
component.active = 'default';
assert.equal(target.querySelector('input[title="default"]'), window.document.activeElement);
component.active = 'dynamic-false';
assert.notEqual(
target.querySelector('input[title="dynamic-false"]'),
window.document.activeElement
);
// when dynamically set autofocus to true, don't autofocus
component.autofocusFalse = true;
assert.notEqual(
target.querySelector('input[title="dynamic-false"]'),
window.document.activeElement
);
component.active = 'dynamic-true';
assert.equal(
target.querySelector('input[title="dynamic-true"]'),
window.document.activeElement
);
component.active = 'spread';
assert.equal(target.querySelector('input[title="spread"]'), window.document.activeElement);
component.active = 'spread-override';
assert.notEqual(
target.querySelector('input[title="spread-override"]'),
window.document.activeElement
);
}
};