UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

30 lines (29 loc) 1.72 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { promisifyTransition } from '../../promise/animation'; describe('async/animation', () => { test('promisifyTransition catches the transition event', () => __awaiter(void 0, void 0, void 0, function* () { const el = document.createElement('div'); const $promise = promisifyTransition(el); el.dispatchEvent(new Event('transitionend')); return $promise; })); test('promisifyTransition catches the transition event', () => __awaiter(void 0, void 0, void 0, function* () { const el = document.createElement('div'); let resolved; promisifyTransition(el, 'height').then(() => resolved = true, () => resolved = false); el.dispatchEvent(Object.assign(new Event('transitionend'), { propertyName: 'width' })); yield Promise.resolve(); expect(resolved).toBe(undefined); el.dispatchEvent(Object.assign(new Event('transitionend'), { propertyName: 'height' })); yield Promise.resolve(); expect(resolved).toBe(true); })); });