summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-02-20 09:39:23 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-02-23 15:47:23 -0600
commit46eefbda3ae55394bae63872c8ff3d86500a1ddc (patch)
tree6963d814927f6205836849b8226420b79d70b7a8
parentbcab4bb5efd1cc499dc7d753115fe91b98f27bda (diff)
downloadgitlab-ce-46eefbda3ae55394bae63872c8ff3d86500a1ddc.tar.gz
Moved the dismiss-icon listener to close the callout to a button
-rw-r--r--app/assets/javascripts/user_callout.js4
-rw-r--r--app/views/shared/_user_callout.html.haml2
-rw-r--r--spec/features/user_callout_spec.rb2
-rw-r--r--spec/javascripts/fixtures/user_callout.html.haml2
-rw-r--r--spec/javascripts/user_callout_spec.js4
5 files changed, 7 insertions, 7 deletions
diff --git a/app/assets/javascripts/user_callout.js b/app/assets/javascripts/user_callout.js
index 85f85674e59..9aa565074e4 100644
--- a/app/assets/javascripts/user_callout.js
+++ b/app/assets/javascripts/user_callout.js
@@ -2,7 +2,7 @@
/* global Cookies */
const userCalloutElementName = '.user-callout';
-const dismissIcon = '.dismiss-icon';
+const closeButton = '.close-user-callout';
const userCalloutBtn = '.user-callout-btn';
const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
@@ -16,7 +16,7 @@ class UserCallout {
init() {
$(document)
- .on('click', dismissIcon, () => this.closeAndDismissCallout())
+ .on('click', closeButton, () => this.closeAndDismissCallout())
.on('click', userCalloutBtn, () => this.closeAndDismissCallout());
}
diff --git a/app/views/shared/_user_callout.html.haml b/app/views/shared/_user_callout.html.haml
index af8c15d8291..3f310251568 100644
--- a/app/views/shared/_user_callout.html.haml
+++ b/app/views/shared/_user_callout.html.haml
@@ -1,6 +1,6 @@
.user-callout
.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")
.row
.col-sm-3.col-xs-12.svg-container
diff --git a/spec/features/user_callout_spec.rb b/spec/features/user_callout_spec.rb
index 53a87d3c224..336c4092c98 100644
--- a/spec/features/user_callout_spec.rb
+++ b/spec/features/user_callout_spec.rb
@@ -30,7 +30,7 @@ describe 'User Callouts', js: true do
it 'hides the user callout when click on the dismiss icon' do
visit user_path(user)
within('.user-callout') do
- find('.dismiss-icon').click
+ find('.close-user-callout').click
end
expect(page).not_to have_selector('#user-callout')
end
diff --git a/spec/javascripts/fixtures/user_callout.html.haml b/spec/javascripts/fixtures/user_callout.html.haml
index 430e6c829ef..ad564469a27 100644
--- a/spec/javascripts/fixtures/user_callout.html.haml
+++ b/spec/javascripts/fixtures/user_callout.html.haml
@@ -1,6 +1,6 @@
.user-callout
.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
.row
.col-sm-3.col-xs-12.svg-container
diff --git a/spec/javascripts/user_callout_spec.js b/spec/javascripts/user_callout_spec.js
index 72410e5369e..ba5a2656da5 100644
--- a/spec/javascripts/user_callout_spec.js
+++ b/spec/javascripts/user_callout_spec.js
@@ -11,7 +11,7 @@ describe('UserCallout', function () {
beforeEach(() => {
loadFixtures(fixtureName);
this.userCallout = new UserCallout();
- this.dismissIcon = $('.dismiss-icon');
+ this.closeButton = $('.close-user-callout');
this.userCalloutContainer = $('.user-callout');
this.userCalloutBtn = $('.user-callout-btn');
Cookie.set(USER_CALLOUT_COOKIE, 0);
@@ -23,7 +23,7 @@ describe('UserCallout', function () {
});
it('hides when user clicks on the dismiss-icon', () => {
- this.dismissIcon.click();
+ this.closeButton.click();
expect(this.userCalloutContainer.is(':visible')).toBe(false);
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
});