@whatwg-node/events
Advanced tools
Comparing version 0.1.0 to 0.1.1-alpha-20230525101758-552afdd
# @whatwg-node/events | ||
## 0.1.1-alpha-20230525101758-552afdd | ||
### Patch Changes | ||
- [#554](https://github.com/ardatan/whatwg-node/pull/554) | ||
[`552afdd`](https://github.com/ardatan/whatwg-node/commit/552afdd156de29d1f0bb3f2d172e3189c4dd7c6f) | ||
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Follow the spec and set `detail` to null by default | ||
## 0.1.0 | ||
@@ -4,0 +12,0 @@ |
@@ -6,5 +6,5 @@ module.exports.CustomEvent = globalThis.CustomEvent; | ||
super(type, options); | ||
this.detail = options && options.detail; | ||
this.detail = options?.detail ?? null; | ||
} | ||
} | ||
} |
{ | ||
"name": "@whatwg-node/events", | ||
"version": "0.1.0", | ||
"version": "0.1.1-alpha-20230525101758-552afdd", | ||
"description": "Cross Platform Smart Event API Ponyfill", | ||
@@ -5,0 +5,0 @@ "repository": { |
import { CustomEvent } from '@whatwg-node/events'; | ||
describe('CustomEvent', () => { | ||
it('detail', () => { | ||
it('detail should be set', () => { | ||
const target = new EventTarget(); | ||
@@ -11,2 +11,9 @@ const listener = jest.fn(); | ||
}); | ||
it('detail should be null by default', () => { | ||
const target = new EventTarget(); | ||
const listener = jest.fn(); | ||
target.addEventListener('test', listener); | ||
target.dispatchEvent(new CustomEvent('test')); | ||
expect(listener).toHaveBeenCalledWith(expect.objectContaining({ detail: null })); | ||
}) | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4525
31