Skip to content

Commit

Permalink
Add test for noChange on properties
Browse files Browse the repository at this point in the history
  • Loading branch information
justinfagnani authored and augustjk committed Jan 10, 2024
1 parent 5c8b142 commit 8425db0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/lit-html/src/test/lit-html_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,16 @@ suite('lit-html', () => {
assert.strictEqual((div as any).foo, undefined);
});

test('noChange does not set property', () => {
const go = (v: any) => render(html`<div id="a" .tabIndex=${v}></div>`, container);

go(noChange);
const div = container.querySelector('div')!;

// If noChange has been interpreted as undefined, tabIndex would be 0
assert.strictEqual(div.tabIndex, -1);
});

test('null sets null', () => {
const go = (v: any) => render(html`<div .foo=${v}></div>`, container);

Expand Down

0 comments on commit 8425db0

Please sign in to comment.