Commit 46eefbda authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Moved the dismiss-icon listener to close the callout to a button

parent bcab4bb5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* global Cookies */ /* global Cookies */
const userCalloutElementName = '.user-callout'; const userCalloutElementName = '.user-callout';
const dismissIcon = '.dismiss-icon'; const closeButton = '.close-user-callout';
const userCalloutBtn = '.user-callout-btn'; const userCalloutBtn = '.user-callout-btn';
const USER_CALLOUT_COOKIE = 'user_callout_dismissed'; const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
...@@ -16,7 +16,7 @@ class UserCallout { ...@@ -16,7 +16,7 @@ class UserCallout {
init() { init() {
$(document) $(document)
.on('click', dismissIcon, () => this.closeAndDismissCallout()) .on('click', closeButton, () => this.closeAndDismissCallout())
.on('click', userCalloutBtn, () => this.closeAndDismissCallout()); .on('click', userCalloutBtn, () => this.closeAndDismissCallout());
} }
......
.user-callout .user-callout
.bordered-box.landing.content-block .bordered-box.landing.content-block
%button.btn.btn-default.close{ type: "button" } %button.btn.btn-default.close.close-user-callout{ type: "button" }
= icon("times", class: "dismiss-icon") = icon("times", class: "dismiss-icon")
.row .row
.col-sm-3.col-xs-12.svg-container .col-sm-3.col-xs-12.svg-container
......
...@@ -30,7 +30,7 @@ describe 'User Callouts', js: true do ...@@ -30,7 +30,7 @@ describe 'User Callouts', js: true do
it 'hides the user callout when click on the dismiss icon' do it 'hides the user callout when click on the dismiss icon' do
visit user_path(user) visit user_path(user)
within('.user-callout') do within('.user-callout') do
find('.dismiss-icon').click find('.close-user-callout').click
end end
expect(page).not_to have_selector('#user-callout') expect(page).not_to have_selector('#user-callout')
end end
......
.user-callout .user-callout
.bordered-box.landing.content-block .bordered-box.landing.content-block
%button.btn.btn-default.close{ type: "button" } %button.btn.btn-default.close.close-user-callout{ type: "button" }
%i.fa.fa-times.dismiss-icon %i.fa.fa-times.dismiss-icon
.row .row
.col-sm-3.col-xs-12.svg-container .col-sm-3.col-xs-12.svg-container
......
...@@ -11,7 +11,7 @@ describe('UserCallout', function () { ...@@ -11,7 +11,7 @@ describe('UserCallout', function () {
beforeEach(() => { beforeEach(() => {
loadFixtures(fixtureName); loadFixtures(fixtureName);
this.userCallout = new UserCallout(); this.userCallout = new UserCallout();
this.dismissIcon = $('.dismiss-icon'); 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, 0);
...@@ -23,7 +23,7 @@ describe('UserCallout', function () { ...@@ -23,7 +23,7 @@ describe('UserCallout', function () {
}); });
it('hides when user clicks on the dismiss-icon', () => { it('hides when user clicks on the dismiss-icon', () => {
this.dismissIcon.click(); this.closeButton.click();
expect(this.userCalloutContainer.is(':visible')).toBe(false); expect(this.userCalloutContainer.is(':visible')).toBe(false);
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1'); expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment