This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js
Penar Musaraj dfeca42bf8
FEATURE: user/category/tag results in full page search (#14346)
See PR for details, this commit also changes the layout of the full page search.
2021-09-20 10:01:11 -04:00

52 lines
1.2 KiB
JavaScript

import {
acceptance,
count,
exists,
queryAll,
visible,
} from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
acceptance("Search - Mobile", function (needs) {
needs.mobileView();
test("search", async function (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 click(".advanced-filters summary");
assert.ok(
visible(".search-advanced-filters"),
"it should expand advanced search filters"
);
await fillIn(".search-query", "discourse");
await click(".search-cta");
assert.equal(count(".fps-topic"), 1, "has one post");
assert.ok(
!visible(".search-advanced-filters"),
"it should collapse advanced search filters"
);
await click("#search-button");
assert.equal(
queryAll("input.full-page-search").val(),
"discourse",
"it does not reset input when hitting search icon again"
);
});
});