Skip to content

Commit

Permalink
Resolves conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn committed Sep 24, 2024
2 parents 1c49922 + d100202 commit 7839f3e
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,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
6 changes: 6 additions & 0 deletions container/src/LuigiCompoundContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
tag: null,
shadow: 'none',
props: {
activeFeatureToggleList: { type: 'Array', reflect: false, attribute: 'active-feature-toggle-list' },
anchor: { type: 'String', reflect: false, attribute: 'anchor' },
clientPermissions: {
type: 'Object',
Expand All @@ -28,6 +29,7 @@
attribute: 'search-params',
},
skipInitCheck: { type: 'Boolean', reflect: false, attribute: 'skip-init-check' },
theme: { type: 'String', reflect: false, attribute: 'theme' },
userSettings: {
type: 'Object',
reflect: false,
Expand Down Expand Up @@ -65,6 +67,7 @@
import { Events } from './constants/communication';
import { GenericHelperFunctions } from './utilities/helpers';
export let activeFeatureToggleList: string[];
export let anchor: string;
export let clientPermissions: any;
export let compoundConfig: any;
Expand All @@ -78,6 +81,7 @@
export let pathParams: any;
export let searchParams: any;
export let skipInitCheck: boolean;
export let theme: string;
export let userSettings: any;
export let viewurl: string;
export let webcomponent: any;
Expand All @@ -92,6 +96,7 @@
// Only needed for get rid of "unused export property" svelte compiler warnings
export const unwarn = () => {
return (
activeFeatureToggleList &&
anchor &&
clientPermissions &&
dirtyStatus &&
Expand All @@ -102,6 +107,7 @@
pathParams &&
searchParams &&
skipInitCheck &&
theme &&
userSettings
);
};
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 @@ -36,6 +37,7 @@ <h3>
defer-init="false"
skip-init-check="true"
webcomponent="true"
theme="sap_fiori_3"
></luigi-compound-container>
</div>

Expand Down
28 changes: 28 additions & 0 deletions container/test-app/compound/helloWorldWC.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export default class extends HTMLElement {
const getSkipInitCheckBtn = document.createElement('template');
getSkipInitCheckBtn.innerHTML = '<button id="getSkipInitCheck">getSkipInitCheck</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 @@ -101,6 +107,8 @@ export default class extends HTMLElement {
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));
this._shadowRoot.appendChild(retrieveContextValueBtn.content.cloneNode(true));
this._shadowRoot.appendChild(uxManagerMultipleRequestsBtn.content.cloneNode(true));
Expand Down Expand Up @@ -212,6 +220,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
18 changes: 18 additions & 0 deletions container/typings/LuigiCompoundContainer.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default class LuigiCompoundContainer extends HTMLElement {
*/
deferInit: boolean;

/**
* The parameters to be passed to the compound micro frontend. Will not be passed to the compound children.
* @since 1.0.0
*/
nodeParams: Object;

/**
* If set to true, the Luigi compound container webcomponent will not use the shadow DOM for rendering.
* @since 1.2.0
Expand Down Expand Up @@ -103,6 +109,18 @@ export default class LuigiCompoundContainer extends HTMLElement {
*/
skipInitCheck: boolean;

/**
* The list of active feature toggles to be passed to the compound microfrontend.
* @since NEXT_RELEASE_CONTAINER
*/
activeFeatureToggleList: string[];

/**
* The theme to be passed to the compound microfrontend.
* @since NEXT_RELEASE_CONTAINER
*/
theme: string;

/**
* Function that updates the context of the compound microfrontend.
* @param contextObj The context data
Expand Down
2 changes: 1 addition & 1 deletion container/typings/LuigiContainer.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class LuigiContainer extends HTMLElement {
skipInitCheck: boolean;

/**
* The parameters to be passed to the web-component-based micro frontend. Will not be passed to the compound children.
* The parameters to be passed to the web-component-based micro frontend.
* @since 1.0.0
*/
nodeParams: Object;
Expand Down
30 changes: 30 additions & 0 deletions docs/luigi-compound-container-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob

* **since**: 1.0.0

### nodeParams

The parameters to be passed to the compound micro frontend. Will not be passed to the compound children.

Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

**Meta**

* **since**: 1.0.0

### noShadow

If set to true, the Luigi compound container webcomponent will not use the shadow DOM for rendering.
Expand Down Expand Up @@ -178,6 +188,26 @@ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob

**Meta**

* **since**: 1.0.0

### activeFeatureToggleList

The list of active feature toggles to be passed to the compound microfrontend.

Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>

**Meta**

* **since**: NEXT_RELEASE_CONTAINER

### theme

The theme to be passed to the compound microfrontend.

Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

**Meta**

* **since**: NEXT_RELEASE_CONTAINER

### updateContext
Expand Down
2 changes: 1 addition & 1 deletion docs/luigi-container-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob

### nodeParams

The parameters to be passed to the web-component-based micro frontend. Will not be passed to the compound children.
The parameters to be passed to the web-component-based micro frontend.

Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

Expand Down

0 comments on commit 7839f3e

Please sign in to comment.