mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: improve mobile search
Improves usability of header search icon while user is already in full page search in mobile. Currently, hitting search icon a second time empties input and does not scroll up to show search form. This commit scrolls up to show form and sets focus on input.
This commit is contained in:
30
test/javascripts/acceptance/search-mobile-test.js.es6
Normal file
30
test/javascripts/acceptance/search-mobile-test.js.es6
Normal file
@@ -0,0 +1,30 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Search - Mobile", { mobileView: true });
|
||||
|
||||
QUnit.test("search", async assert => {
|
||||
await visit("/");
|
||||
|
||||
await click("#search-button");
|
||||
|
||||
assert.ok(
|
||||
exists("input.full-page-search"),
|
||||
"it shows the full page search form"
|
||||
);
|
||||
assert.ok(!exists(".search-results .fps-topic"), "no results by default");
|
||||
|
||||
await fillIn(".search-query", "posts");
|
||||
await click(".search-cta");
|
||||
|
||||
assert.ok(find(".fps-topic").length === 1, "has one post");
|
||||
|
||||
await $(document).scrollTop(200);
|
||||
await click("#search-button");
|
||||
|
||||
assert.equal(
|
||||
find("input.full-page-search").val(),
|
||||
"posts",
|
||||
"it does not reset input when hitting search icon again"
|
||||
);
|
||||
assert.equal($(document).scrollTop(), 0, "it scrolls back to top of document");
|
||||
});
|
||||
Reference in New Issue
Block a user