Skip to content

Commit 42f7a61

Browse files
committed
Test that decendants are defined in connectedCallback
1 parent 1896dcf commit 42f7a61

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/controller.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,20 @@ describe('controller', () => {
7676

7777
expect(instance.foo).to.have.been.called(1)
7878
})
79+
80+
it('upgrades child decendants when connected', done => {
81+
controller(class ChildElementElement extends HTMLElement {})
82+
controller(
83+
class ParentElementElement extends HTMLElement {
84+
connectedCallback() {
85+
const child = this.querySelector('child-element')
86+
expect(child.matches(':defined')).to.equal(true)
87+
done()
88+
}
89+
}
90+
)
91+
92+
// eslint-disable-next-line github/unescaped-html-literal
93+
document.body.innerHTML = '<parent-element><child-element></child-element></parent-element>'
94+
})
7995
})

0 commit comments

Comments
 (0)