adding render scheme

This commit is contained in:
metacryst
2024-03-18 04:43:57 +01:00
parent 7f12cf439b
commit 802a39f502
5 changed files with 175 additions and 78 deletions

View File

@@ -2,12 +2,12 @@ window.testSuites.push( class testParse {
testParseClassFieldsWithNoDefault() {
class Space extends HTMLElement {
class Space extends Shadow {
form
contents = []
constructor() {
super()
constructor(...params) {
super(...params)
}
}
@@ -18,7 +18,7 @@ testParseClassFieldsWithNoDefault() {
}
testParseClassFieldsWithEqualityCheck() {
class Space extends HTMLElement {
class Space extends Shadow {
form = Forms.observe(window.location.pathname, this)
contents = [
@@ -34,8 +34,8 @@ testParseClassFieldsWithEqualityCheck() {
})
]
constructor() {
super()
constructor(...params) {
super(...params)
}
}
@@ -46,7 +46,7 @@ testParseClassFieldsWithEqualityCheck() {
}
testParseClassFieldsWithInnerFunctionVariable() {
class Space extends HTMLElement {
class Space extends Shadow {
form = Forms.observe(window.location.pathname, this)
contents = [
@@ -64,8 +64,8 @@ testParseClassFieldsWithInnerFunctionVariable() {
})
]
constructor() {
super()
constructor(...params) {
super(...params)
}
}

37
Test/shadow.test.js Normal file
View File

@@ -0,0 +1,37 @@
window.testSuites.push( class testShadow {
testObjectAsStateField() {
class File extends Shadow {
$form
constructor(...params) {
super(...params)
}
}
window.register(File, "file-el")
let form = {data: "asdf"}
const el = window.File(form)
console.log(el, el.$form, el._form)
if(!(el.form === form)) {
return `State field does not match object passed in!`
}
}
testRegisterThrowsIfNoConstructorParams() {
class File2 extends Shadow {
$form
constructor() {
super()
}
}
try {
window.register(File2, "file2-el")
} catch(e) {}
return "Error not thrown!"
}
})

View File

@@ -2,6 +2,7 @@ console.log("Tests initializing.")
window.testSuites = [];
import ("./parse.test.js")
import ("./shadow.test.js")
window.test = async function() {
// window.testSuites.sort();