test: added a react application test (in the browser)
This commit is contained in:
13
test/evaluated-web-bundle/fixtures/app.mjs
Normal file
13
test/evaluated-web-bundle/fixtures/app.mjs
Normal file
@@ -0,0 +1,13 @@
|
||||
export async function app({root}){
|
||||
|
||||
const states = ['started', 'tick', 'ended'];
|
||||
|
||||
for(let state of states){
|
||||
const text = `App ${state}`;
|
||||
console.log(`Test my sourcemap: ${text}`);
|
||||
root.innerHTML = `<div style="align-self: center"><b>${text}</b></div>`;
|
||||
await new Promise((resolve,reject)=>
|
||||
setTimeout(()=>resolve(), 10)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export const batman = 'bum badum badum baaaaa dum!';
|
||||
@@ -13,6 +13,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">Here the app should load!</div>
|
||||
<script src="./index.js" type="module"></script>
|
||||
<script src="./index.mjs" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
const [
|
||||
appModule,
|
||||
] = await Promise.all([
|
||||
import("./batman.js"),
|
||||
import("./app.mjs"),
|
||||
]);
|
||||
|
||||
console.log("Bootstrapped, ready to go!");
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
// Start the app!
|
||||
root.innerHTML = `<div style="align-self: center"><b>${appModule.batman}</b></div>`;
|
||||
await appModule.app({root});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
Reference in New Issue
Block a user