Fix #5194: AND/OR no longer trigger autocomplete.
Also change the /autocomplete.json API to no longer strip '-' and '~' from the start of the tag. This may be a breaking change if third-party scripts relied on this behavior.
This commit is contained in:
@@ -16,6 +16,8 @@ class AutocompleteControllerTest < ActionDispatch::IntegrationTest
|
||||
context "index action" do
|
||||
setup do
|
||||
create(:tag, name: "azur_lane")
|
||||
create(:tag, name: "android")
|
||||
create(:tag, name: "original")
|
||||
end
|
||||
|
||||
should "work for opensearch queries" do
|
||||
@@ -27,8 +29,6 @@ class AutocompleteControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
should "work for tag queries" do
|
||||
assert_autocomplete_equals(["azur_lane"], "azur", "tag_query")
|
||||
assert_autocomplete_equals(["azur_lane"], "-azur", "tag_query")
|
||||
assert_autocomplete_equals(["azur_lane"], "~azur", "tag_query")
|
||||
assert_autocomplete_equals(["azur_lane"], "AZUR", "tag_query")
|
||||
|
||||
assert_autocomplete_equals(["rating:sensitive"], "rating:s", "tag_query")
|
||||
@@ -42,6 +42,11 @@ class AutocompleteControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal([], response.parsed_body)
|
||||
end
|
||||
|
||||
should "work for the AND and OR keywords" do
|
||||
assert_autocomplete_equals(["android"], "and", "tag_query")
|
||||
assert_autocomplete_equals(["original"], "or", "tag_query")
|
||||
end
|
||||
|
||||
should "not set session cookies when the response is publicly cached" do
|
||||
get autocomplete_index_path(search: { query: "azur", type: "tag_query" }), as: :json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user