Repository navigation
Fix tests yielding false positives. - #372
Merged
Merged
Conversation
A couple of tests were not really testing anything due to using `=`
instead of `===` inside the `assert` call.
One test remained passing, the other needed an update, which is
described below.
```js
// old test code
html`<div .onclick="${'function() { this.textContent = \'…hi\u2026\'; }'}"></div>`
```
```js
// new test code
html`<div .onclick="${function() { this.textContent = '…hi\u2026'; }}"></div>`
```
The old test code never quite made sense as according to the
[specification](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes),
a string would be coerced to `null` and then of course no event handling
would occur (which happens as expected).
In other words…
```js
element.onclick = () => { console.log('hi'); }
element.onclick
// () => { console.log('hi'); }
element.click();
// hi
element.onclick = "() => { console.log('hi'); }"
element.onclick
// null
element.click();
// (nothing is logged)
```
Closes #371.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A couple of tests were not really testing anything due to using
=instead of===inside theassertcall.One test remained passing, the other needed an update, which is described below.
The old test code never quite made sense as according to the specification, a string would be coerced to
nulland then of course no event handling would occur (which happens as expected).In other words…
Closes #371.