1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Merge pull request #25260 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2023-04-27 08:40:19 -04:00
committed by GitHub
2 changed files with 13 additions and 29 deletions

View File

@@ -0,0 +1,13 @@
import { getDOM } from '../helpers/e2etest.js'
describe('<head>', () => {
test('includes page intro in `description` meta tag', async () => {
const $ = await getDOM('/get-started/markdown/intro')
// The intro has Markdown syntax which becomes HTML encoded in the lead element.
const lead = $('[data-testid="lead"] p')
expect(lead.html()).toMatch('<code>syntax</code>')
// As a meta description its content is stripped of all HTML
const description = $('head meta[name="description"]')
expect(description.attr('content')).toBe('This intro has Markdown syntax for GitHub')
})
})

View File

@@ -1,29 +0,0 @@
import { getDOM } from '../helpers/e2etest.js'
import { jest } from '@jest/globals'
jest.useFakeTimers({ legacyFakeTimers: true })
describe('<head>', () => {
jest.setTimeout(5 * 60 * 1000)
test('includes page intro in `description` meta tag', async () => {
const $ = await getDOM('/en/articles/about-ssh')
const $description = $('meta[name="description"]')
expect($description.attr('content').startsWith('Using the SSH protocol')).toBe(true)
})
test('renders `description` meta tag in plaintext (no HTML)', async () => {
const $ = await getDOM('/en/articles/about-pull-request-merges')
const $description = $('meta[name="description"]')
// plain text intro
expect(
$description.attr('content').startsWith('You can merge pull requests by retaining')
).toBe(true)
// HTML intro
expect(
$('[data-testid="lead"]')
.html()
.startsWith('<p>You can <a href="/articles/merging-a-pull-request">merge pull requests</a>')
)
})
})