Fix #4178: add ability to mass undo tag edits.

Adds checkboxes to the /post_versions index allowing you to select and
undo multiple versions at once.
This commit is contained in:
evazion
2019-09-27 20:26:39 -05:00
parent 9000bc5cc6
commit d29bbbbd71
11 changed files with 150 additions and 34 deletions

View File

@@ -0,0 +1,33 @@
require "application_system_test_case"
class PostVersionTest < ApplicationSystemTestCase
context "Post versions" do
setup do
@user = create(:builder_user)
as @user do
@post = create(:post, tag_string: "tagme")
travel 2.hours
@post.update!(tag_string: "touhou")
travel 2.hours
@post.update!(tag_string: "touhou bkub")
travel 2.hours
end
signin @user
visit post_versions_path
end
context "clicking the undo selected button" do
should "undo all selected post versions" do
check id: "post-version-select-all-checkbox"
assert all("td .post-version-select-checkbox:not(:disabled)").all?(&:checked?)
click_link "subnav-undo-selected-link"
assert_selector "#notice span.prose", text: "2/2 changes undone."
assert_equal("tagme", @post.reload.tag_string)
end
end
end
end

View File

@@ -6,4 +6,11 @@ module SystemTestHelper
fill_in "Password confirmation", with: password
click_button "Sign up"
end
def signin(user)
visit new_session_path
fill_in "Name", with: user.name
fill_in "Password", with: user.password
click_button "Submit"
end
end