diff --git a/test/fixtures/communication/website.yml b/test/fixtures/communication/website.yml new file mode 100644 index 0000000000000000000000000000000000000000..5e9fc04572143c27e0ac3edf2cca2755f6bfe8f1 --- /dev/null +++ b/test/fixtures/communication/website.yml @@ -0,0 +1,3 @@ +test: + university: test + name: Site de test diff --git a/test/fixtures/university.yml b/test/fixtures/university.yml new file mode 100644 index 0000000000000000000000000000000000000000..0ef3e762f353b857b6a82e0e390b29bbf8ad422a --- /dev/null +++ b/test/fixtures/university.yml @@ -0,0 +1,2 @@ +test: + name: Université de test diff --git a/test/models/summernote_test.rb b/test/models/summernote_test.rb index 348a45c6cdf0b7366f0bb7edc9a80a99187b3c72..2079616b63414b92783928bbd1c1eb84315d2d59 100644 --- a/test/models/summernote_test.rb +++ b/test/models/summernote_test.rb @@ -1,5 +1,22 @@ 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>" + 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 + end end