mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow scoping search to tag (#8345)
* When viewing a tag, the search widget will now show a checkbox to scope the search by tag, which will limit search results to that tag on desktop and mobile
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { translateResults } from "discourse/lib/search";
|
||||
import {
|
||||
translateResults,
|
||||
searchContextDescription
|
||||
} from "discourse/lib/search";
|
||||
|
||||
QUnit.module("lib:search");
|
||||
|
||||
@@ -31,3 +34,27 @@ QUnit.test("unescapesEmojisInBlurbs", assert => {
|
||||
assert.ok(blurb.indexOf("<img src") === 0);
|
||||
assert.ok(blurb.indexOf(":thinking:") === -1);
|
||||
});
|
||||
|
||||
QUnit.test("searchContextDescription", assert => {
|
||||
assert.equal(
|
||||
searchContextDescription("topic"),
|
||||
I18n.t("search.context.topic")
|
||||
);
|
||||
assert.equal(
|
||||
searchContextDescription("user", "silvio.dante"),
|
||||
I18n.t("search.context.user", { username: "silvio.dante" })
|
||||
);
|
||||
assert.equal(
|
||||
searchContextDescription("category", "staff"),
|
||||
I18n.t("search.context.category", { category: "staff" })
|
||||
);
|
||||
assert.equal(
|
||||
searchContextDescription("tag", "important"),
|
||||
I18n.t("search.context.tag", { tag: "important" })
|
||||
);
|
||||
assert.equal(
|
||||
searchContextDescription("private_messages"),
|
||||
I18n.t("search.context.private_messages")
|
||||
);
|
||||
assert.equal(searchContextDescription("bad_type"), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user