Skip to content

Commit 6b71be0

Browse files
committed
test: add case for data-slash=false
== npm test == ``` File | % Stmts | % Branch | % Funcs | % Lines | ----------------------|---------|----------|---------|---------| before | 94.28 | 84.28 | 90.47 | 95.78 | after | 94.28 | 85.71 | 90.47 | 95.78 | ```
1 parent bfd89aa commit 6b71be0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,19 @@ QUnit.module('typesense-minibar', hooks => {
469469
);
470470
});
471471

472+
QUnit.test('focus [data-slash=false]', async assert => {
473+
const form = parseHTML('<form data-slash="false"><input type="search"></form>');
474+
document.body.append(form);
475+
assert.false(form.contains(document.activeElement || null), 'initial focus');
476+
477+
bar = tsminibar(form);
478+
assert.false(form.contains(document.activeElement || null), 'focus after contruct');
479+
480+
// should be ignored when data-slash=false
481+
simulate(document, 'keydown', {}, { key: '/' });
482+
assert.false(form.contains(document.activeElement || null), 'focus after slash');
483+
});
484+
472485
QUnit.test('focus [slash]', async assert => {
473486
const form = parseHTML('<form><input type="search"></form>');
474487
const input = form.firstChild;

0 commit comments

Comments
 (0)