Skip to content

Commit

Permalink
test: add test for assetsmap global
Browse files Browse the repository at this point in the history
  • Loading branch information
yanni4night committed Nov 25, 2023
1 parent 7e3cec6 commit 5a62733
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="cypress" />

describe.only('entry-assetmap-global', () => {
beforeEach(() => {
cy.visit(`/app-options/app-plugin-options/load-from-entry/various-entries/index.html`);
cy.window().then(win => win.history.pushState(null, '', '#/entry-assetmap-global'));
});

it(`mounted successfully`, () => {
cy.get('#app h1').should('have.text', 'entry-assetmap-global mounted');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="cypress" />

describe.only('entry-js-global', () => {
beforeEach(() => {
cy.visit(`/app-options/app-plugin-options/load-from-entry/various-entries/index.html`);
cy.window().then(win => win.history.pushState(null, '', '#/entry-js-global'));
});

it(`mounted successfully`, () => {
cy.get('#app h1').should('have.text', 'entry-js-global mounted');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function mount({ domElement, name }) {
domElement.innerHTML = `<h1>${name} mounted</h1>`;
}
function unmount({ domElement }) {
domElement.innerHTML = '';
}

window[Math.random()] = { mount, unmount };
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ container.registerApps([
activeWhen: '#/entry-js-umd',
entry: './entry-js-umd/entry.js',
},
{
name: 'entry-js-global',
activeWhen: '#/entry-js-global',
entry: './entry-js-global/entry.js',
jsExportType: 'global',
},
{
name: 'entry-json',
activeWhen: '#/entry-json',
Expand All @@ -42,6 +48,28 @@ container.registerApps([
},
},
},
{
name: 'entry-assetmap-module',
activeWhen: '#/entry-assetmap-module',
assetsMap: {
module: 'module',
version: 1,
initial: {
js: ['./entry-js-esm/entry.mjs'],
},
},
},
{
name: 'entry-assetmap-global',
activeWhen: '#/entry-assetmap-global',
assetsMap: {
module: 'global',
version: 1,
initial: {
js: ['./entry-js-global/entry.js'],
},
},
},
{
name: 'entry-assetmap-umd',
activeWhen: '#/entry-assetmap-umd',
Expand Down

0 comments on commit 5a62733

Please sign in to comment.