diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 02:13:26 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 11:18:17 -0500 |
commit | f666026d71ebefd70219d5078b1f0c83fa01f84d (patch) | |
tree | ce43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/landing_spec.js | |
parent | 5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff) | |
download | gitlab-ce-f666026d71ebefd70219d5078b1f0c83fa01f84d.tar.gz |
Prettify all spec files
Diffstat (limited to 'spec/javascripts/landing_spec.js')
-rw-r--r-- | spec/javascripts/landing_spec.js | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/spec/javascripts/landing_spec.js b/spec/javascripts/landing_spec.js index 7916073190a..2fe5a47b63e 100644 --- a/spec/javascripts/landing_spec.js +++ b/spec/javascripts/landing_spec.js @@ -1,9 +1,9 @@ import Landing from '~/landing'; import Cookies from 'js-cookie'; -describe('Landing', function () { - describe('class constructor', function () { - beforeEach(function () { +describe('Landing', function() { + describe('class constructor', function() { + beforeEach(function() { this.landingElement = {}; this.dismissButton = {}; this.cookieName = 'cookie_name'; @@ -11,25 +11,25 @@ describe('Landing', function () { this.landing = new Landing(this.landingElement, this.dismissButton, this.cookieName); }); - it('should set .landing', function () { + it('should set .landing', function() { expect(this.landing.landingElement).toBe(this.landingElement); }); - it('should set .cookieName', function () { + it('should set .cookieName', function() { expect(this.landing.cookieName).toBe(this.cookieName); }); - it('should set .dismissButton', function () { + it('should set .dismissButton', function() { expect(this.landing.dismissButton).toBe(this.dismissButton); }); - it('should set .eventWrapper', function () { + it('should set .eventWrapper', function() { expect(this.landing.eventWrapper).toEqual({}); }); }); - describe('toggle', function () { - beforeEach(function () { + describe('toggle', function() { + beforeEach(function() { this.isDismissed = false; this.landingElement = { classList: jasmine.createSpyObj('classList', ['toggle']) }; this.landing = { @@ -44,20 +44,20 @@ describe('Landing', function () { Landing.prototype.toggle.call(this.landing); }); - it('should call .isDismissed', function () { + it('should call .isDismissed', function() { expect(this.landing.isDismissed).toHaveBeenCalled(); }); - it('should call .classList.toggle', function () { + it('should call .classList.toggle', function() { expect(this.landingElement.classList.toggle).toHaveBeenCalledWith('hidden', this.isDismissed); }); - it('should call .addEvents', function () { + it('should call .addEvents', function() { expect(this.landing.addEvents).toHaveBeenCalled(); }); - describe('if isDismissed is true', function () { - beforeEach(function () { + describe('if isDismissed is true', function() { + beforeEach(function() { this.isDismissed = true; this.landingElement = { classList: jasmine.createSpyObj('classList', ['toggle']) }; this.landing = { @@ -74,14 +74,14 @@ describe('Landing', function () { Landing.prototype.toggle.call(this.landing); }); - it('should not call .addEvents', function () { + it('should not call .addEvents', function() { expect(this.landing.addEvents).not.toHaveBeenCalled(); }); }); }); - describe('addEvents', function () { - beforeEach(function () { + describe('addEvents', function() { + beforeEach(function() { this.dismissButton = jasmine.createSpyObj('dismissButton', ['addEventListener']); this.eventWrapper = {}; this.landing = { @@ -93,17 +93,20 @@ describe('Landing', function () { Landing.prototype.addEvents.call(this.landing); }); - it('should set .eventWrapper.dismissLanding', function () { + it('should set .eventWrapper.dismissLanding', function() { expect(this.eventWrapper.dismissLanding).toEqual(jasmine.any(Function)); }); - it('should call .addEventListener', function () { - expect(this.dismissButton.addEventListener).toHaveBeenCalledWith('click', this.eventWrapper.dismissLanding); + it('should call .addEventListener', function() { + expect(this.dismissButton.addEventListener).toHaveBeenCalledWith( + 'click', + this.eventWrapper.dismissLanding, + ); }); }); - describe('removeEvents', function () { - beforeEach(function () { + describe('removeEvents', function() { + beforeEach(function() { this.dismissButton = jasmine.createSpyObj('dismissButton', ['removeEventListener']); this.eventWrapper = { dismissLanding: () => {} }; this.landing = { @@ -114,13 +117,16 @@ describe('Landing', function () { Landing.prototype.removeEvents.call(this.landing); }); - it('should call .removeEventListener', function () { - expect(this.dismissButton.removeEventListener).toHaveBeenCalledWith('click', this.eventWrapper.dismissLanding); + it('should call .removeEventListener', function() { + expect(this.dismissButton.removeEventListener).toHaveBeenCalledWith( + 'click', + this.eventWrapper.dismissLanding, + ); }); }); - describe('dismissLanding', function () { - beforeEach(function () { + describe('dismissLanding', function() { + beforeEach(function() { this.landingElement = { classList: jasmine.createSpyObj('classList', ['add']) }; this.cookieName = 'cookie_name'; this.landing = { landingElement: this.landingElement, cookieName: this.cookieName }; @@ -130,17 +136,17 @@ describe('Landing', function () { Landing.prototype.dismissLanding.call(this.landing); }); - it('should call .classList.add', function () { + it('should call .classList.add', function() { expect(this.landingElement.classList.add).toHaveBeenCalledWith('hidden'); }); - it('should call Cookies.set', function () { + it('should call Cookies.set', function() { expect(Cookies.set).toHaveBeenCalledWith(this.cookieName, 'true', { expires: 365 }); }); }); - describe('isDismissed', function () { - beforeEach(function () { + describe('isDismissed', function() { + beforeEach(function() { this.cookieName = 'cookie_name'; this.landing = { cookieName: this.cookieName }; @@ -149,11 +155,11 @@ describe('Landing', function () { this.isDismissed = Landing.prototype.isDismissed.call(this.landing); }); - it('should call Cookies.get', function () { + it('should call Cookies.get', function() { expect(Cookies.get).toHaveBeenCalledWith(this.cookieName); }); - it('should return a boolean', function () { + it('should return a boolean', function() { expect(typeof this.isDismissed).toEqual('boolean'); }); }); |