Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/assets/javascripts/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $(function () {
if (destroyCheckbox) {
destroyCheckbox.checked = true;
row.addClass("d-none");
row.find("input[type='text']").removeAttr("required");
Comment thread
hlfan marked this conversation as resolved.
} else {
row.remove();
}
Expand All @@ -29,7 +30,7 @@ $(function () {
});

$(".social_link_destroy input[type='checkbox']:checked").each(function () {
$(this).closest(".row").addClass("d-none");
$(this).closest(".row").addClass("d-none").find("input[type='text']").removeAttr("required");
});

renumberSocialLinks();
Expand Down
26 changes: 26 additions & 0 deletions test/system/profile_links_change_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,30 @@ class ProfileLinksChangeTest < ApplicationSystemTestCase
assert_link "example.com/d"
end
end

test "can remove invalid link after validation error and resubmit" do
user = create(:user)

sign_in_as(user)
visit user_path(user)

within_content_body do
click_on "Edit Profile Details"
click_on "Edit Links"
click_on "Add Social Link"
fill_in "Social Profile Link 1", :with => "https://example.com/valid"
click_on "Add Social Link"
click_on "Update Profile"

assert_field "Social Profile Link 2"

click_on "Remove Social Profile Link 2"

assert_no_field "Social Profile Link 2"

click_on "Update Profile"

assert_link "example.com/valid"
end
end
end