mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Actually focus stuff in tests (#16102)
PSA: `focus("selector")` does not focus elements. It "makes a request to bring the window to the front."
This commit is contained in:
parent
fc30669db2
commit
3918e5b74a
@ -133,7 +133,7 @@ acceptance("Search - Anonymous", function (needs) {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(firstResult).textContent.trim(),
|
query(firstResult).textContent.trim(),
|
||||||
`${I18n.t("search.in")} test`,
|
`${I18n.t("search.in")} test`,
|
||||||
"contenxtual tag search is first available option with no term"
|
"contextual tag search is first available option with no term"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn("#search-term", "smth");
|
await fillIn("#search-term", "smth");
|
||||||
@ -190,11 +190,11 @@ acceptance("Search - Anonymous", function (needs) {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(firstResult).textContent.trim(),
|
query(firstResult).textContent.trim(),
|
||||||
I18n.t("search.in_this_topic"),
|
I18n.t("search.in_this_topic"),
|
||||||
"contenxtual topic search is first available option"
|
"contextual topic search is first available option"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn("#search-term", "a proper");
|
await fillIn("#search-term", "a proper");
|
||||||
await focus("input#search-term");
|
await query("input#search-term").focus();
|
||||||
await triggerKeyEvent(".search-menu", "keydown", 40);
|
await triggerKeyEvent(".search-menu", "keydown", 40);
|
||||||
|
|
||||||
await click(document.activeElement);
|
await click(document.activeElement);
|
||||||
@ -224,7 +224,7 @@ acceptance("Search - Anonymous", function (needs) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await fillIn("#search-term", "dev");
|
await fillIn("#search-term", "dev");
|
||||||
await focus("input#search-term");
|
await query("input#search-term").focus();
|
||||||
await triggerKeyEvent(".search-menu", "keydown", 40);
|
await triggerKeyEvent(".search-menu", "keydown", 40);
|
||||||
await click(document.activeElement);
|
await click(document.activeElement);
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ acceptance("Search - Anonymous", function (needs) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await fillIn("#search-term", "");
|
await fillIn("#search-term", "");
|
||||||
await focus("input#search-term");
|
await query("input#search-term").focus();
|
||||||
await triggerKeyEvent("input#search-term", "keydown", 8); // backspace
|
await triggerKeyEvent("input#search-term", "keydown", 8); // backspace
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
@ -254,11 +254,11 @@ acceptance("Search - Anonymous", function (needs) {
|
|||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(firstResult).textContent.trim(),
|
query(firstResult).textContent.trim(),
|
||||||
I18n.t("search.in_this_topic"),
|
I18n.t("search.in_this_topic"),
|
||||||
"contenxtual topic search is first available option"
|
"contextual topic search is first available option"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn("#search-term", "proper");
|
await fillIn("#search-term", "proper");
|
||||||
await focus("input#search-term");
|
await query("input#search-term").focus();
|
||||||
await triggerKeyEvent(".search-menu", "keydown", 40);
|
await triggerKeyEvent(".search-menu", "keydown", 40);
|
||||||
await click(document.activeElement);
|
await click(document.activeElement);
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ acceptance("Search - Authenticated", function (needs) {
|
|||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#search-button");
|
await click("#search-button");
|
||||||
await fillIn("#search-term", "plans");
|
await fillIn("#search-term", "plans");
|
||||||
await focus("input#search-term");
|
await query("input#search-term").focus();
|
||||||
await triggerKeyEvent(".search-menu", "keydown", 40);
|
await triggerKeyEvent(".search-menu", "keydown", 40);
|
||||||
await click(document.activeElement);
|
await click(document.activeElement);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user