-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add container cypress tests getNodeParams et.al (#3996)
Co-authored-by: Anna Milewska <[email protected]>
- Loading branch information
1 parent
c31db2c
commit ba42c68
Showing
8 changed files
with
155 additions
and
16 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
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
41 changes: 41 additions & 0 deletions
41
container/test-app/compound/luigi-client-init-wc/luigi-client-init-wc.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,41 @@ | ||
import { LuigiElement } from './../luigi-element.js'; | ||
export default class extends LuigiElement { | ||
constructor() { | ||
super({ openShadow: 'open', deferLuigiClientWCInit: false }); | ||
const template = document.createElement('template'); | ||
|
||
//remove buttons after review/AC | ||
template.innerHTML = ` | ||
<section style="display: flex; height: 100%; flex-direction: column"> | ||
<button id="addNodeParams">addNodeParams</button> | ||
<button id="getNodeParams">getNodeParams</button> | ||
<header><slot name="header">header</slot></header> | ||
<main style="flex: auto; overflow: auto"> | ||
<slot name="content">content</slot> | ||
<slot name="helloWorldSelfRegistered"></slot> | ||
</main> | ||
<footer><slot name="footer">footer</slot></footer> | ||
</section> | ||
`; | ||
this._shadowRoot.appendChild(template.content.cloneNode(true)); | ||
this.$button = this._shadowRoot.querySelector('#addNodeParams'); | ||
this.$button.addEventListener('click', () => { | ||
this.LuigiClient.addNodeParams({ Luigi: 'rocks' }, true); | ||
}); | ||
this.$button2 = this._shadowRoot.querySelector('#getNodeParams'); | ||
this.$button2.addEventListener('click', () => { | ||
console.log('getNodeParams', this.LuigiClient.getNodeParams()); | ||
}); | ||
} | ||
|
||
connectedCallback() { | ||
setTimeout(() => { | ||
this.LuigiClient.luigiClientInit(); | ||
console.log('LuigiClient initialized for LuigiElement Compount WC'); | ||
}, 8000); | ||
} | ||
|
||
set context(ctx) { | ||
console.log('context', ctx); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
container/test-app/iframe/microfrontend-luigi-client-init.html
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,34 @@ | ||
<!-- This microfrontend HTML file is used to test luigi-client-init functionality --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Luigi Client Init Test</title> | ||
<script src="./luigi-client.js"></script> | ||
<script> | ||
setTimeout(() => testIsLuigiClientInitialized(), 2000); | ||
|
||
function testLuigiClientInit() { | ||
LuigiClient.luigiClientInit(); | ||
} | ||
|
||
function testIsLuigiClientInitialized() { | ||
const isInitialized = LuigiClient.isLuigiClientInitialized(); | ||
console.log('isInitialized: ' + isInitialized); | ||
if (document.getElementById('luigiClientStatus')) { | ||
document.getElementById('luigiClientStatus').innerText = `Luigi Client Initialized: ${isInitialized}`; | ||
|
||
} | ||
return isInitialized; | ||
} | ||
</script> | ||
</head> | ||
<body style="border: solid green 2px;"> | ||
<div> | ||
<h1>Luigi Client Init Test for Iframes</h1> | ||
<button id="testLuigiClientInitButton" onclick="testLuigiClientInit()">Test luigiClientInit</button> | ||
<button id="testIsLuigiClientInitializedButton" onclick="testIsLuigiClientInitialized()">Test isLuigiClientInitialized</button> | ||
<p id="luigiClientStatus">Luigi Client Initialized: Unknown</p> | ||
</div> | ||
</body> | ||
</html> |
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