mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:03:34 +08:00
Merge pull request #5032 from xrav3nz/ux-hide-options-in-adv-search
UX: exclude irrelevant search filters for anonymous users
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { acceptance, waitFor } from "helpers/qunit-helpers";
|
||||
acceptance("Search - Full Page", {
|
||||
settings: {tagging_enabled: true},
|
||||
loggedIn: true,
|
||||
beforeEach() {
|
||||
const response = (object) => {
|
||||
return [
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||
acceptance("Search");
|
||||
|
||||
QUnit.test("search", (assert) => {
|
||||
@ -73,3 +73,49 @@ QUnit.test("Search with context", assert => {
|
||||
assert.ok(!$('.search-context input[type=checkbox]').is(":checked"));
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("Right filters are shown to anonymous users", assert => {
|
||||
visit("/search?expanded=true");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(exists('select#in option[value=first]'));
|
||||
assert.ok(exists('select#in option[value=pinned]'));
|
||||
assert.ok(exists('select#in option[value=unpinned]'));
|
||||
assert.ok(exists('select#in option[value=wiki]'));
|
||||
assert.ok(exists('select#in option[value=images]'));
|
||||
|
||||
assert.notOk(exists('select#in option[value=unseen]'));
|
||||
assert.notOk(exists('select#in option[value=posted]'));
|
||||
assert.notOk(exists('select#in option[value=watching]'));
|
||||
assert.notOk(exists('select#in option[value=tracking]'));
|
||||
assert.notOk(exists('select#in option[value=bookmarks]'));
|
||||
|
||||
assert.notOk(exists('.search-advanced-options .in-likes'));
|
||||
assert.notOk(exists('.search-advanced-options .in-private'));
|
||||
assert.notOk(exists('.search-advanced-options .in-seen'));
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("Right filters are shown to logged-in users", assert => {
|
||||
logIn();
|
||||
Discourse.reset();
|
||||
visit("/search?expanded=true");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(exists('select#in option[value=first]'));
|
||||
assert.ok(exists('select#in option[value=pinned]'));
|
||||
assert.ok(exists('select#in option[value=unpinned]'));
|
||||
assert.ok(exists('select#in option[value=wiki]'));
|
||||
assert.ok(exists('select#in option[value=images]'));
|
||||
|
||||
assert.ok(exists('select#in option[value=unseen]'));
|
||||
assert.ok(exists('select#in option[value=posted]'));
|
||||
assert.ok(exists('select#in option[value=watching]'));
|
||||
assert.ok(exists('select#in option[value=tracking]'));
|
||||
assert.ok(exists('select#in option[value=bookmarks]'));
|
||||
|
||||
assert.ok(exists('.search-advanced-options .in-likes'));
|
||||
assert.ok(exists('.search-advanced-options .in-private'));
|
||||
assert.ok(exists('.search-advanced-options .in-seen'));
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user