Fix #5211: Using tab to autocomplete tags in tag implication/alias search adds a space making it return no results.

Fix the alias and implication search forms not normalizing tags before search.
This commit is contained in:
evazion
2022-08-24 21:59:55 -05:00
parent 3f10eeb954
commit 28ee901192
4 changed files with 24 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ class TagAliasesControllerTest < ActionDispatch::IntegrationTest
@consequent_wiki = create(:wiki_page, title: "touhou_project")
@other_alias = create(:tag_alias, antecedent_name: "touhou", consequent_name: "touhou_project", creator: @user, status: "deleted", forum_topic: @forum_topic, forum_post: @forum_post)
@unrelated_alias = create(:tag_alias)
@unrelated_alias = create(:tag_alias, antecedent_name: "yellow_hair", consequent_name: "blonde_hair")
end
should "render" do
@@ -31,6 +31,8 @@ class TagAliasesControllerTest < ActionDispatch::IntegrationTest
should respond_to_search(antecedent_name: "aaa").with { @tag_alias }
should respond_to_search(consequent_name: "bbb").with { @tag_alias }
should respond_to_search(status: "deleted").with { @other_alias }
should respond_to_search(antecedent_name_matches: " YELLOW HAIR ").with { @unrelated_alias }
should respond_to_search(consequent_name_matches: " blonde hair ").with { @unrelated_alias }
context "using includes" do
should respond_to_search(antecedent_tag: {post_count: 1000}).with { @other_alias }

View File

@@ -19,7 +19,7 @@ class TagImplicationsControllerTest < ActionDispatch::IntegrationTest
@consequent_wiki = create(:wiki_page, title: "weapon")
@other_implication = create(:tag_implication, antecedent_name: "cannon", consequent_name: "weapon", creator: @user, status: "deleted", forum_topic: @forum_topic, forum_post: @forum_post)
@unrelated_implication = create(:tag_implication)
@unrelated_implication = create(:tag_implication, antecedent_name: "cat_ears", consequent_name: "animal_ears")
end
should "render" do
@@ -31,6 +31,8 @@ class TagImplicationsControllerTest < ActionDispatch::IntegrationTest
should respond_to_search(antecedent_name: "aaa").with { @tag_implication }
should respond_to_search(consequent_name: "bbb").with { @tag_implication }
should respond_to_search(status: "deleted").with { @other_implication }
should respond_to_search(antecedent_name_matches: " CAT EARS ").with { @unrelated_implication }
should respond_to_search(consequent_name_matches: " animal ears ").with { @unrelated_implication }
context "using includes" do
should respond_to_search(antecedent_tag: {post_count: 10}).with { @other_implication }