Skip to content

Commit 8f43e79

Browse files
committed
test: Copy test case from #71
1 parent 20c0460 commit 8f43e79

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/index.test.jsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,33 @@ describe('web components', () => {
130130
});
131131
assert.equal(other, 1);
132132
});
133+
134+
it('sets complex property after other property', () => {
135+
const el = document.createElement('x-dummy-button');
136+
137+
// set simple property first
138+
el.text = 'click me';
139+
140+
let clicks = 0;
141+
const onClick = () => clicks++;
142+
el.onClick = onClick;
143+
144+
assert.equal(el.text, 'click me');
145+
assert.equal(el.onClick, onClick);
146+
147+
root.appendChild(el);
148+
assert.equal(
149+
root.innerHTML,
150+
'<x-dummy-button text="click me"><button>click me</button></x-dummy-button>'
151+
);
152+
153+
act(() => {
154+
el.querySelector('button').click();
155+
});
156+
157+
assert.equal(el.onClick, onClick);
158+
assert.equal(clicks, 1);
159+
});
133160
});
134161

135162
function Foo({ text, children }) {
@@ -327,8 +354,7 @@ describe('web components', () => {
327354

328355
const child = document
329356
.querySelector('x-adopted-style-sheets')
330-
.shadowRoot
331-
.querySelector('.styled-child');
357+
.shadowRoot.querySelector('.styled-child');
332358

333359
const style = getComputedStyle(child);
334360
assert.equal(style.color, 'rgb(255, 0, 0)');

0 commit comments

Comments
 (0)