gitlab-org--gitlab-foss/spec/javascripts/user_callout_spec.js

37 lines
976 B
JavaScript
Raw Normal View History

2017-03-11 01:45:34 -05:00
import Cookies from 'js-cookie';
2017-03-22 04:26:12 -04:00
import UserCallout from '~/user_callout';
const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
describe('UserCallout', function () {
const fixtureName = 'dashboard/user-callout.html.raw';
preloadFixtures(fixtureName);
beforeEach(() => {
loadFixtures(fixtureName);
2017-03-11 01:45:34 -05:00
Cookies.remove(USER_CALLOUT_COOKIE);
this.userCallout = new UserCallout();
this.closeButton = $('.js-close-callout.close');
this.userCalloutBtn = $('.js-close-callout:not(.close)');
});
it('hides when user clicks on the dismiss-icon', (done) => {
this.closeButton.click();
2017-03-11 01:45:34 -05:00
expect(Cookies.get(USER_CALLOUT_COOKIE)).toBe('true');
setTimeout(() => {
expect(
document.querySelector('.user-callout'),
).toBeNull();
done();
});
});
it('hides when user clicks on the "check it out" button', () => {
this.userCalloutBtn.click();
2017-03-11 01:45:34 -05:00
expect(Cookies.get(USER_CALLOUT_COOKIE)).toBe('true');
});
});