Minimal first working version

This commit is contained in:
Blue 2023-09-08 16:52:21 -03:00
parent 038cdb8596
commit 7850b0eaa9
Signed by: blue
GPG key ID: 9B203B252A63EE38
12 changed files with 1241 additions and 0 deletions

3
test/background.css Normal file
View file

@ -0,0 +1,3 @@
html {
background-color: #c0c0f0;
}

13
test/index.html Normal file
View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../browser.js"></script>
<script src="index.js" defer></script>
</head>
<body>
Initial page
</body>
</html>

44
test/index.js Normal file
View file

@ -0,0 +1,44 @@
"use strict";
test();
function test () {
if (!Mimicry) {
log("Mimicry class was not loaded");
return;
}
log("Mimicry class is loaded");
log("Mimicry ready: " + Mimicry.ready);
let mimicry;
try {
mimicry = new Mimicry();
window.mimicry = mimicry;
log("Mimicry was successfully instantiated");
} catch (e) {
log("Error instantiating Mimicry");
return;
}
try {
mimicry.module(["module"], function (global, [module]) {
log("Mimicry empty module successfully resolved");
log("The background now is supposed to be bluish if you're testing in browser")
if (module === true)
log("Value returned from additional module is correct");
else
log("Value returned from additional module is \"" + module + "\", which is incorrect");
});
log("Successfully launched Mimicry empty module");
} catch (e) {
log("Error launching Mimicry empty module");
//return;
}
}
function log (message) {
const node = document.createTextNode(message);
const br = document.createElement("br");
document.body.appendChild(node);
document.body.appendChild(br);
}

12
test/index_main.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../browser.js" data-main="index.js"></script>
</head>
<body>
Initial page
</body>
</html>

7
test/module.js Normal file
View file

@ -0,0 +1,7 @@
"use strict";
mimicry.module([
"terminalModule",
"background", Mimicry.Type.css
], function (global, [terminalModule]) {
return terminalModule === "terminal";
});

3
test/terminalModule.js Normal file
View file

@ -0,0 +1,3 @@
mimicry.module(() => {
return "terminal";
});