Commit 67c2e741 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds tests for Custom Event polyfill

Update changelog with MR ID
parent ef566720
---
title: Adds tests for custom event polyfill
merge_request: 7996
author:
//= require lib/utils/custom_event_polyfill
describe('Custom Event Polyfill', () => {
it('should be defined', () => {
expect(window.CustomEvent).toBeDefined();
});
it('should create a `CustomEvent` instance', () => {
const e = new window.CustomEvent('foo');
expect(e.type).toEqual('foo');
expect(e.bubbles).toBe(false);
expect(e.cancelable).toBe(false);
expect(e.detail).toBe(null);
});
it('should create a `CustomEvent` instance with a `details` object', () => {
const e = new window.CustomEvent('bar', { detail: { foo: 'bar' } });
expect(e.type).toEqual('bar');
expect(e.bubbles).toBe(false);
expect(e.cancelable).toBe(false);
expect(e.detail.foo).toEqual('bar');
});
it('should create a `CustomEvent` instance with a `bubbles` boolean', () => {
const e = new window.CustomEvent('bar', { bubbles: true });
expect(e.type).toEqual('bar');
expect(e.bubbles).toBe(true);
expect(e.cancelable).toBe(false);
expect(e.detail).toBe(null);
});
it('should create a `CustomEvent` instance with a `cancelable` boolean', () => {
const e = new window.CustomEvent('bar', { cancelable: true });
expect(e.type).toEqual('bar');
expect(e.bubbles).toBe(false);
expect(e.cancelable).toBe(true);
expect(e.detail).toBe(null);
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment