summaryrefslogtreecommitdiff
path: root/packages/astro/test/astro-scripts.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-09-14 13:51:38 -0400
committerGravatar GitHub <noreply@github.com> 2022-09-14 13:51:38 -0400
commitf1efd88ddefe078f64901b1754ebfbaf65d36b51 (patch)
tree18647fb401a9516ff378ddd230e58cc6b57b4fba /packages/astro/test/astro-scripts.test.js
parent1bedb9427ebbe92eb74a82fc70cb67a97a250f32 (diff)
downloadastro-f1efd88ddefe078f64901b1754ebfbaf65d36b51.tar.gz
astro-f1efd88ddefe078f64901b1754ebfbaf65d36b51.tar.zst
astro-f1efd88ddefe078f64901b1754ebfbaf65d36b51.zip
Compatiblity between hoisted scripts and tailwind integration (#4755)
* Compatiblity between hoisted scripts and tailwind integration * Adds a changeset
Diffstat (limited to '')
-rw-r--r--packages/astro/test/astro-scripts.test.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/astro/test/astro-scripts.test.js b/packages/astro/test/astro-scripts.test.js
index 1229de5f5..4eaa29a6a 100644
--- a/packages/astro/test/astro-scripts.test.js
+++ b/packages/astro/test/astro-scripts.test.js
@@ -119,7 +119,8 @@ describe('Scripts (hoisted and not)', () => {
let html = await fixture.readFile('/with-styles/index.html');
let $ = cheerio.load(html);
- expect($('link[rel=stylesheet]')).to.have.a.lengthOf(1);
+ // Imported styles + tailwind
+ expect($('link[rel=stylesheet]')).to.have.a.lengthOf(2);
});
});
@@ -150,5 +151,21 @@ describe('Scripts (hoisted and not)', () => {
});
expect(found).to.equal(1);
});
+
+ it('Using injectScript does not interfere', async () => {
+ let res = await fixture.fetch('/inline-in-page');
+ let html = await res.text();
+ let $ = cheerio.load(html);
+ let found = 0;
+ let moduleScripts = $('[type=module]');
+ moduleScripts.each((i, el) => {
+ if (
+ $(el).attr('src').includes('?astro&type=script&index=0&lang.ts')
+ ) {
+ found++;
+ }
+ });
+ expect(found).to.equal(1);
+ });
});
});