Add img title as well as alt (#66)

Fixes #57
This commit is contained in:
Nolan Lawson 2018-04-10 20:02:42 -07:00 committed by GitHub
parent 3a7d887531
commit 9d706a3748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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