-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from CloudCannon/feat/fix-meta-encoding
Fix HTML encoding bug with inline metadata
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
.../integration_tests/characters/pagefind-handles-html-entities-in-inline-meta.toolproof.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Character Tests > Pagefind handles HTML entities in inline meta | ||
steps: | ||
- ref: ./background.toolproof.yml | ||
- step: I have a "public/apiary/index.html" file with the content {html} | ||
html: >- | ||
<!DOCTYPE html><html lang="en"><head></head><body><h1 | ||
data-pagefind-meta="title:The "bees"">the bees</h1></body></html> | ||
- macro: I run Pagefind | ||
- step: stdout should contain "Running Pagefind" | ||
- step: The file "public/pagefind/pagefind.js" should not be empty | ||
- step: I serve the directory "public" | ||
- step: In my browser, I load "/" | ||
- step: In my browser, I evaluate {js} | ||
js: >- | ||
let pagefind = await import("/pagefind/pagefind.js"); | ||
let search = await pagefind.search("bees"); | ||
let pages = await Promise.all(search.results.map(r => r.data())); | ||
document.querySelector('[data-result]').innerText = pages.map(p => | ||
p.meta.title).join(", "); | ||
- step: In my browser, the console should be empty | ||
- step: In my browser, I evaluate {js} | ||
js: |- | ||
let val = await toolproof.querySelector("[data-result]"); | ||
toolproof.assert_eq(val.innerHTML, `The "bees"`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters