File tree 2 files changed +17
-0
lines changed
server/lib/mobiledoc/cards
test/unit/lib/mobiledoc/cards
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ module.exports = {
23
23
if ( payload . alt ) {
24
24
img . setAttribute ( 'alt' , payload . alt ) ;
25
25
}
26
+ if ( payload . title ) {
27
+ img . setAttribute ( 'title' , payload . title ) ;
28
+ }
26
29
27
30
figure . appendChild ( img ) ;
28
31
Original file line number Diff line number Diff line change @@ -45,6 +45,20 @@ describe('Image card', function () {
45
45
serializer . serialize ( card . render ( opts ) ) . should . eql ( '<figure class="kg-image-card"><img src="https://www.ghost.org/image.png" class="kg-image" alt="example image"></figure>' ) ;
46
46
} ) ;
47
47
48
+ it ( 'renders an image with title attribute' , function ( ) {
49
+ let opts = {
50
+ env : {
51
+ dom : new SimpleDom . Document ( )
52
+ } ,
53
+ payload : {
54
+ src : 'https://www.ghost.org/image.png' ,
55
+ title : 'example image'
56
+ }
57
+ } ;
58
+
59
+ serializer . serialize ( card . render ( opts ) ) . should . eql ( '<figure class="kg-image-card"><img src="https://www.ghost.org/image.png" class="kg-image" title="example image"></figure>' ) ;
60
+ } ) ;
61
+
48
62
it ( 'renders nothing with no src' , function ( ) {
49
63
let opts = {
50
64
env : {
You can’t perform that action at this time.
0 commit comments