summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/javascripts/user_callout_spec.js.es614
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);