summaryrefslogtreecommitdiff
path: root/spec/javascripts/user_callout_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/user_callout_spec.js')
-rw-r--r--spec/javascripts/user_callout_spec.js62
1 files changed, 28 insertions, 34 deletions
diff --git a/spec/javascripts/user_callout_spec.js b/spec/javascripts/user_callout_spec.js
index 26a12bed067..72410e5369e 100644
--- a/spec/javascripts/user_callout_spec.js
+++ b/spec/javascripts/user_callout_spec.js
@@ -1,42 +1,36 @@
/* esint-disable space-before-function-paren, arrow-body-style */
-require('~/user_callout');
+const UserCallout = require('~/user_callout');
-((global) => {
- const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
- const Cookie = window.Cookies;
+const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
+const Cookie = window.Cookies;
- describe('UserCallout', function () {
- const fixtureName = 'static/user_callout.html.raw';
- preloadFixtures(fixtureName);
+describe('UserCallout', function () {
+ const fixtureName = 'static/user_callout.html.raw';
+ preloadFixtures(fixtureName);
- it('should be defined in the global scope', () => {
- expect(global.UserCallout).toBeDefined();
- });
-
- beforeEach(() => {
- loadFixtures(fixtureName);
- this.userCallout = new global.UserCallout();
- this.dismissIcon = $('.dismiss-icon');
- this.userCalloutContainer = $('#user-callout');
- this.userCalloutBtn = $('.user-callout-btn');
- Cookie.set(USER_CALLOUT_COOKIE, 0);
- });
+ beforeEach(() => {
+ loadFixtures(fixtureName);
+ this.userCallout = new UserCallout();
+ this.dismissIcon = $('.dismiss-icon');
+ this.userCalloutContainer = $('.user-callout');
+ this.userCalloutBtn = $('.user-callout-btn');
+ Cookie.set(USER_CALLOUT_COOKIE, 0);
+ });
- it('shows when cookie is set to false', () => {
- expect(Cookie.get(USER_CALLOUT_COOKIE)).toBeDefined();
- expect(this.userCalloutContainer.is(':visible')).toBe(true);
- });
+ it('shows when cookie is set to false', () => {
+ expect(Cookie.get(USER_CALLOUT_COOKIE)).toBeDefined();
+ expect(this.userCalloutContainer.is(':visible')).toBe(true);
+ });
- it('hides when user clicks on the dismiss-icon', () => {
- this.dismissIcon.click();
- expect(this.userCalloutContainer.is(':visible')).toBe(false);
- expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
- });
+ it('hides when user clicks on the dismiss-icon', () => {
+ this.dismissIcon.click();
+ expect(this.userCalloutContainer.is(':visible')).toBe(false);
+ expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
+ });
- it('hides when user clicks on the "check it out" button', () => {
- this.userCalloutBtn.click();
- expect(this.userCalloutContainer.is(':visible')).toBe(false);
- expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
- });
+ it('hides when user clicks on the "check it out" button', () => {
+ this.userCalloutBtn.click();
+ expect(this.userCalloutContainer.is(':visible')).toBe(false);
+ expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
});
-})(window.gl || (window.gl = {}));
+});