Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Mar 8, 2024
1 parent bf4db62 commit 24bbb62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/astro/test/astro-attrs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ describe('Attributes', async () => {
'html-enum-false': { attribute: 'draggable', value: 'false' },
};

// cheerio will unescape the values, so checking that the url rendered unescaped to begin with has to be done manually
assert.equal(html.includes("https://example.com/api/og?title=hello&description=somedescription"), true);

for (const id of Object.keys(attrs)) {
const { attribute, value } = attrs[id];
const attr = $(`#${id}`).attr(attribute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<span id="empty" attr="" />
<span id="null" attr={null} />
<span id="undefined" attr={undefined} />
<span id="url" attr={"https://example.com/api/og?title=hello&description=somedescription"}/>
<!--
Per HTML spec, some attributes should be treated as booleans
These should always render <span async /> or <span /> (without a string value)
Expand Down

0 comments on commit 24bbb62

Please sign in to comment.