diff options
author | Simon Knox <simon@gitlab.com> | 2017-03-02 21:10:39 +0000 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-03-02 21:10:39 +0000 |
commit | ea0520924fa4e9a00930bc2553f894725d90b0ee (patch) | |
tree | d8393febf9538cc22487d01ac704da451933a226 | |
parent | f0dc00d4c5ef474d19bbeea1a46e9604e129dcc3 (diff) | |
download | gitlab-ce-ea0520924fa4e9a00930bc2553f894725d90b0ee.tar.gz |
remove extra whitespace on dashboard projects page
-rw-r--r-- | app/assets/javascripts/user_callout.js | 4 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/profile.scss | 3 | ||||
-rw-r--r-- | spec/javascripts/user_callout_spec.js.es6 | 36 |
3 files changed, 33 insertions, 10 deletions
diff --git a/app/assets/javascripts/user_callout.js b/app/assets/javascripts/user_callout.js index 74b869502a4..99419e85b20 100644 --- a/app/assets/javascripts/user_callout.js +++ b/app/assets/javascripts/user_callout.js @@ -43,6 +43,8 @@ class UserCallout { this.userCalloutBody.append($template); $template.find(closeButton).on('click', e => this.dismissCallout(e)); $template.find(userCalloutBtn).on('click', e => this.dismissCallout(e)); + } else { + this.userCalloutBody.remove(); } } @@ -50,7 +52,7 @@ class UserCallout { Cookies.set(USER_CALLOUT_COOKIE, 'true'); const $currentTarget = $(e.currentTarget); if ($currentTarget.hasClass('close-user-callout')) { - this.userCalloutBody.empty(); + this.userCalloutBody.remove(); } } } diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss index aad1a8986b0..1a983d8c9ef 100644 --- a/app/assets/stylesheets/pages/profile.scss +++ b/app/assets/stylesheets/pages/profile.scss @@ -279,7 +279,7 @@ table.u2f-registrations { } .user-callout { - margin: 24px auto 0; + margin: 0 auto; .bordered-box { border: 1px solid $border-color; @@ -287,6 +287,7 @@ table.u2f-registrations { } .landing { + margin-top: $gl-padding; margin-bottom: $gl-padding; .close { diff --git a/spec/javascripts/user_callout_spec.js.es6 b/spec/javascripts/user_callout_spec.js.es6 index 6ee63f56a26..205e72af600 100644 --- a/spec/javascripts/user_callout_spec.js.es6 +++ b/spec/javascripts/user_callout_spec.js.es6 @@ -3,35 +3,55 @@ 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(function () { + 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(function () { - 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', function () { + 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); }); - it('hides when user clicks on the dismiss-icon', function () { + it('hides when user clicks on the dismiss-icon', () => { this.closeButton.click(); expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true'); }); - it('hides when user clicks on the "check it out" button', function () { + it('hides when user clicks on the "check it out" button', () => { this.userCalloutBtn.click(); expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true'); }); }); + +describe('UserCallout when cookie is present', function () { + const fixtureName = 'static/user_callout.html.raw'; + preloadFixtures(fixtureName); + + beforeEach(() => { + loadFixtures(fixtureName); + Cookie.set(USER_CALLOUT_COOKIE, 'true'); + this.userCallout = new UserCallout(); + this.userCalloutContainer = $('.user-callout'); + }); + + it('removes the DOM element', () => { + expect(this.userCalloutContainer.length).toBe(0); + }); +}); |