create OO with default values, adding triangle
This commit is contained in:
@@ -272,7 +272,7 @@ window.testSuites.push( class testInit {
|
||||
}
|
||||
|
||||
try {
|
||||
let space = ChildSpace(Form.decode({path: "/asd"}))
|
||||
let space = ChildSpace(Form.create({path: "/asd"}))
|
||||
} catch(e) {
|
||||
if(e.message.includes("Cannot read properties of undefined (reading 'path')")) {
|
||||
return "Form did not get initialized!"
|
||||
|
||||
@@ -8,7 +8,7 @@ window.testSuites.push( class testObservedObject {
|
||||
}
|
||||
|
||||
try {
|
||||
let obj = Form.decode({id: "123"})
|
||||
let obj = Form.create({id: "123"})
|
||||
return "Not implemented"
|
||||
} catch {}
|
||||
}
|
||||
@@ -20,14 +20,23 @@ window.testSuites.push( class testObservedObject {
|
||||
$canvasPosition
|
||||
}
|
||||
|
||||
let obj = Form.decode({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
let obj = Form.create({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
if(!(obj && obj["id"] === "123" && obj["path"] === "/" && obj["canvasPosition"] === "25|25")) {
|
||||
return "Not all fields initialized!"
|
||||
}
|
||||
}
|
||||
|
||||
ConstructorWorks() {
|
||||
return "not done"
|
||||
DefaultValueWorks() {
|
||||
class WindowState extends ObservedObject {
|
||||
$sidebarOut = false
|
||||
}
|
||||
|
||||
let obj = WindowState.create()
|
||||
console.log(obj)
|
||||
|
||||
if(obj.sidebarOut !== false) {
|
||||
return "Default field not set"
|
||||
}
|
||||
}
|
||||
|
||||
NotExtensible() {
|
||||
@@ -41,7 +50,7 @@ window.testSuites.push( class testObservedObject {
|
||||
// $canvasPosition
|
||||
// }
|
||||
|
||||
// let obj = Form.decode({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
// let obj = Form.create({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
// if(!(obj && obj["id"] === "123" && obj["path"] === "/" && obj["canvasPosition"] === "25|25")) {
|
||||
// return "Not all fields initialized!"
|
||||
// }
|
||||
@@ -55,7 +64,7 @@ window.testSuites.push( class testObservedObject {
|
||||
// }
|
||||
|
||||
// let json = {id: "123", path: "/", canvasPosition: "25|25"}
|
||||
// let obj = Form.decode({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
// let obj = Form.create({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
// json.id = "456"
|
||||
// if(!(obj["id"] === "456")) {
|
||||
// return "Change to original object was not reflected!"
|
||||
|
||||
@@ -79,7 +79,7 @@ window.testSuites.push( class testRender {
|
||||
}
|
||||
|
||||
class File extends Shadow {
|
||||
$$form = Form.decode({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
$$form = Form.create({id: "123", path: "/", canvasPosition: "25|25"})
|
||||
|
||||
render = () => {
|
||||
p(this.form.path)
|
||||
@@ -101,7 +101,7 @@ window.testSuites.push( class testRender {
|
||||
$canvasPosition
|
||||
}
|
||||
|
||||
let object = Form.decode({id: "123", path: "/", canvasPosition: "25|25"});
|
||||
let object = Form.create({id: "123", path: "/", canvasPosition: "25|25"});
|
||||
|
||||
register(class File extends Shadow {
|
||||
$$form
|
||||
@@ -132,7 +132,7 @@ window.testSuites.push( class testRender {
|
||||
$children
|
||||
}
|
||||
|
||||
let object = Form.decode({id: "123", children: [{path: "berry"}, {path: "blue"}]});
|
||||
let object = Form.create({id: "123", children: [{path: "berry"}, {path: "blue"}]});
|
||||
|
||||
register(class File extends Shadow {
|
||||
$$form
|
||||
|
||||
Reference in New Issue
Block a user