diff --git a/test/fixtures/.keep b/test/fixtures/.keep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/test/fixtures/communication/website/post.yml b/test/fixtures/communication/website/post.yml new file mode 100644 index 0000000000000000000000000000000000000000..0c08b41e69420d512b4c98f410d201cc8bf91619 --- /dev/null +++ b/test/fixtures/communication/website/post.yml @@ -0,0 +1,7 @@ +test: + university: test + website: test + title: Test + slug: test + text_new: > + <action-text-attachment sgid="sgid" content-type="image/jpeg" url="http://localhost:3000/dan-gold.jpeg" filename="test.jpg" filesize="352931" width="588" height="746" previewable="true" presentation="gallery"></action-text-attachment> diff --git a/test/models/summernote_test.rb b/test/models/summernote_test.rb index 2079616b63414b92783928bbd1c1eb84315d2d59..e60cf826899d9e90109274f064418fed0ea4c2cd 100644 --- a/test/models/summernote_test.rb +++ b/test/models/summernote_test.rb @@ -1,22 +1,18 @@ require "test_helper" class SummernoteTest < ActiveSupport::TestCase - test "dehydrate" do - post = Communication::Website::Post.new university: university(:test), - website: communication_website(:test), - title: 'test', - slug: 'test' - post.text_new = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"> - <figure class=\"attachment attachment--preview attachment--jpg\"> - <picture> - <source srcset=\"/rails/active_storage/representations/redirect/eyJfcmFpbHMiOns...watchingwindows_com_08.jpg 100w, /rails/active_storage/representations/redirect/eyJfcmFpbHMiOns...watchingwindows_com_08.jpg 200w\" type=\"image/webp\"> - <source srcset=\"/rails/active_storage/representations/redirect/eyJfcmFpbHMiOns...watchingwindows_com_08.jpg 100w, /rails/active_storage/representations/redirect/eyJfcmFpbHMiOns...watchingwindows_com_08.jpg\" type=\"image/jpeg\"> - <img src=\"/rails/active_storage/representations/redirect/eyJfcmFpbHMiOns...watchingwindows_com_08.jpg\" loading=\"lazy\" decoding=\"async\" width=\"800\"> - </picture> - </figure> - </action-text-attachment>" + HTML_HYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"><figure class=\"attachment attachment--preview\">\n <img width=\"588\" height=\"746\" src=\"http://localhost:3000/dan-gold.jpeg\">\n</figure></action-text-attachment>\n" + HTML_DEHYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"></action-text-attachment>" + + test "dehydrate actiontext" do + post = communication_website_post(:test) + post.text_new = HTML_HYDRATED post.save post.reload - assert_equal "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"></action-text-attachment>", post.text_new_before_type_cast + assert_equal HTML_DEHYDRATED, post.text_new_before_type_cast + end + + test "rehydrate actiontext" do + assert_equal HTML_HYDRATED, communication_website_post(:test).text_new.to_s end -end + end