UNPKG

wix-style-react

Version:
52 lines (42 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "isFocused", { enumerable: true, get: function get() { return _protractor.isFocused; } }); exports.disableCSSAnimation = exports.hasClass = exports.hasAttribute = void 0; var _protractor = require("wix-ui-test-utils/protractor"); // TODO: protractor helper methods should be moved to wix-ui-test-utils/protractor /** * Protractor helper for checking the presence of an attribute. */ var hasAttribute = function hasAttribute(elementFinder, attributeName) { return elementFinder.getAttribute(attributeName).then(function (value) { return value !== null; }); }; /** * Protractor helper for checking the presence of a css class name. */ exports.hasAttribute = hasAttribute; var hasClass = function hasClass(element, className) { return element.getAttribute('class').then(function (classes) { return classes.split(' ').some(function (c) { return c.includes(className); }); }); }; exports.hasClass = hasClass; var disableCSSAnimation = function disableCSSAnimation() { var css = '* {' + '-webkit-transition-duration: 0s !important;' + 'transition-duration: 0s !important;' + '-webkit-animation-duration: 0s !important;' + 'animation-duration: 0s !important;' + '}', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(css)); head.appendChild(style); }; exports.disableCSSAnimation = disableCSSAnimation;