mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
Previously, assignment permissions only came from the global `assign_allowed_on_groups` site setting. This change lets categories grant assignment permission to additional groups, keeping assignment controls and assignee suggestions scoped to the relevant category.
86 lines
2.4 KiB
JavaScript
Vendored
86 lines
2.4 KiB
JavaScript
Vendored
import { click, fillIn, visit } from "@ember/test-helpers";
|
|
import { test } from "qunit";
|
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
|
|
|
acceptance("Search - Full Page", function (needs) {
|
|
needs.settings({ assign_enabled: true });
|
|
needs.user({ can_assign: true, can_assign_globally: true });
|
|
needs.pretender((server, helper) => {
|
|
server.get("/u/search/users", () => {
|
|
return helper.response({
|
|
users: [
|
|
{
|
|
username: "admin",
|
|
name: "admin",
|
|
avatar_template: "/images/avatar.png",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|
|
|
|
test("update in:assigned filter through advanced search ui", async function (assert) {
|
|
const inSelector = selectKit(
|
|
".search-advanced-options .select-kit#search-in-options"
|
|
);
|
|
|
|
await visit("/search");
|
|
await click(".advanced-filters__toggle");
|
|
|
|
await fillIn(".search-query", "none");
|
|
await inSelector.expand();
|
|
await inSelector.selectRowByValue("assigned");
|
|
assert
|
|
.dom(".search-query")
|
|
.hasValue(
|
|
"none in:assigned",
|
|
'has updated search term to "none in:assigned"'
|
|
);
|
|
});
|
|
|
|
test("update in:unassigned filter through advanced search ui", async function (assert) {
|
|
const inSelector = selectKit(
|
|
".search-advanced-options .select-kit#search-in-options"
|
|
);
|
|
|
|
await visit("/search");
|
|
await click(".advanced-filters__toggle");
|
|
|
|
await fillIn(".search-query", "none");
|
|
await inSelector.expand();
|
|
await inSelector.selectRowByValue("unassigned");
|
|
assert
|
|
.dom(".search-query")
|
|
.hasValue(
|
|
"none in:unassigned",
|
|
'has updated search term to "none in:unassigned"'
|
|
);
|
|
});
|
|
|
|
test("update assigned to through advanced search ui", async function (assert) {
|
|
const assignedField = selectKit(".assigned-advanced-search .select-kit");
|
|
|
|
await visit("/search");
|
|
await click(".advanced-filters__toggle");
|
|
|
|
await fillIn(".search-query", "none");
|
|
await assignedField.expand();
|
|
|
|
await assignedField.fillInFilter("admin");
|
|
await assignedField.selectRowByValue("admin");
|
|
|
|
assert.strictEqual(
|
|
assignedField.header().value(),
|
|
"admin",
|
|
'has "admin" filled in'
|
|
);
|
|
|
|
assert
|
|
.dom(".search-query")
|
|
.hasValue(
|
|
"none assigned:admin",
|
|
'has updated search term to "none assigned:admin"'
|
|
);
|
|
});
|
|
});
|