Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo sync #25242

Merged
merged 5 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/render-content/create-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,29 @@ import doctocatLinkIcon from './doctocat-link-icon.js'
// see https://github.com/unifiedjs/unified/issues/79
const wrapperForImages = () =>
wrapInElement({ selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
const wrapperForRowheadersThead = () =>

const wrapperForTheadThScope = () =>
wrapInElement({
selector: '.rowheaders thead th',
selector: 'thead th',
wrapper: 'th',
// This moves what it finds in the selector inside the wrapper.
rewrite: true,
wrapperAdditionalAttributes: {
scope: 'col',
},
})

const wrapperForTbodyThScope = () =>
wrapInElement({
selector: 'thead th',
wrapper: 'th',
// This moves what it finds in the selector inside the wrapper.
rewrite: true,
wrapperAdditionalAttributes: {
scope: 'col',
},
})

const wrapperForRowheadersTbody = () =>
wrapInElement({
selector: '.rowheaders tbody tr td:first-child',
Expand Down Expand Up @@ -70,7 +83,8 @@ export default function createProcessor(context) {
})
.use(raw)
.use(wrapperForImages)
.use(wrapperForRowheadersThead)
.use(wrapperForTheadThScope)
.use(wrapperForTbodyThScope)
.use(wrapperForRowheadersTbody)
.use(rewriteImgSources)
.use(rewriteAssetImgTags)
Expand Down
2 changes: 1 addition & 1 deletion src/automated-pipelines/tests/accessibility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { jest, test } from '@jest/globals'

import { getDOM } from '../../../tests/helpers/e2etest.js'
import { getDOMCached as getDOM } from '../../../tests/helpers/e2etest.js'

describe('automated page heading accessibility', () => {
jest.setTimeout(3 * 60 * 1000)
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/render-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ some code
| [\`issues\`](/webhooks/event-payloads/#issues) | - \`opened\`<br/>- \`edited\`<br/>- \`other\` |`
const file = await renderContent(content)
expect(file).toBe(
'<table><thead><tr><th>Webhook event payload</th><th>Activity types</th></tr></thead><tbody><tr><td><a href="/webhooks/event-payloads/#issues"><code>issues</code></a></td><td>- <code>opened</code><br>- <code>edited</code><br>- <code>other</code></td></tr></tbody></table>'
'<table><thead><tr><th scope="col">Webhook event payload</th><th scope="col">Activity types</th></tr></thead>' +
'<tbody><tr><td><a href="/webhooks/event-payloads/#issues"><code>issues</code></a></td><td>- <code>opened</code><br>- <code>edited</code><br>- <code>other</code></td></tr></tbody></table>'
)
})

Expand Down