Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/whats_new/utils/notification_spec.js')
-rw-r--r--spec/frontend/whats_new/utils/notification_spec.js73
1 files changed, 0 insertions, 73 deletions
diff --git a/spec/frontend/whats_new/utils/notification_spec.js b/spec/frontend/whats_new/utils/notification_spec.js
deleted file mode 100644
index 020d833c578..00000000000
--- a/spec/frontend/whats_new/utils/notification_spec.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import htmlWhatsNewNotification from 'test_fixtures_static/whats_new_notification.html';
-import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
-import { useLocalStorageSpy } from 'helpers/local_storage_helper';
-import { setNotification, getVersionDigest } from '~/whats_new/utils/notification';
-
-describe('~/whats_new/utils/notification', () => {
- useLocalStorageSpy();
-
- let wrapper;
-
- const findNotificationEl = () => wrapper.querySelector('.header-help');
- const findNotificationCountEl = () => wrapper.querySelector('.js-whats-new-notification-count');
- const getAppEl = () => wrapper.querySelector('.app');
-
- beforeEach(() => {
- setHTMLFixture(htmlWhatsNewNotification);
- wrapper = document.querySelector('.whats-new-notification-fixture-root');
- });
-
- afterEach(() => {
- wrapper.remove();
- resetHTMLFixture();
- });
-
- describe('setNotification', () => {
- const subject = () => setNotification(getAppEl());
-
- it("when storage key doesn't exist it adds notifications class", () => {
- const notificationEl = findNotificationEl();
-
- expect(notificationEl.classList).not.toContain('with-notifications');
-
- subject();
-
- expect(findNotificationCountEl()).not.toBe(null);
- expect(notificationEl.classList).toContain('with-notifications');
- });
-
- it('removes class and count element when storage key has current digest', () => {
- const notificationEl = findNotificationEl();
-
- notificationEl.classList.add('with-notifications');
- localStorage.setItem('display-whats-new-notification', 'version-digest');
-
- expect(findNotificationCountEl()).not.toBe(null);
-
- subject();
-
- expect(findNotificationCountEl()).toBe(null);
- expect(notificationEl.classList).not.toContain('with-notifications');
- });
-
- it('removes class and count element when no records and digest undefined', () => {
- const notificationEl = findNotificationEl();
-
- notificationEl.classList.add('with-notifications');
- localStorage.setItem('display-whats-new-notification', 'version-digest');
-
- expect(findNotificationCountEl()).not.toBe(null);
-
- setNotification(wrapper.querySelector('[data-testid="without-digest"]'));
-
- expect(findNotificationCountEl()).toBe(null);
- expect(notificationEl.classList).not.toContain('with-notifications');
- });
- });
-
- describe('getVersionDigest', () => {
- it('retrieves the storage key data attribute from the el', () => {
- expect(getVersionDigest(getAppEl())).toBe('version-digest');
- });
- });
-});