diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-02 14:18:50 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-02 14:18:50 -0500 |
commit | 622d18d7d7d22d0eb713e198292a2b490ac61ebc (patch) | |
tree | 00ea13df733bb0cf420a8eddae1c23056fb625c5 | |
parent | 0fe70a7e446dc1849a0f2372885b82d79c624b37 (diff) | |
download | gitlab-ce-28874-user-callout-margin.tar.gz |
Fix specs and make it to work on browser and PhantomJS28874-user-callout-margin
- Also adds a test for when Cookie is not set
-rw-r--r-- | spec/javascripts/user_callout_spec.js.es6 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/javascripts/user_callout_spec.js.es6 b/spec/javascripts/user_callout_spec.js.es6 index 306f3d37f5a..c4b7a8ccca2 100644 --- a/spec/javascripts/user_callout_spec.js.es6 +++ b/spec/javascripts/user_callout_spec.js.es6 @@ -3,24 +3,28 @@ const UserCallout = require('~/user_callout'); const USER_CALLOUT_COOKIE = 'user_callout_dismissed'; const Cookie = window.Cookies; -describe('UserCallout', () => { +describe('UserCallout', function() { const fixtureName = 'static/user_callout.html.raw'; preloadFixtures(fixtureName); beforeEach(() => { loadFixtures(fixtureName); + Cookie.remove(USER_CALLOUT_COOKIE); + this.userCallout = new UserCallout(); this.closeButton = $('.close-user-callout'); this.userCalloutBtn = $('.user-callout-btn'); this.userCalloutContainer = $('.user-callout'); - Cookie.set(USER_CALLOUT_COOKIE, 'false'); }); - afterEach(() => { - Cookie.set(USER_CALLOUT_COOKIE, 'false'); + it('does not show when cookie is set not defined', () => { + expect(Cookie.get(USER_CALLOUT_COOKIE)).toBeUndefined(); + expect(this.userCalloutContainer.is(':visible')).toBe(true); }); it('shows when cookie is set to false', () => { + Cookie.set(USER_CALLOUT_COOKIE, 'false'); + expect(Cookie.get(USER_CALLOUT_COOKIE)).toBeDefined(); expect(this.userCalloutContainer.is(':visible')).toBe(true); }); @@ -36,7 +40,7 @@ describe('UserCallout', () => { }); }); -describe('UserCallout when cookie is present', () => { +describe('UserCallout when cookie is present', function () { const fixtureName = 'static/user_callout.html.raw'; preloadFixtures(fixtureName); |