Revert "Replace House with Lexical"
This commit is contained in:
@@ -17,11 +17,11 @@ class Cards::CommentsControllerTest < ActionDispatch::IntegrationTest
|
||||
put card_comment_path(cards(:logo), comments(:logo_agreement_kevin)), params: { comment: { body: "I've changed my mind" } }
|
||||
|
||||
assert_response :success
|
||||
assert_action_text "I've changed my mind", comments(:logo_agreement_kevin).reload.body
|
||||
assert_equal "I've changed my mind", comments(:logo_agreement_kevin).reload.body.content
|
||||
end
|
||||
|
||||
test "update another user's comment" do
|
||||
assert_no_changes -> { comments(:logo_agreement_jz).reload.body.to_s } do
|
||||
assert_no_changes "comments(:logo_agreement_jz).body.content" do
|
||||
put card_comment_path(cards(:logo), comments(:logo_agreement_jz)), params: { comment: { body: "I've changed my mind" } }
|
||||
end
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal "moon.jpg", card.image.filename.to_s
|
||||
assert_equal [ tags(:mobile) ], card.tags
|
||||
|
||||
assert_equal "Something more in-depth", card.description.to_plain_text.strip
|
||||
assert_equal "Something more in-depth", card.description_plain_text.strip
|
||||
end
|
||||
|
||||
test "users can only see cards in collections they have access to" do
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
require "test_helper"
|
||||
|
||||
class UploadsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "create" do
|
||||
assert_changes -> { ActiveStorage::Attachment.count }, 1 do
|
||||
post uploads_path(format: "json"), params: { file: fixture_file_upload("moon.jpg", "image/jpeg") }, as: :xhr
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_equal ActiveStorage::Attachment.last.slug_url(host: "#{ApplicationRecord.current_tenant}.example.com", port: nil), response.parsed_body["fileUrl"]
|
||||
assert_equal "image/jpeg", response.parsed_body["mimetype"]
|
||||
assert_equal "moon.jpg", response.parsed_body["fileName"]
|
||||
end
|
||||
|
||||
test "show" do
|
||||
accounts("37s").uploads.attach fixture_file_upload("moon.jpg", "image/jpeg")
|
||||
get upload_path(slug: accounts("37s").uploads.last.slug)
|
||||
assert_response :redirect
|
||||
assert_match /\/rails\/active_storage\/.*\/moon\.jpg/, @response.redirect_url
|
||||
end
|
||||
end
|
||||
+3
-5
@@ -1,16 +1,14 @@
|
||||
logo_agreement_jz:
|
||||
record: logo_agreement_jz (Comment)
|
||||
name: body
|
||||
body: I agree.
|
||||
content: I agree.
|
||||
|
||||
logo_agreement_kevin:
|
||||
record: logo_agreement_kevin (Comment)
|
||||
name: body
|
||||
body: Same, let’s do it.
|
||||
content: Same, let’s do it.
|
||||
|
||||
layout_overflowing_david:
|
||||
record: layout_overflowing_david (Comment)
|
||||
name: body
|
||||
body: The text is overflowing the container.
|
||||
|
||||
|
||||
content: The text is overflowing the container.
|
||||
+1
-1
@@ -22,7 +22,7 @@ module ActiveSupport
|
||||
fixtures :all
|
||||
|
||||
include ActiveJob::TestHelper
|
||||
include ActionTextTestHelper, CardTestHelper, ChangeTestHelper, SessionTestHelper
|
||||
include CardTestHelper, ChangeTestHelper, SessionTestHelper
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
module ActionTextTestHelper
|
||||
def assert_action_text(expected_html, content)
|
||||
assert_equal_html <<~HTML, content.to_s
|
||||
<div class="action-text-content">#{expected_html}</action-text-content>
|
||||
HTML
|
||||
end
|
||||
|
||||
def assert_equal_html(expected, actual)
|
||||
assert_equal normalize_html(expected), normalize_html(actual)
|
||||
end
|
||||
|
||||
def normalize_html(html)
|
||||
Nokogiri::HTML.fragment(html).tap do |fragment|
|
||||
fragment.traverse do |node|
|
||||
if node.text?
|
||||
node.content = node.text.squish
|
||||
end
|
||||
end
|
||||
end.to_html.strip
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user