Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
03d7b091
Commit
03d7b091
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
test dehydrate rehydrate
parent
8a031d19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/fixtures/.keep
+0
-0
0 additions, 0 deletions
test/fixtures/.keep
test/fixtures/communication/website/post.yml
+7
-0
7 additions, 0 deletions
test/fixtures/communication/website/post.yml
test/models/summernote_test.rb
+12
-16
12 additions, 16 deletions
test/models/summernote_test.rb
with
19 additions
and
16 deletions
test/fixtures/.keep
deleted
100644 → 0
+
0
−
0
View file @
8a031d19
This diff is collapsed.
Click to expand it.
test/fixtures/communication/website/post.yml
0 → 100644
+
7
−
0
View file @
03d7b091
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>
This diff is collapsed.
Click to expand it.
test/models/summernote_test.rb
+
12
−
16
View file @
03d7b091
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment