test('handling properties set before upgrading', () => {
const E = defineCustomElement({
- props: ['foo'],
+ props: {
+ foo: String,
+ dataAge: Number
+ },
+ setup(props) {
+ expect(props.foo).toBe('hello')
+ expect(props.dataAge).toBe(5)
+ },
render() {
return `foo: ${this.foo}`
}
})
const el = document.createElement('my-el-upgrade') as any
el.foo = 'hello'
+ el.dataset.age = 5
container.appendChild(el)
customElements.define('my-el-upgrade', E)
expect(el.shadowRoot.innerHTML).toBe(`foo: hello`)
}
if (numberProps) {
this._numberProps = numberProps
- this._update()
+ // this._update()
}
// check if there are props set pre-upgrade or connect
const asyncDef = (this._def as ComponentOptions).__asyncLoader
if (asyncDef) {
- asyncDef().then(resolve)
+ asyncDef()
+ .then(resolve)
+ .then(() => this._update())
} else {
resolve(this._def)
}