Skip to content

Commit 9d82568

Browse files
authoredSep 23, 2022
fix: add alt value for contributor image (#334)
1 parent 94b555e commit 9d82568

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/generate/__tests__/format-contributor.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('format a simple contributor', () => {
2020
const {options} = fixtures()
2121

2222
const expected =
23-
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a>'
23+
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a>'
2424

2525
expect(formatContributor(options, contributor)).toBe(expected)
2626
})
@@ -30,7 +30,7 @@ test('format contributor with complex contribution types', () => {
3030
const {options} = fixtures()
3131

3232
const expected =
33-
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>'
33+
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>'
3434

3535
expect(formatContributor(options, contributor)).toBe(expected)
3636
})
@@ -53,7 +53,7 @@ test('default image size to 100', () => {
5353
delete options.imageSize
5454

5555
const expected =
56-
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=100" width="100px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a>'
56+
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684?s=100" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a>'
5757

5858
expect(formatContributor(options, contributor)).toBe(expected)
5959
})
@@ -63,7 +63,7 @@ test('format contributor with pipes in their name', () => {
6363
const {options} = fixtures()
6464

6565
const expected =
66-
'<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt=""/><br /><sub><b>Who &#124; Needs &#124; Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>'
66+
'<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt="Who &#124; Needs &#124; Pipes?"/><br /><sub><b>Who &#124; Needs &#124; Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>'
6767

6868
expect(formatContributor(options, contributor)).toBe(expected)
6969
})
@@ -73,7 +73,7 @@ test('format contributor with no GitHub account', () => {
7373
const {options} = fixtures()
7474

7575
const expected =
76-
'<img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt=""/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>'
76+
'<img src="https://avatars1.githubusercontent.com/u/1500684?s=150" width="150px;" alt="No Github Account"/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>'
7777

7878
expect(formatContributor(options, contributor)).toBe(expected)
7979
})

‎src/generate/format-contributor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const _ = require('lodash/fp')
22
const formatContributionType = require('./format-contribution-type')
33

44
const avatarTemplate = _.template(
5-
'<img src="<%= contributor.avatar_url %>?s=<%= options.imageSize %>" width="<%= options.imageSize %>px;" alt=""/>',
5+
'<img src="<%= contributor.avatar_url %>?s=<%= options.imageSize %>" width="<%= options.imageSize %>px;" alt="<%= name %>"/>',
66
)
77
const avatarBlockTemplate = _.template(
88
'<a href="<%= contributor.profile %>"><%= avatar %><br /><sub><b><%= name %></b></sub></a>',

0 commit comments

Comments
 (0)
Please sign in to comment.