Skip to content

Commit d352596

Browse files
authored
Merge pull request #297 from ryecroft/data_properties
Add failing test for default-valued properties
2 parents a874af9 + 5f8d9da commit d352596

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/attrable.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ describe('Attrable', () => {
1919
this.setCount += 1
2020
this.#bing = value
2121
}
22+
lastSetHasFoo: any
23+
@attr get hasFoo() {
24+
return false
25+
}
26+
set hasFoo(v: boolean) {
27+
this.lastSetHasFoo = v
28+
}
29+
connectedCallback() {
30+
this.hasFoo = true
31+
}
2232
}
2333
window.customElements.define('initialize-attr-test', InitializeAttrTest)
2434

@@ -104,6 +114,10 @@ describe('Attrable', () => {
104114
instance.bingBaz = 'universe'
105115
expect(instance).to.have.property('bingBaz', 'universe')
106116
})
117+
118+
it('updates default-valued properties in the connected callback', async () => {
119+
expect(instance).to.have.property('lastSetHasFoo', true)
120+
})
107121
}
108122

109123
describe('types', () => {

0 commit comments

Comments
 (0)