@abgov/nx-adsp 12.26.0 → 12.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generators/vue-app/files/public/favicon.ico +0 -0
- package/src/generators/vue-app/vue-app.spec.ts +27 -0
- /package/src/generators/vue-app/files/{src/index.html__tmpl__ → index.html__tmpl__} +0 -0
- /package/src/generators/vue-app/files/{src → public}/assets/banner.jpg +0 -0
package/package.json
CHANGED
|
Binary file
|
|
@@ -50,6 +50,33 @@ describe('Vue App Generator', () => {
|
|
|
50
50
|
expect(config.targets.build.options.outputPath).toBe('dist/apps/test');
|
|
51
51
|
}, 30000);
|
|
52
52
|
|
|
53
|
+
it('index.html is at the Vite entry root and its mount target matches main.ts', async () => {
|
|
54
|
+
await generator(host, options);
|
|
55
|
+
// Vite's entry is <projectRoot>/index.html, not src/index.html — a template
|
|
56
|
+
// shipped under src/ is ignored, leaving @nx/vue's #root div while main.ts
|
|
57
|
+
// mounts #app, so nothing renders. Guard both: correct path and matched id.
|
|
58
|
+
expect(host.exists('apps/test/index.html')).toBeTruthy();
|
|
59
|
+
expect(host.exists('apps/test/src/index.html')).toBeFalsy();
|
|
60
|
+
const indexHtml = host.read('apps/test/index.html').toString();
|
|
61
|
+
const mainTs = host.read('apps/test/src/main.ts').toString();
|
|
62
|
+
const mountId = mainTs.match(/\.mount\(['"]#([\w-]+)['"]\)/)?.[1];
|
|
63
|
+
expect(mountId).toBeTruthy();
|
|
64
|
+
expect(indexHtml).toContain(`id="${mountId}"`);
|
|
65
|
+
}, 30000);
|
|
66
|
+
|
|
67
|
+
it('static assets live in public/ so Vite serves them at the referenced URLs', async () => {
|
|
68
|
+
await generator(host, options);
|
|
69
|
+
// App.vue's <goa-hero-banner backgroundurl="/assets/banner.jpg"> and
|
|
70
|
+
// index.html's favicon.ico are absolute-URL string refs, so they must be in
|
|
71
|
+
// the Vite publicDir (public/) — a src/assets file is not served at /assets.
|
|
72
|
+
const appVue = host.read('apps/test/src/App.vue').toString();
|
|
73
|
+
const bannerUrl = appVue.match(/backgroundurl="([^"]+)"/)?.[1];
|
|
74
|
+
expect(bannerUrl).toBe('/assets/banner.jpg');
|
|
75
|
+
expect(host.exists('apps/test/public/assets/banner.jpg')).toBeTruthy();
|
|
76
|
+
expect(host.exists('apps/test/src/assets/banner.jpg')).toBeFalsy();
|
|
77
|
+
expect(host.exists('apps/test/public/favicon.ico')).toBeTruthy();
|
|
78
|
+
}, 30000);
|
|
79
|
+
|
|
53
80
|
it('vite.config.ts marks goa-* elements as custom elements', async () => {
|
|
54
81
|
await generator(host, options);
|
|
55
82
|
const viteConfig = host.read('apps/test/vite.config.ts').toString();
|
|
File without changes
|
|
File without changes
|