summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-12-14 15:35:05 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2016-12-14 15:35:05 +0000
commit1fca9658ce3f136ec38f6550d5cf4d80a8773731 (patch)
tree6dd68b57156f1d8c47eea4cc14c638dfc6e30b08
parentabad9a9b41f549e9660ac21a978dca4033efa777 (diff)
parent7caab6c2ae6e8063472a224d846f9157c07dc53f (diff)
downloadgitlab-ce-1fca9658ce3f136ec38f6550d5cf4d80a8773731.tar.gz
Merge branch '24927-custom-event-polyfill-test' into 'master'
Adds tests for Custom Event polyfill ## What does this MR do? Adds tests for CustomEvent polyfill. ## Does this MR meet the acceptance criteria? - [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #24927 See merge request !7996
-rw-r--r--changelogs/unreleased/24927-custom-event-polyfill-test.yml4
-rw-r--r--spec/javascripts/lib/utils/custom_event_polyfill_spec.js.es643
2 files changed, 47 insertions, 0 deletions
diff --git a/changelogs/unreleased/24927-custom-event-polyfill-test.yml b/changelogs/unreleased/24927-custom-event-polyfill-test.yml
new file mode 100644
index 00000000000..879c28a951e
--- /dev/null
+++ b/changelogs/unreleased/24927-custom-event-polyfill-test.yml
@@ -0,0 +1,4 @@
+---
+title: Adds tests for custom event polyfill
+merge_request: 7996
+author:
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..3645dd70c55
--- /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).toBeFalsy();
+ });
+
+ 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).toBeFalsy();
+ });
+
+ 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).toBeFalsy();
+ });
+});