Add img title as well as alt

Fixes #57
This commit is contained in:
Nolan Lawson 2018-04-10 19:51:39 -07:00
parent a932cc406b
commit dbff9cc2bb
6 changed files with 14 additions and 5 deletions

View File

@ -5,6 +5,7 @@
class="{{hidden ? 'hidden' : ''}} {{className || ''}}"
aria-hidden="{{ariaHidden || ''}}"
alt="{{alt || ''}}"
title="{{alt || ''}}"
src="{{displaySrc}}"
:width
:height

View File

@ -13,7 +13,8 @@
/>
{{else}}
<LazyImage
alt="{{label}}"
alt="{{label || ''}}"
title="{{label || ''}}"
src="{{staticSrc}}"
fallback="{{oneTransparentPixel}}"
:width

View File

@ -1,13 +1,15 @@
{{#if staticSrc === src}}
<img class="{{className || ''}}"
aria-hidden="{{ariaHidden}}"
alt="{{alt}}"
alt="{{alt || ''}}"
title="{{alt || ''}}"
src="{{src}}"
on:imgLoadError />
{{else}}
<img class="{{className || ''}} non-autoplay-zoom-in {{isLink ? 'is-link' : ''}}"
aria-hidden="{{ariaHidden}}"
alt="{{alt}}"
alt="{{alt || ''}}"
title="{{alt || ''}}"
src="{{staticSrc}}"
on:imgLoadError
on:mouseover="onMouseOver(event)"

View File

@ -19,6 +19,7 @@
width="{{width}}"
height="{{height}}"
alt="{{description || ''}}"
title="{{description || ''}}"
/>
{{/if}}
</ModalDialog>

View File

@ -7,7 +7,8 @@
>
<PlayVideoIcon />
<LazyImage
alt="{{media.description}}"
alt="{{media.description || ''}}"
title="{{media.description || ''}}"
src="{{media.preview_url}}"
fallback="{{oneTransparentPixel}}"
width="{{inlineWidth}}"
@ -46,7 +47,8 @@
/>
{{else}}
<LazyImage
alt="{{media.description}}"
alt="{{media.description || ''}}"
title="{{media.description || ''}}"
src="{{media.preview_url}}"
fallback="{{oneTransparentPixel}}"
width="{{inlineWidth}}"

View File

@ -25,7 +25,9 @@ test('uploads alts for media', async t => {
.typeText(getNthMediaAltInput(1), 'kitten 1')
.click(composeButton)
.expect(getNthStatusAndImage(0, 0).getAttribute('alt')).eql('kitten 1')
.expect(getNthStatusAndImage(0, 0).getAttribute('title')).eql('kitten 1')
.expect(getNthStatusAndImage(0, 1).getAttribute('alt')).eql('kitten 2')
.expect(getNthStatusAndImage(0, 1).getAttribute('title')).eql('kitten 2')
})
test('uploads alts when deleting and re-uploading media', async t => {