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/flash_spec.js')
-rw-r--r--spec/frontend/flash_spec.js108
1 files changed, 1 insertions, 107 deletions
diff --git a/spec/frontend/flash_spec.js b/spec/frontend/flash_spec.js
index 2f0a52a9884..17d6cea23df 100644
--- a/spec/frontend/flash_spec.js
+++ b/spec/frontend/flash_spec.js
@@ -1,12 +1,6 @@
import * as Sentry from '@sentry/browser';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
-import {
- hideFlash,
- addDismissFlashClickListener,
- FLASH_CLOSED_EVENT,
- createAlert,
- VARIANT_WARNING,
-} from '~/flash';
+import { createAlert, VARIANT_WARNING } from '~/flash';
jest.mock('@sentry/browser');
@@ -14,65 +8,6 @@ describe('Flash', () => {
const findTextContent = (containerSelector = '.flash-container') =>
document.querySelector(containerSelector).textContent.replace(/\s+/g, ' ').trim();
- describe('hideFlash', () => {
- let el;
-
- beforeEach(() => {
- el = document.createElement('div');
- el.className = 'js-testing';
- });
-
- it('sets transition style', () => {
- hideFlash(el);
-
- expect(el.style.transition).toBe('opacity 0.15s');
- });
-
- it('sets opacity style', () => {
- hideFlash(el);
-
- expect(el.style.opacity).toBe('0');
- });
-
- it('does not set styles when fadeTransition is false', () => {
- hideFlash(el, false);
-
- expect(el.style.opacity).toBe('');
- expect(el.style.transition).toHaveLength(0);
- });
-
- it('removes element after transitionend', () => {
- document.body.appendChild(el);
-
- hideFlash(el);
- el.dispatchEvent(new Event('transitionend'));
-
- expect(document.querySelector('.js-testing')).toBeNull();
- });
-
- it('calls event listener callback once', () => {
- jest.spyOn(el, 'remove');
- document.body.appendChild(el);
-
- hideFlash(el);
-
- el.dispatchEvent(new Event('transitionend'));
- el.dispatchEvent(new Event('transitionend'));
-
- expect(el.remove.mock.calls.length).toBe(1);
- });
-
- it(`dispatches ${FLASH_CLOSED_EVENT} event after transitionend event`, () => {
- jest.spyOn(el, 'dispatchEvent');
-
- hideFlash(el);
-
- el.dispatchEvent(new Event('transitionend'));
-
- expect(el.dispatchEvent).toHaveBeenCalledWith(new Event(FLASH_CLOSED_EVENT));
- });
- });
-
describe('createAlert', () => {
const mockMessage = 'a message';
let alert;
@@ -338,45 +273,4 @@ describe('Flash', () => {
});
});
});
-
- describe('addDismissFlashClickListener', () => {
- let el;
-
- describe('with close icon', () => {
- beforeEach(() => {
- el = document.createElement('div');
- el.innerHTML = `
- <div class="flash-container">
- <div class="flash">
- <div class="close-icon js-close-icon"></div>
- </div>
- </div>
- `;
- });
-
- it('removes global flash on click', () => {
- addDismissFlashClickListener(el, false);
-
- el.querySelector('.js-close-icon').click();
-
- expect(document.querySelector('.flash')).toBeNull();
- });
- });
-
- describe('without close icon', () => {
- beforeEach(() => {
- el = document.createElement('div');
- el.innerHTML = `
- <div class="flash-container">
- <div class="flash">
- </div>
- </div>
- `;
- });
-
- it('does not throw', () => {
- expect(() => addDismissFlashClickListener(el, false)).not.toThrow();
- });
- });
- });
});