Refactor site generation into a modular content pipeline
Deploy website / deploy (push) Successful in 24s
Deploy website / deploy (push) Successful in 24s
This commit is contained in:
1 parent
0f69028d4a
commit
146d516f24
20 files changed
+826
-427
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import { htmlFacts } from '../html-checks.js'
|
||||
|
||||
test('extracts decoded attributes regardless of quote style or order', () => {
|
||||
const facts = htmlFacts(`<!doctype html><meta content='width=device-width' name='viewport'>
|
||||
<a class='button' href='#a&b'>Go</a><h2 id='a&b'>Title</h2>
|
||||
<code class='extra language-js another'>code</code>`)
|
||||
assert.equal(facts.hasViewport, true)
|
||||
assert.deepEqual(facts.ids, ['a&b'])
|
||||
assert.deepEqual(facts.hrefs, ['#a&b'])
|
||||
assert.deepEqual(facts.languages, ['js'])
|
||||
})
|
||||
|
||||
test('ignores markup-like text in scripts and comments', () => {
|
||||
const facts = htmlFacts(`<script>const example = '<a href="/missing"><i id="fake"></i>'</script>
|
||||
<!-- <heading id="also-fake"></heading> -->
|
||||
<meta name='robots' content='nofollow, noindex'>`)
|
||||
assert.deepEqual(facts.ids, [])
|
||||
assert.deepEqual(facts.hrefs, [])
|
||||
assert.equal(facts.hasHeadingElement, false)
|
||||
assert.equal(facts.isDraft, true)
|
||||
})
|
||||
Reference in new issue
Block a user