Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of custom-element manifest #3886

Merged
merged 21 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions client/src/linkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ export class linkManager extends LuigiClientBase {
const currentId = helpers.getRandomId();
const pathExistsPromises = this.getPromise('pathExistsPromises') || {};
pathExistsPromises[currentId] = {
resolveFn: function() {},
then: function(resolveFn) {
resolveFn: function () {},
then: function (resolveFn) {
this.resolveFn = resolveFn;
}
};
Expand All @@ -393,7 +393,7 @@ export class linkManager extends LuigiClientBase {
// register event listener, which will be cleaned up after this usage
helpers.addEventListener(
'luigi.navigation.pathExists.answer',
function(e, listenerId) {
function (e, listenerId) {
const data = e.data.data;
const pathExistsPromises = this.getPromise('pathExistsPromises') || {};
if (data.correlationId === currentId) {
Expand Down Expand Up @@ -499,8 +499,8 @@ export class linkManager extends LuigiClientBase {

const currentRoutePromise = this.getPromise('getCurrentRoute') || {};
currentRoutePromise[currentId] = {
resolveFn: function() {},
then: function(resolveFn) {
resolveFn: function () {},
then: function (resolveFn) {
this.resolveFn = resolveFn;
}
};
Expand Down
8 changes: 4 additions & 4 deletions client/src/uxManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class UxManager extends LuigiClientBase {
/** @private */
constructor() {
super();
helpers.addEventListener('luigi.current-locale-changed', e => {
helpers.addEventListener('luigi.current-locale-changed', (e) => {
if (e.data.currentLocale && lifecycleManager.currentContext?.internal) {
lifecycleManager.currentContext.internal.currentLocale = e.data.currentLocale;
lifecycleManager._notifyUpdate();
Expand Down Expand Up @@ -183,7 +183,7 @@ class UxManager extends LuigiClientBase {

const alertPromises = this.getPromise('alerts') || {};
alertPromises[settings.id] = {};
alertPromises[settings.id].promise = new Promise(resolve => {
alertPromises[settings.id].promise = new Promise((resolve) => {
alertPromises[settings.id].resolveFn = resolve;
});
this.setPromise('alerts', alertPromises);
Expand Down Expand Up @@ -297,13 +297,13 @@ class UxManager extends LuigiClientBase {
* @example LuigiClient.uxManager().applyCSS();
*/
applyCSS() {
document.querySelectorAll('head style[luigi-injected]').forEach(luigiInjectedStyleTag => {
document.querySelectorAll('head style[luigi-injected]').forEach((luigiInjectedStyleTag) => {
luigiInjectedStyleTag.remove();
});
const vars = lifecycleManager.currentContext?.internal?.cssVariables;
if (vars) {
let cssString = ':root {\n';
Object.keys(vars).forEach(key => {
Object.keys(vars).forEach((key) => {
const val = vars[key];
cssString += (key.startsWith('--') ? '' : '--') + key + ':' + val + ';\n';
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ describe('Compound Container Tests', () => {
});

it('LuigiClient API - getSkipInitCheck', () => {
cy.get(containerSelector)
.invoke('attr', 'skip-init-check')
.should('eq', 'true');
cy.get(containerSelector).invoke('attr', 'skip-init-check').should('eq', 'true');
});

it('LuigiClient API - getActiveFeatureToggles', () => {
Expand Down Expand Up @@ -188,7 +186,7 @@ describe('Compound Container Tests', () => {
.contains('showConfirmationModal')
.click()
.then(() => {
cy.on('window:confirm', str => {
cy.on('window:confirm', (str) => {
expect(str).to.equal('Are you sure you want to do this?');
});
expect(stub.getCall(0)).to.be.calledWith('LuigiClient.uxManager().showConfirmationModal()');
Expand Down Expand Up @@ -221,7 +219,7 @@ describe('Compound Container Tests', () => {
cy.on('window:alert', stub);

// Set up a spy on console.log
cy.window().then(win => {
cy.window().then((win) => {
cy.spy(win.console, 'log').as('consoleLogSpy');
});

Expand Down
20 changes: 8 additions & 12 deletions container/cypress/e2e/test-app/iframe/iframe-container.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ describe('Iframe Container Test', () => {
cy.get(containerSelector)
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');
cy.wrap($body)
.contains('test navigate')
.click();
cy.wrap($body).contains('test navigate').click();

cy.location().should(loc => {
cy.location().should((loc) => {
expect(loc.href).to.eq('http://localhost:8080/');
});
});
Expand All @@ -41,11 +39,9 @@ describe('Iframe Container Test', () => {
cy.get(containerSelector)
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');
cy.wrap($body)
.find('#content')
.should('have.text', 'Received Custom Message: some data');
cy.wrap($body).find('#content').should('have.text', 'Received Custom Message: some data');
});
});

Expand All @@ -55,7 +51,7 @@ describe('Iframe Container Test', () => {
cy.get(containerSelector)
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');
cy.wrap($body)
.contains('test custom message')
Expand All @@ -78,7 +74,7 @@ describe('Iframe Container Test', () => {
cy.get(containerSelector)
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');

cy.wrap($body)
Expand All @@ -102,7 +98,7 @@ describe('Iframe Container Test', () => {
cy.get(containerSelector)
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');
cy.wrap($body)
.contains('test get token')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ describe('Iframe Cookies Test', () => {
it('should not sent third party cookies request', () => {
cy.on('window:alert', stub);

cy.get(containerSelector)
.should('have.attr', 'skip-cookie-check')
.and('match', /true/);
cy.get(containerSelector).should('have.attr', 'skip-cookie-check').and('match', /true/);
cy.get(containerSelector)
.shadow()
.get('iframe')
Expand Down
30 changes: 10 additions & 20 deletions container/cypress/e2e/test-app/iframe/iframe-settings.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Iframe Settings Test', () => {
});

it('defer-init flag for iframe container', () => {
cy.get('#defer-init-test').then(iframe => {
cy.get('#defer-init-test').then((iframe) => {
const $body = iframe.contents().find('main');
expect($body.children()).to.have.length(0);

Expand All @@ -17,11 +17,9 @@ describe('Iframe Settings Test', () => {
cy.get('#defer-init-test')
.shadow()
.get('iframe')
.then(iframe => {
.then((iframe) => {
const $body = iframe.contents().find('body');
cy.wrap($body)
.contains('defer-init test for iframes')
.should('exist');
cy.wrap($body).contains('defer-init test for iframes').should('exist');
});
});
});
Expand All @@ -33,21 +31,17 @@ describe('Iframe Settings Test', () => {
cy.get('#defer-init-test')
.shadow()
.get('iframe')
.then(elements => {
cy.get(elements.first())
.invoke('attr', 'sandbox')
.should('eq', 'allow-modals allow-popups');
.then((elements) => {
cy.get(elements.first()).invoke('attr', 'sandbox').should('eq', 'allow-modals allow-popups');
});
});

it('set sandbox rules by attribute', () => {
cy.get('#sandbox-rules-test')
.shadow()
.find('iframe')
.then(elements => {
cy.get(elements.last())
.invoke('attr', 'sandbox')
.should('eq', 'allow-scripts allow-same-origin');
.then((elements) => {
cy.get(elements.last()).invoke('attr', 'sandbox').should('eq', 'allow-scripts allow-same-origin');
});
});

Expand Down Expand Up @@ -76,15 +70,11 @@ describe('Iframe Settings Test', () => {
it('should initialize Luigi Client', () => {
cy.get('iframe').then(($iframe) => {
const iframeBody = $iframe.contents().find('body');

const checkLuigiClientStatus = (expectedStatus) => {
cy.wrap(iframeBody)
.find('#luigiClientStatus')
.should('exist')
.invoke('text')
.should('eq', expectedStatus);
cy.wrap(iframeBody).find('#luigiClientStatus').should('exist').invoke('text').should('eq', expectedStatus);
};

checkLuigiClientStatus('Luigi Client Initialized: Unknown');
cy.wait(2000);
checkLuigiClientStatus('Luigi Client Initialized: true');
Expand Down
7 changes: 2 additions & 5 deletions container/cypress/e2e/test-app/wc/wc-container.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ describe('Web Container Test', () => {
});

it('sendCustomMessage', () => {
cy.get(containerSelector)
.shadow()
.find('#customMessageDiv')
.should('have.text', 'Received Custom Message: ');
cy.get(containerSelector).shadow().find('#customMessageDiv').should('have.text', 'Received Custom Message: ');

cy.get('#sendCustomMessageBtn').click();
cy.get(containerSelector)
Expand Down Expand Up @@ -180,7 +177,7 @@ describe('Web Container Test', () => {
.contains('showConfirmationModal')
.click()
.then(() => {
cy.on('window:confirm', str => {
cy.on('window:confirm', (str) => {
expect(str).to.equal('Are you sure you want to do this?');
});
expect(stub.getCall(0)).to.be.calledWith('LuigiClient.uxManager().showConfirmationModal()');
Expand Down
Loading