Skip to content

Commit

Permalink
Fixes code review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn committed Sep 24, 2024
1 parent 7839f3e commit 01d3c68
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,9 @@ describe('Compound Container Tests', () => {
});

it('LuigiClient API - getSkipInitCheck', () => {
cy.on('window:alert', stub);

cy.get(containerSelector)
.shadow()
.contains('getSkipInitCheck')
.click()
.then(() => {
expect(stub.getCall(0)).to.be.calledWith('LuigiClient.getSkipInitCheck()=true');
});
.invoke('attr', 'skip-init-check')
.should('eq', 'true');
});

it('LuigiClient API - getActiveFeatureToggles', () => {
Expand Down
2 changes: 1 addition & 1 deletion container/src/LuigiCompoundContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
}
webcomponentService.renderWebComponentCompound(node, thisComponent.getNoShadow() ? thisComponent : mainComponent, ctx).then(compCnt => {
eventBusElement = compCnt as HTMLElement;
if (thisComponent.hasAttribute('skip-init-check') || !node.viewUrl) {
if (skipInitCheck || !node.viewUrl) {
thisComponent.initialized = true;
setTimeout(() => {
webcomponentService.dispatchLuigiEvent(Events.INITIALIZED, {});
Expand Down
3 changes: 0 additions & 3 deletions container/src/services/webcomponents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,6 @@ export class WebComponentService {
getUserSettings: (): Object => {
return this.thisComponent.userSettings || {};
},
getSkipInitCheck: (): boolean => {
return !!this.thisComponent.skipInitCheck;
},
setViewGroupData: data => {
this.dispatchLuigiEvent(Events.SET_VIEW_GROUP_DATA_REQUEST, data);
}
Expand Down
14 changes: 0 additions & 14 deletions container/test-app/compound/helloWorldWC.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export default class extends HTMLElement {
const getAnchorBtn = document.createElement('template');
getAnchorBtn.innerHTML = '<button id="getAnchor">getAnchor</button>';

const getSkipInitCheckBtn = document.createElement('template');
getSkipInitCheckBtn.innerHTML = '<button id="getSkipInitCheck">getSkipInitCheck</button>';

const getFeatureToggleListBtn = document.createElement('template');
getFeatureToggleListBtn.innerHTML = '<button id="getFeatureToggleList">getFeatureToggleList</button>';

Expand Down Expand Up @@ -106,7 +103,6 @@ export default class extends HTMLElement {
this._shadowRoot.appendChild(getClientPermissionsBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getUserSettingsBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getAnchorBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getSkipInitCheckBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getFeatureToggleListBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getThemeBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getDirtyStatusBtn.content.cloneNode(true));
Expand Down Expand Up @@ -210,16 +206,6 @@ export default class extends HTMLElement {
});
});

this.$getSkipInitCheckBtn = this._shadowRoot.querySelector('#getSkipInitCheck');
this.$getSkipInitCheckBtn.addEventListener('click', () => {
const skipInitCheck = this.LuigiClient.getSkipInitCheck();

this.LuigiClient.uxManager().showAlert({
text: 'LuigiClient.getSkipInitCheck()=' + JSON.stringify(skipInitCheck),
type: 'info'
});
});

this.$getFeatureToggleListBtn = this._shadowRoot.querySelector('#getFeatureToggleList');
this.$getFeatureToggleListBtn.addEventListener('click', () => {
const activeFeatureToggleList = this.LuigiClient.getActiveFeatureToggles();
Expand Down
13 changes: 0 additions & 13 deletions container/test/services/webcomponents.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,19 +1144,6 @@ describe('createClientAPI', () => {
// assert
expect(result).toEqual({});
});

it.each([true, false])('test getSkipInitCheck attribute', value => {
// mock and spy on data/functions
service.thisComponent = document.createElement('div');
service.thisComponent.skipInitCheck = value;

// act
const clientAPI = service.createClientAPI(undefined, 'nodeId', 'wc_id', 'component', false);
const result = clientAPI.getSkipInitCheck();

// assert
expect(result).toBe(value);
});
});

describe('initWC', () => {
Expand Down

0 comments on commit 01d3c68

Please sign in to comment.