Skip to content

Commit

Permalink
Merge branch 'main' into 3926-locale-prop-Compound
Browse files Browse the repository at this point in the history
  • Loading branch information
ndricimrr authored Sep 24, 2024
2 parents 1fb57bf + d100202 commit f90f58c
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,30 @@ describe('Compound Container Tests', () => {
});
});

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

cy.get(containerSelector)
.shadow()
.contains('getFeatureToggleList')
.click()
.then(() => {
expect(stub.getCall(0)).to.be.calledWith('LuigiClient.getActiveFeatureToggles()=["ft1","ft2"]');
});
});

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

cy.get(containerSelector)
.shadow()
.contains('getTheme')
.click()
.then(() => {
expect(stub.getCall(0)).to.be.calledWith('LuigiClient.getCurrentTheme()="sap_fiori_3"');
});
});

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

Expand Down
78 changes: 42 additions & 36 deletions container/src/LuigiCompoundContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,39 @@
tag: null,
shadow: 'none',
props: {
viewurl: { type: 'String', reflect: false, attribute: 'viewurl' },
deferInit: { type: 'Boolean', attribute: 'defer-init' },
context: { type: 'String', reflect: false, attribute: 'context' },
noShadow: { type: 'Boolean', attribute: 'no-shadow', reflect: false },
compoundConfig: {
activeFeatureToggleList: { type: 'Array', reflect: false, attribute: 'active-feature-toggle-list' },
anchor: { type: 'String', reflect: false, attribute: 'anchor' },
clientPermissions: {
type: 'Object',
reflect: false,
attribute: 'compound-config',
attribute: 'client-permissions',
},
nodeParams: { type: 'Object', reflect: false, attribute: 'node-params' },
userSettings: {
compoundConfig: {
type: 'Object',
reflect: false,
attribute: 'user-settings',
attribute: 'compound-config',
},
anchor: { type: 'String', reflect: false, attribute: 'anchor' },
context: { type: 'String', reflect: false, attribute: 'context' },
deferInit: { type: 'Boolean', attribute: 'defer-init' },
dirtyStatus: { type: 'Boolean', reflect: false, attribute: 'dirty-status'},
documentTitle: {type: 'String', reflect: false, attribute: 'document-title'},
hasBack: { type: 'Boolean', reflect: false, attribute: 'has-back'},
locale: { type: 'String', reflect: false, attribute: 'locale' },
noShadow: { type: 'Boolean', attribute: 'no-shadow', reflect: false },
nodeParams: { type: 'Object', reflect: false, attribute: 'node-params' },
pathParams: { type: 'Object', reflect: false, attribute: 'path-params' },
searchParams: {
type: 'Object',
reflect: false,
attribute: 'search-params',
},
pathParams: { type: 'Object', reflect: false, attribute: 'path-params' },
clientPermissions: {
theme: { type: 'String', reflect: false, attribute: 'theme' },
userSettings: {
type: 'Object',
reflect: false,
attribute: 'client-permissions',
attribute: 'user-settings',
},
dirtyStatus: { type: 'Boolean', reflect: false, attribute: 'dirty-status'},
hasBack: { type: 'Boolean', reflect: false, attribute: 'has-back'},
documentTitle: {type: 'String', reflect: false, attribute: 'document-title'},
locale: { type: 'String', reflect: false, attribute: 'locale' },
viewurl: { type: 'String', reflect: false, attribute: 'viewurl' }
},
extend: (customElementConstructor) => {
let notInitFn = (name) => {
Expand Down Expand Up @@ -65,22 +67,24 @@
import { Events } from './constants/communication';
import { GenericHelperFunctions } from './utilities/helpers';
export let viewurl: string;
export let webcomponent: any;
export let activeFeatureToggleList: string[];
export let anchor: string;
export let clientPermissions: any;
export let compoundConfig: any;
export let context: string;
export let deferInit: boolean;
export let dirtyStatus: boolean;
export let documentTitle: string;
export let hasBack: boolean;
export let locale: string;
export let noShadow: boolean;
export let compoundConfig: any;
export let nodeParams: any;
export let searchParams: any;
export let pathParams: any;
export let clientPermissions: any;
export let searchParams: any;
export let theme: string;
export let userSettings: any;
export let anchor: string;
export let dirtyStatus: boolean;
export let hasBack: boolean;
export let documentTitle: string;
export let locale: string;
export let viewurl: string;
export let webcomponent: any;
let containerInitialized = false;
let mainComponent: HTMLElement;
Expand All @@ -92,17 +96,19 @@
// Only needed for get rid of "unused export property" svelte compiler warnings
export const unwarn = () => {
return (
locale &&
nodeParams &&
searchParams &&
pathParams &&
clientPermissions &&
userSettings &&
activeFeatureToggleList &&
anchor &&
clientPermissions &&
dirtyStatus &&
hasBack &&
documentTitle &&
noShadow
hasBack &&
locale &&
noShadow &&
nodeParams &&
pathParams &&
searchParams &&
theme &&
userSettings
);
};
Expand Down Expand Up @@ -178,4 +184,4 @@
height: 100%;
border: none;
}
</style>
</style>
86 changes: 43 additions & 43 deletions container/src/LuigiContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
tag: null,
shadow: 'none',
props: {
viewurl: { type: 'String', reflect: false, attribute: 'viewurl' },
deferInit: { type: 'Boolean', attribute: 'defer-init' },
noShadow: { type: 'Boolean', attribute: 'no-shadow' },
context: { type: 'String', reflect: false, attribute: 'context' },
label: { type: 'String', reflect: false, attribute: 'label' },
webcomponent: { type: 'String', reflect: false, attribute: 'webcomponent' },
locale: { type: 'String', reflect: false, attribute: 'locale' },
theme: { type: 'String', reflect: false, attribute: 'theme' },
activeFeatureToggleList: { type: 'Array', reflect: false, attribute: 'active-feature-toggle-list' },
skipInitCheck: { type: 'Boolean', reflect: false, attribute: 'skip-init-check' },
nodeParams: { type: 'Object', reflect: false, attribute: 'node-params' },
userSettings: { type: 'Object', reflect: false, attribute: 'user-settings' },
allowRules: { type: 'Array', reflect: false, attribute: 'allow-rules' },
anchor: { type: 'String', reflect: false, attribute: 'anchor' },
searchParams: { type: 'Object', reflect: false, attribute: 'search-params' },
pathParams: { type: 'Object', reflect: false, attribute: 'path-params' },
authData: { type: 'Object', reflect: false, attribute: 'auth-data' },
clientPermissions: { type: 'Object', reflect: false, attribute: 'client-permissions' },
context: { type: 'String', reflect: false, attribute: 'context' },
deferInit: { type: 'Boolean', attribute: 'defer-init' },
dirtyStatus: { type: 'Boolean', reflect: false, attribute: 'dirty-status' },
hasBack: { type: 'Boolean', reflect: false, attribute: 'has-back' },
documentTitle: { type: 'String', reflect: false, attribute: 'document-title' },
allowRules: { type: 'Array', reflect: false, attribute: 'allow-rules' },
hasBack: { type: 'Boolean', reflect: false, attribute: 'has-back' },
label: { type: 'String', reflect: false, attribute: 'label' },
locale: { type: 'String', reflect: false, attribute: 'locale' },
noShadow: { type: 'Boolean', attribute: 'no-shadow' },
nodeParams: { type: 'Object', reflect: false, attribute: 'node-params' },
pathParams: { type: 'Object', reflect: false, attribute: 'path-params' },
sandboxRules: { type: 'Array', reflect: false, attribute: 'sandbox-rules' },
authData: { type: 'Object', reflect: false, attribute: 'auth-data' }
searchParams: { type: 'Object', reflect: false, attribute: 'search-params' },
skipInitCheck: { type: 'Boolean', reflect: false, attribute: 'skip-init-check' },
theme: { type: 'String', reflect: false, attribute: 'theme' },
userSettings: { type: 'Object', reflect: false, attribute: 'user-settings' },
viewurl: { type: 'String', reflect: false, attribute: 'viewurl' },
webcomponent: { type: 'String', reflect: false, attribute: 'webcomponent' }
},
extend: customElementConstructor => {
let notInitFn = name => {
Expand Down Expand Up @@ -62,29 +62,28 @@
import { GenericHelperFunctions } from './utilities/helpers';
import { getAllowRules } from './services/iframe-helpers';
export let viewurl: string;
export let activeFeatureToggleList: string[];
export let allowRules: string[];
export let anchor: string;
export let authData: any;
export let clientPermissions: any;
export let context: string;
export let label: string;
export let webcomponent: any;
export let deferInit: boolean;
export let noShadow: Boolean;
export let dirtyStatus: boolean;
export let documentTitle: string;
export let hasBack: boolean;
export let label: string;
export let locale: string;
export let theme: string;
export let activeFeatureToggleList: string[];
export let skipInitCheck: boolean;
export let noShadow: Boolean;
export let nodeParams: any;
export let searchParams: any;
export let pathParams: any;
export let clientPermissions: any;
export let dirtyStatus: boolean;
export let hasBack: boolean;
export let documentTitle: string;
export let allowRules: string[];
export let sandboxRules: string[];
export let searchParams: any;
export let skipInitCheck: boolean;
export let theme: string;
export let userSettings: any;
export let anchor: string;
export let authData: any;
export let viewurl: string;
export let webcomponent: any;
const iframeHandle:
| {
Expand All @@ -100,22 +99,23 @@
// Only needed for get rid of "unused export property" svelte compiler warnings
export const unwarn = () => {
return (
locale &&
theme &&
activeFeatureToggleList &&
nodeParams &&
searchParams &&
pathParams &&
clientPermissions &&
userSettings &&
allowRules &&
anchor &&
authData &&
clientPermissions &&
dirtyStatus &&
hasBack &&
documentTitle &&
allowRules &&
hasBack &&
locale &&
noShadow &&
nodeParams &&
pathParams &&
sandboxRules &&
noShadow
searchParams &&
skipInitCheck &&
theme &&
userSettings
);
};
Expand Down Expand Up @@ -213,7 +213,7 @@
height: 100%;
border: none;
}
main.lui-isolated {
line-height: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions container/test-app/compound/compoundClientAPI.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ <h3>
<luigi-compound-container
data-test-id="luigi-client-api-test-compound-01"
id="dashboard"
active-feature-toggle-list='["ft1", "ft2"]'
context='{"label": "Dashboard"}'
node-params='{"Luigi":"rocks"}'
search-params='{"test":"searchParam1"}'
Expand All @@ -35,6 +36,7 @@ <h3>
anchor="testAnchorCompound"
defer-init="false"
webcomponent="true"
theme="sap_fiori_3"
></luigi-compound-container>
</div>

Expand Down
29 changes: 29 additions & 0 deletions container/test-app/compound/helloWorldWC.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export default class extends HTMLElement {
const getAnchorBtn = document.createElement('template');
getAnchorBtn.innerHTML = '<button id="getAnchor">getAnchor</button>';

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

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

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

Expand Down Expand Up @@ -97,6 +103,8 @@ 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(getFeatureToggleListBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getThemeBtn.content.cloneNode(true));
this._shadowRoot.appendChild(getDirtyStatusBtn.content.cloneNode(true));
this._shadowRoot.appendChild(retrieveContextValueBtn.content.cloneNode(true));
this._shadowRoot.appendChild(uxManagerMultipleRequestsBtn.content.cloneNode(true));
Expand Down Expand Up @@ -188,6 +196,7 @@ export default class extends HTMLElement {
});
}
});

this.$getAnchorBtn = this._shadowRoot.querySelector('#getAnchor');
this.$getAnchorBtn.addEventListener('click', () => {
let getAnchor = this.LuigiClient.getAnchor();
Expand All @@ -197,6 +206,26 @@ export default class extends HTMLElement {
});
});

this.$getFeatureToggleListBtn = this._shadowRoot.querySelector('#getFeatureToggleList');
this.$getFeatureToggleListBtn.addEventListener('click', () => {
const activeFeatureToggleList = this.LuigiClient.getActiveFeatureToggles();

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

this.$getThemeBtn = this._shadowRoot.querySelector('#getTheme');
this.$getThemeBtn.addEventListener('click', () => {
const currentTheme = this.LuigiClient.uxManager().getCurrentTheme();

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

this.$getDirtyStatusBtn = this._shadowRoot.querySelector('#getDirtyStatus');
this.$getDirtyStatusBtn.addEventListener('click', () => {
let dirtyStatus = this.LuigiClient.uxManager().getDirtyStatus();
Expand Down
Loading

0 comments on commit f90f58c

Please sign in to comment.