summaryrefslogtreecommitdiff
path: root/packages/integrations/vue/test/app-entrypoint.test.js
diff options
context:
space:
mode:
authorGravatar Justinas Delinda <8914032+minht11@users.noreply.github.com> 2023-11-08 09:44:02 +0200
committerGravatar GitHub <noreply@github.com> 2023-11-08 08:44:02 +0100
commit14e586cc77570b08afae5eeef605e978fec287d8 (patch)
tree6dc0ae6a86355d5f1dae9f5677e14bd2cbceda6b /packages/integrations/vue/test/app-entrypoint.test.js
parentd979b8f0a82c12f2a844c429982207c88fe13ae6 (diff)
downloadastro-14e586cc77570b08afae5eeef605e978fec287d8.tar.gz
astro-14e586cc77570b08afae5eeef605e978fec287d8.tar.zst
astro-14e586cc77570b08afae5eeef605e978fec287d8.zip
fix(vue): vue regular script block exports not being recognized inside editor (#8998)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/vue/test/app-entrypoint.test.js')
-rw-r--r--packages/integrations/vue/test/app-entrypoint.test.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/integrations/vue/test/app-entrypoint.test.js b/packages/integrations/vue/test/app-entrypoint.test.js
index 4f4f389d1..b20e7be7e 100644
--- a/packages/integrations/vue/test/app-entrypoint.test.js
+++ b/packages/integrations/vue/test/app-entrypoint.test.js
@@ -1,6 +1,8 @@
import { loadFixture } from './test-utils.js';
import { expect } from 'chai';
+import { load as cheerioLoad } from 'cheerio';
import { parseHTML } from 'linkedom';
+
describe('App Entrypoint', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
@@ -13,11 +15,21 @@ describe('App Entrypoint', () => {
});
it('loads during SSR', async () => {
- const data = await fixture.readFile('/index.html');
- const { document } = parseHTML(data);
- const bar = document.querySelector('#foo > #bar');
- expect(bar).not.to.be.undefined;
- expect(bar.textContent).to.eq('works');
+ const html = await fixture.readFile('/index.html');
+ const $ = cheerioLoad(html);
+
+ // test 1: basic component renders
+ expect($('#foo > #bar').text()).to.eq('works');
+
+ // test 2: component with multiple script blocks renders and exports
+ // values from non setup block correctly
+ expect($('#multiple-script-blocks').text()).to.equal('2 4');
+
+ // test 3: component using generics renders
+ expect($('#generics').text()).to.equal('generic');
+
+ // test 4: component using generics and multiple script blocks renders
+ expect($('#generics-and-blocks').text()).to.equal('1 3!!!');
});
it('setup included in renderer bundle', async () => {