FIX: Keep category name in URL when filtering (#10317)

This commit is contained in:
Bianca Nenciu 2020-07-29 14:57:05 +03:00 committed by GitHub
parent d2380a01b6
commit fd02856f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -105,7 +105,7 @@ export default Controller.extend({
if (this._skipBounce) { if (this._skipBounce) {
this.set("_skipBounce", false); this.set("_skipBounce", false);
} else { } else {
this.filterContentNow(); this.filterContentNow(this.categoryNameKey);
} }
}, INPUT_DELAY), }, INPUT_DELAY),

View File

@ -10,7 +10,7 @@ acceptance("Admin - Site Settings", {
}, },
pretend(server, helper) { pretend(server, helper) {
server.put("/admin/site_settings/title", (body) => { server.put("/admin/site_settings/title", body => {
titleOverride = body.requestBody.split("=")[1]; titleOverride = body.requestBody.split("=")[1];
return helper.response({ success: "OK" }); return helper.response({ success: "OK" });
}); });
@ -22,14 +22,14 @@ acceptance("Admin - Site Settings", {
titleSetting.value = titleOverride; titleSetting.value = titleOverride;
} }
const response = { const response = {
site_settings: [titleSetting, ...fixtures.slice(1)], site_settings: [titleSetting, ...fixtures.slice(1)]
}; };
return helper.response(response); return helper.response(response);
}); });
}, }
}); });
QUnit.test("upload site setting", async (assert) => { QUnit.test("upload site setting", async assert => {
await visit("/admin/site_settings"); await visit("/admin/site_settings");
assert.ok( assert.ok(
@ -40,7 +40,7 @@ QUnit.test("upload site setting", async (assert) => {
assert.ok(exists(".row.setting.upload .undo"), "undo button is present"); assert.ok(exists(".row.setting.upload .undo"), "undo button is present");
}); });
QUnit.test("changing value updates dirty state", async (assert) => { QUnit.test("changing value updates dirty state", async assert => {
await visit("/admin/site_settings"); await visit("/admin/site_settings");
await fillIn("#setting-filter", " title "); await fillIn("#setting-filter", " title ");
assert.equal(count(".row.setting"), 1, "filter returns 1 site setting"); assert.equal(count(".row.setting"), 1, "filter returns 1 site setting");
@ -89,7 +89,7 @@ QUnit.test("changing value updates dirty state", async (assert) => {
QUnit.test( QUnit.test(
"always shows filtered site settings if a filter is set", "always shows filtered site settings if a filter is set",
async (assert) => { async assert => {
await visit("/admin/site_settings"); await visit("/admin/site_settings");
await fillIn("#setting-filter", "title"); await fillIn("#setting-filter", "title");
assert.equal(count(".row.setting"), 1); assert.equal(count(".row.setting"), 1);
@ -104,7 +104,7 @@ QUnit.test(
} }
); );
QUnit.test("filter settings by plugin name", async (assert) => { QUnit.test("filter settings by plugin name", async assert => {
await visit("/admin/site_settings"); await visit("/admin/site_settings");
await fillIn("#setting-filter", "plugin:discourse-logo"); await fillIn("#setting-filter", "plugin:discourse-logo");
@ -114,3 +114,8 @@ QUnit.test("filter settings by plugin name", async (assert) => {
await fillIn("#setting-filter", "plugin:discourse-plugin"); await fillIn("#setting-filter", "plugin:discourse-plugin");
assert.equal(count(".row.setting"), 0); assert.equal(count(".row.setting"), 0);
}); });
QUnit.test("category name is preserved", async assert => {
await visit("admin/site_settings/category/login?filter=test");
assert.equal(currentURL(), "admin/site_settings/category/login?filter=test");
});