-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add getCurrentTheme wc clientAPI (#3774)
- Loading branch information
1 parent
ffd9837
commit fdcd447
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
test/e2e-js-test-application/public/examples/microfrontends/getCurrentThemeWC.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default class ExampleWC extends HTMLElement { | ||
constructor() { | ||
super(); | ||
const getCurrentThemeBtn = document.createElement('template'); | ||
getCurrentThemeBtn.innerHTML = '<button id="getCurrentTheme">getCurrentTheme</button>'; | ||
|
||
const templateSpan = document.createElement('template'); | ||
templateSpan.innerHTML = '<span class="wc-testing-span"></span>'; | ||
|
||
this._shadowRoot = this.attachShadow({ | ||
mode: 'open', | ||
delegatesFocus: false | ||
}); | ||
this._shadowRoot.appendChild(getCurrentThemeBtn.content.cloneNode(true)); | ||
this._shadowRoot.appendChild(templateSpan.content.cloneNode(true)); | ||
|
||
this.$getCurrentThemeBtn = this._shadowRoot.querySelector('#getCurrentTheme'); | ||
this.$getCurrentThemeBtn.addEventListener('click', async () => { | ||
if (this.LuigiClient) { | ||
try { | ||
this._shadowRoot.querySelector('span').innerHTML = JSON.stringify( | ||
this.LuigiClient.uxManager().getCurrentTheme() | ||
); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters