Removed disabled rules from the user_callout_spec.js
Also changed the cookie sets to true and false values to make it consistent with the rest of the javascript. Fixed some haml and a missing new line
This commit is contained in:
parent
46eefbda3a
commit
621bfdaa9f
4 changed files with 12 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable arrow-parens, class-methods-use-this, no-param-reassign */
|
/* eslint-disable class-methods-use-this */
|
||||||
/* global Cookies */
|
/* global Cookies */
|
||||||
|
|
||||||
const userCalloutElementName = '.user-callout';
|
const userCalloutElementName = '.user-callout';
|
||||||
|
@ -11,21 +11,20 @@ class UserCallout {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.isCalloutDismissed = Cookies.get(USER_CALLOUT_COOKIE);
|
this.isCalloutDismissed = Cookies.get(USER_CALLOUT_COOKIE);
|
||||||
this.init();
|
this.init();
|
||||||
this.isUserCalloutDismissed();
|
this.toggleUserCallout();
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
$(document)
|
$(document)
|
||||||
.on('click', closeButton, () => this.closeAndDismissCallout())
|
.on('click', closeButton, () => this.dismissCallout())
|
||||||
.on('click', userCalloutBtn, () => this.closeAndDismissCallout());
|
.on('click', userCalloutBtn, () => this.dismissCallout());
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAndDismissCallout() {
|
dismissCallout() {
|
||||||
$(userCalloutElementName).hide();
|
Cookies.set(USER_CALLOUT_COOKIE, 'true');
|
||||||
Cookies.set(USER_CALLOUT_COOKIE, '1');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isUserCalloutDismissed() {
|
toggleUserCallout() {
|
||||||
if (!this.isCalloutDismissed) {
|
if (!this.isCalloutDismissed) {
|
||||||
$(userCalloutElementName).show();
|
$(userCalloutElementName).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@
|
||||||
|
|
||||||
%div{ class: container_class }
|
%div{ class: container_class }
|
||||||
= render partial: 'shared/user_callout'
|
= render partial: 'shared/user_callout'
|
||||||
%div{ class: container_class }
|
|
||||||
.tab-content
|
.tab-content
|
||||||
#activity.tab-pane
|
#activity.tab-pane
|
||||||
.row-content-block.calender-block.white.second-block.hidden-xs
|
.row-content-block.calender-block.white.second-block.hidden-xs
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* esint-disable space-before-function-paren, arrow-body-style */
|
|
||||||
const UserCallout = require('~/user_callout');
|
const UserCallout = require('~/user_callout');
|
||||||
|
|
||||||
const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
|
const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
|
||||||
|
@ -14,7 +13,7 @@ describe('UserCallout', function () {
|
||||||
this.closeButton = $('.close-user-callout');
|
this.closeButton = $('.close-user-callout');
|
||||||
this.userCalloutContainer = $('.user-callout');
|
this.userCalloutContainer = $('.user-callout');
|
||||||
this.userCalloutBtn = $('.user-callout-btn');
|
this.userCalloutBtn = $('.user-callout-btn');
|
||||||
Cookie.set(USER_CALLOUT_COOKIE, 0);
|
Cookie.set(USER_CALLOUT_COOKIE, 'false');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows when cookie is set to false', () => {
|
it('shows when cookie is set to false', () => {
|
||||||
|
@ -24,13 +23,11 @@ describe('UserCallout', function () {
|
||||||
|
|
||||||
it('hides when user clicks on the dismiss-icon', () => {
|
it('hides when user clicks on the dismiss-icon', () => {
|
||||||
this.closeButton.click();
|
this.closeButton.click();
|
||||||
expect(this.userCalloutContainer.is(':visible')).toBe(false);
|
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true');
|
||||||
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hides when user clicks on the "check it out" button', () => {
|
it('hides when user clicks on the "check it out" button', () => {
|
||||||
this.userCalloutBtn.click();
|
this.userCalloutBtn.click();
|
||||||
expect(this.userCalloutContainer.is(':visible')).toBe(false);
|
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true');
|
||||||
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue