Skip to content

Commit

Permalink
Update markdoc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Jan 8, 2025
1 parent bbadcdc commit 22c58a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions packages/integrations/markdoc/test/propagated-assets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ describe('Markdoc - propagated assets', () => {
let styleContents;
if (mode === 'dev') {
const styles = stylesDocument.querySelectorAll('style');
assert.equal(styles.length, 2);
styleContents = styles[1].textContent;
assert.equal(styles.length, 1);
styleContents = styles[0].textContent;
} else {
const links = stylesDocument.querySelectorAll('link[rel="stylesheet"]');
assert.equal(links.length, 2);
styleContents = await fixture.readFile(links[1].href);
assert.equal(links.length, 1);
styleContents = await fixture.readFile(links[0].href);
}
assert.equal(styleContents.includes('--color-base-purple: 269, 79%;'), true);
});

it('[fails] Does not bleed styles to other page', async () => {
if (mode === 'dev') {
const styles = scriptsDocument.querySelectorAll('style');
assert.equal(styles.length, 1);
assert.equal(styles.length, 0);
} else {
const links = scriptsDocument.querySelectorAll('link[rel="stylesheet"]');
assert.equal(links.length, 1);
assert.equal(links.length, 0);
}
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/integrations/mdx/test/css-head-mdx.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ describe('Head injection w/ MDX', () => {
const { document } = parseHTML(html);

const links = document.querySelectorAll('head link[rel=stylesheet]');
assert.equal(links.length, 2);
assert.equal(links.length, 1);
});

it('injects content from a component using Content#render()', async () => {
const html = await fixture.readFile('/DirectContentUsage/index.html');
const { document } = parseHTML(html);

const links = document.querySelectorAll('head link[rel=stylesheet]');
assert.equal(links.length, 2);
assert.equal(links.length, 1);

const scripts = document.querySelectorAll('script[type=module]');
assert.equal(scripts.length, 1);
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Head injection w/ MDX', () => {
const $ = cheerio.load(html);

const headLinks = $('head link[rel=stylesheet]');
assert.equal(headLinks.length, 2);
assert.equal(headLinks.length, 1);

const bodyLinks = $('body link[rel=stylesheet]');
assert.equal(bodyLinks.length, 0);
Expand Down

0 comments on commit 22c58a2

Please sign in to comment.