diff --git a/Test/shadow.test.js b/Test/shadow.test.js index 1e9136f..0cc9f70 100644 --- a/Test/shadow.test.js +++ b/Test/shadow.test.js @@ -205,5 +205,31 @@ window.testSuites.push( class testShadow { throw e } } - } + } + + FieldsInCorrectOrder() { + window.register(class ChildSpace extends Shadow { + $$form + $name + + render = () => { + + } + + constructor() { + super() + this.name = this.form.path.split("/").pop() + } + }, randomName("space-")) + + try { + let space = ChildSpace({path: "/asd"}) + } catch(e) { + if(e.message.includes("Cannot read properties of undefined (reading 'path')")) { + return "Form did not get initialized!" + } else { + throw e + } + } + } }) \ No newline at end of file diff --git a/index.js b/index.js index 8808122..4525d93 100644 --- a/index.js +++ b/index.js @@ -419,7 +419,7 @@ window.Registry = class Registry { makeState(elem, stateNames, params) makeObservedObjects(elem, observedObjectNames, params) - let allNamesCleaned = Object.keys(elem) + let allNamesCleaned = allNames .filter(key => typeof elem[key] !== 'function' && key !== "_observers" && key !== "_observedObjects") .map(key => key.replace(/^(\$\$|\$)/, ''));