summaryrefslogtreecommitdiff
path: root/packages/integrations/vue/test/app-entrypoint-css.test.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2024-01-05 13:30:53 -0600
committerGravatar GitHub <noreply@github.com> 2024-01-05 13:30:53 -0600
commita1c31665cbc48bfdf4885112b427db48ecc48276 (patch)
tree38c8f193874997fb1732cec6c41d76be957e8c94 /packages/integrations/vue/test/app-entrypoint-css.test.js
parentbd3f36e6aba779b3bbe645a7cfee939021da786c (diff)
downloadastro-a1c31665cbc48bfdf4885112b427db48ecc48276.tar.gz
astro-a1c31665cbc48bfdf4885112b427db48ecc48276.tar.zst
astro-a1c31665cbc48bfdf4885112b427db48ecc48276.zip
Ensure `appEntrypoint` is referenced in Vue components (#9490)
* fix(#6827): ensure `appEntrypoint` is referenced in Vue components * chore: add test * chore: add changeset * fix: windows handling * Update packages/integrations/vue/src/index.ts Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * chore: address review feedback * chore: update lockfile --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Diffstat (limited to 'packages/integrations/vue/test/app-entrypoint-css.test.js')
-rw-r--r--packages/integrations/vue/test/app-entrypoint-css.test.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/packages/integrations/vue/test/app-entrypoint-css.test.js b/packages/integrations/vue/test/app-entrypoint-css.test.js
new file mode 100644
index 000000000..b629f1d25
--- /dev/null
+++ b/packages/integrations/vue/test/app-entrypoint-css.test.js
@@ -0,0 +1,67 @@
+import { loadFixture } from './test-utils.js';
+import { expect } from 'chai';
+import { load as cheerioLoad } from 'cheerio';
+
+describe('App Entrypoint CSS', () => {
+ /** @type {import('./test-utils').Fixture} */
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/app-entrypoint-css/',
+ });
+ })
+
+ describe('build', () => {
+ before(async () => {
+ await fixture.build();
+ })
+
+ it('injects styles referenced in appEntrypoint', async () => {
+ const html = await fixture.readFile('/index.html');
+ const $ = cheerioLoad(html);
+
+ // test 1: basic component renders
+ expect($('#foo > #bar').text()).to.eq('works');
+
+ // test 2: injects the global style on the page
+ expect($('style').first().text().trim()).to.eq(':root{background-color:red}');
+ });
+
+ it('does not inject styles to pages without a Vue component', async () => {
+ const html = await fixture.readFile('/unrelated/index.html');
+ const $ = cheerioLoad(html);
+
+ expect($('style').length).to.eq(0);
+ expect($('link[rel="stylesheet"]').length).to.eq(0);
+ });
+ })
+
+ describe('dev', () => {
+ let devServer;
+ before(async () => {
+ devServer = await fixture.startDevServer();
+ })
+ after(async () => {
+ await devServer.stop();
+ })
+
+ it('loads during SSR', async () => {
+ const html = await fixture.fetch('/').then((res) => res.text());
+ const $ = cheerioLoad(html);
+
+ // test 1: basic component renders
+ expect($('#foo > #bar').text()).to.eq('works');
+ // test 2: injects the global style on the page
+ expect($('style').first().text().replace(/\s+/g, '')).to.eq(':root{background-color:red;}');
+ });
+
+ it('does not inject styles to pages without a Vue component', async () => {
+ const html = await fixture.fetch('/unrelated').then((res) => res.text());
+ const $ = cheerioLoad(html);
+
+ expect($('style').length).to.eq(0);
+ expect($('link[rel="stylesheet"]').length).to.eq(0);
+ });
+ })
+});
pan class='insertions'>+3 2023-10-16fix(node:worker_threads): ensure threadId property is exposed on ↵Gravatar Jérôme Benoit 6-15/+75 worker_threads instance (#6521) * fix: ensure threadId property is exposed on worker_threads instance Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * fix: rename lazy worker_threads module properties Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * fix: add getter for threadId Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: improve worker_threads UTs Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: fix lazy loading Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: fix worker_threads test Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> * fix: return the worker threadId Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: refine worker_threads expectation on threadId Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> --------- Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> 2023-10-16Fix use before define bug in sqliteGravatar Ashcon Partovi 2-5/+5 Fixes #6481 2023-10-16fix(jest): fix toStrictEqual on same URLs (#6528)Gravatar João Alisson 2-13/+16 Fixes #6492 2023-10-16Fix `toHaveBeenCalled` having wrong error signatureGravatar Ashcon Partovi 1-2/+2 Fixes #6527 2023-10-16Fix formattingGravatar Ashcon Partovi 1-2/+1 2023-10-16Add `reusePort` to `Bun.serve` typesGravatar Ashcon Partovi 1-0/+9 2023-10-16Fix `request.url` having incorrect portGravatar Ashcon Partovi 4-1/+92 Fixes #6443 2023-10-16Remove uWebSockets header from Bun.serve responsesGravatar Ashcon Partovi 1-6/+6 2023-10-16Rename some testsGravatar Ashcon Partovi 3-0/+0 2023-10-16Fix #6467Gravatar Ashcon Partovi 2-3/+10 2023-10-16Update InternalModuleRegistryConstants.hGravatar Dylan Conway 1-3/+3 2023-10-16Development -> Contributing (#6538)Gravatar Colin McDonnell 2-1/+1 Co-authored-by: Colin McDonnell <colin@KennyM1.local> 2023-10-14fix(net/tls) fix pg hang on end + hanging on query (#6487)Gravatar Ciro Spaciari 3-8/+36 * fix pg hang on end + hanging on query * remove dummy function * fix node-stream * add test * fix test * return error in test * fix test use once instead of on * fix OOM * generated * 💅 * 💅 2023-10-13fix installing dependencies that match workspace versions (#6494)Gravatar Dylan Conway 4-2/+64 * check if dependency matches workspace version * test * Update lockfile.zig * set resolution to workspace package id 2023-10-13fix lockfile struct padding (#6495)Gravatar Dylan Conway 3-3/+18 * integrity padding * error message for bytes at end of struct