1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-09-09 20:50:39 +02:00

Adding tests with jest

This commit is contained in:
Antonio Laguna
2017-04-26 23:11:56 +02:00
parent f6ac24007a
commit b6a4ae71b9
6 changed files with 315 additions and 35 deletions

View File

@@ -46,14 +46,17 @@ export default class DOM {
/**
* Gets the prefixed transitionend event.
* @param {?Element} optEl Element to check
* @return {string}
*/
static getTransitionEvent() {
if (transitionEvent) {
static getTransitionEvent(optEl) {
if (transitionEvent && !optEl) {
return transitionEvent;
}
const el = document.createElement('ws');
transitionEvent = '';
const el = optEl || document.createElement('ws');
const transitions = {
'transition': 'transitionend',
'OTransition': 'oTransitionEnd',
@@ -76,14 +79,17 @@ export default class DOM {
/**
* Gets the prefixed animation end event.
* @param {?Element} optEl Element to check
* @return {string}
*/
static getAnimationEvent() {
if (animationEvent) {
static getAnimationEvent(optEl) {
if (animationEvent && !optEl) {
return animationEvent;
}
const el = document.createElement('ws');
animationEvent = '';
const el = optEl || document.createElement('ws');
const animations = {
'animation': 'animationend',
'OAnimation': 'oAnimationEnd',
@@ -156,10 +162,9 @@ export default class DOM {
if (document.activeElement) {
const isContentEditable = document.activeElement
.contentEditable !== 'inherit';
.contentEditable !== 'inherit' && document.activeElement.contentEditable !== undefined;
const isInput = ['INPUT', 'SELECT', 'OPTION', 'TEXTAREA']
.indexOf(document.activeElement.tagName) > -1;
result = isInput || isContentEditable;
}