-
Notifications
You must be signed in to change notification settings - Fork 786
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime): throw proper error if component is loaded with invalid …
…runtime (#5675) * fix(runtime): throw proper error if component is loaded with invalid runtime * update comments * prettier * only run new test in Chromium * PR feedback
- Loading branch information
1 parent
3a33eff
commit 3cfbb8d
Showing
14 changed files
with
168 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component, h } from '@stencil/core'; | ||
|
||
/** | ||
* rendering this component will fail as `<attribute-basic /`> is compiled with | ||
* a `dist-custom-element` output target, which will break in a lazy load environment | ||
*/ | ||
@Component({ | ||
tag: 'global-script-dist-cmp', | ||
scoped: true, | ||
}) | ||
export class GlobalScriptDistCmp { | ||
render() { | ||
return ( | ||
<section> | ||
<attribute-basic></attribute-basic> | ||
</section> | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html dir="ltr" lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Stencil Starter App</title> | ||
<script type="module" src="/www-global-script/build/testglobalscript.esm.js"></script> | ||
</head> | ||
<body> | ||
<global-script-dist-cmp></global-script-dist-cmp> | ||
</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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
/** | ||
* Note: this file is meant to be run in the browser, not in Node.js. WebdriverIO | ||
* injects some basic polyfills for Node.js to make the following possible. | ||
*/ | ||
import path from 'node:path'; | ||
|
||
/** | ||
* A namespace for custom type definitions used in a portion of the testing suite | ||
*/ | ||
export declare namespace SomeTypes { | ||
type Number = number; | ||
type String = string; | ||
} | ||
|
||
export async function setupIFrameTest(htmlFile: string): Promise<HTMLElement> { | ||
if (document.querySelector('iframe')) { | ||
document.body.removeChild(document.querySelector('iframe')); | ||
} | ||
|
||
const htmlFilePath = path.resolve( | ||
path.dirname(globalThis.__wdioSpec__), | ||
'..', | ||
htmlFile.slice(htmlFile.startsWith('/') ? 1 : 0), | ||
); | ||
const iframe = document.createElement('iframe'); | ||
|
||
/** | ||
* Note: prefixes the absolute path to the html file with `/@fs` is a ViteJS (https://vitejs.dev/) | ||
* feature which allows to serve static content from files this way | ||
*/ | ||
iframe.src = `/@fs${htmlFilePath}`; | ||
iframe.width = '600px'; | ||
iframe.height = '600px'; | ||
document.body.appendChild(iframe); | ||
|
||
/** | ||
* wait for the iframe to load | ||
*/ | ||
await new Promise((resolve) => (iframe.onload = resolve)); | ||
return iframe.contentDocument.body; | ||
} |