summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-12-08 17:24:30 +0000
committerFilipa Lacerda <filipa@gitlab.com>2016-12-08 17:29:25 +0000
commit67c2e741195083b9c9d5d5f741c7909d22bc988b (patch)
tree894440b57ce47a30335730ec3e2f7b7e935d5083 /spec
parentef5667204f28000cc66f258b199239b883230e32 (diff)
downloadgitlab-ce-67c2e741195083b9c9d5d5f741c7909d22bc988b.tar.gz
Adds tests for Custom Event polyfill
Update changelog with MR ID
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/lib/utils/custom_event_polyfill_spec.js.es643
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/custom_event_polyfill_spec.js.es6 b/spec/javascripts/lib/utils/custom_event_polyfill_spec.js.es6
new file mode 100644
index 00000000000..ad51367bb32
--- /dev/null
+++ b/spec/javascripts/lib/utils/custom_event_polyfill_spec.js.es6
@@ -0,0 +1,43 @@
+//= 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);
+ });
+});