Commit f29429e8 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Merge branch '28874-user-callout-margin' into 'master'

remove extra whitespace on dashboard projects page

Closes #28874

See merge request !9617
parents f0dc00d4 ea052092
...@@ -43,6 +43,8 @@ class UserCallout { ...@@ -43,6 +43,8 @@ class UserCallout {
this.userCalloutBody.append($template); this.userCalloutBody.append($template);
$template.find(closeButton).on('click', e => this.dismissCallout(e)); $template.find(closeButton).on('click', e => this.dismissCallout(e));
$template.find(userCalloutBtn).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 { ...@@ -50,7 +52,7 @@ class UserCallout {
Cookies.set(USER_CALLOUT_COOKIE, 'true'); Cookies.set(USER_CALLOUT_COOKIE, 'true');
const $currentTarget = $(e.currentTarget); const $currentTarget = $(e.currentTarget);
if ($currentTarget.hasClass('close-user-callout')) { if ($currentTarget.hasClass('close-user-callout')) {
this.userCalloutBody.empty(); this.userCalloutBody.remove();
} }
} }
} }
......
...@@ -279,7 +279,7 @@ table.u2f-registrations { ...@@ -279,7 +279,7 @@ table.u2f-registrations {
} }
.user-callout { .user-callout {
margin: 24px auto 0; margin: 0 auto;
.bordered-box { .bordered-box {
border: 1px solid $border-color; border: 1px solid $border-color;
...@@ -287,6 +287,7 @@ table.u2f-registrations { ...@@ -287,6 +287,7 @@ table.u2f-registrations {
} }
.landing { .landing {
margin-top: $gl-padding;
margin-bottom: $gl-padding; margin-bottom: $gl-padding;
.close { .close {
......
...@@ -3,35 +3,55 @@ const UserCallout = require('~/user_callout'); ...@@ -3,35 +3,55 @@ const UserCallout = require('~/user_callout');
const USER_CALLOUT_COOKIE = 'user_callout_dismissed'; const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
const Cookie = window.Cookies; const Cookie = window.Cookies;
describe('UserCallout', () => { describe('UserCallout', function () {
const fixtureName = 'static/user_callout.html.raw'; const fixtureName = 'static/user_callout.html.raw';
preloadFixtures(fixtureName); preloadFixtures(fixtureName);
beforeEach(function () { beforeEach(() => {
loadFixtures(fixtureName); loadFixtures(fixtureName);
Cookie.remove(USER_CALLOUT_COOKIE);
this.userCallout = new UserCallout(); this.userCallout = new UserCallout();
this.closeButton = $('.close-user-callout'); this.closeButton = $('.close-user-callout');
this.userCalloutBtn = $('.user-callout-btn'); this.userCalloutBtn = $('.user-callout-btn');
this.userCalloutContainer = $('.user-callout'); this.userCalloutContainer = $('.user-callout');
Cookie.set(USER_CALLOUT_COOKIE, 'false');
}); });
afterEach(function () { it('does not show when cookie is set not defined', () => {
Cookie.set(USER_CALLOUT_COOKIE, 'false'); 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(Cookie.get(USER_CALLOUT_COOKIE)).toBeDefined();
expect(this.userCalloutContainer.is(':visible')).toBe(true); 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(); this.closeButton.click();
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true'); 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(); this.userCalloutBtn.click();
expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true'); 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);
});
});
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