Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Aug 31, 2023
1 parent e9d6fea commit b22171f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ describe('render()', () => {
expect(scratch.firstChild).to.have.property('nodeName', 'X-BAR');
});

it('should not register non-function event handlers', () => {
const proto = Element.prototype;
proto.addEventListener.resetHistory();
render(
<x-bar
only-overflow={true}

Check failure on line 138 in test/browser/render.test.js

View workflow job for this annotation

GitHub Actions / Build & Test

Value must be omitted for boolean attributes

Check failure on line 138 in test/browser/render.test.js

View workflow job for this annotation

GitHub Actions / Build & Test / Build & Test

Value must be omitted for boolean attributes
onChange={() => {
console.log('Change');

Check warning on line 140 in test/browser/render.test.js

View workflow job for this annotation

GitHub Actions / Build & Test

Unexpected console statement

Check warning on line 140 in test/browser/render.test.js

View workflow job for this annotation

GitHub Actions / Build & Test / Build & Test

Unexpected console statement
}}
/>,
scratch
);

expect(proto.addEventListener).to.have.been.calledOnce;
expect(scratch.childNodes).to.have.length(1);
expect(scratch.firstChild).to.have.property('nodeName', 'X-BAR');
});

it('should support the form attribute', () => {
render(
<div>
Expand Down

0 comments on commit b22171f

Please sign in to comment.