Best JavaScript code snippet using backstopjs
nodes.js
Source:nodes.js
1function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }2// THIS FILE IS AUTOGENERATED3// see scripts/generateNodeUtils.js4function isTypeOf(t) {5 return function (n) {6 return n.type === t;7 };8}9function assertTypeOf(t) {10 return function (n) {11 return function () {12 if (!(n.type === t)) {13 throw new Error('n.type === t' + " error: " + (undefined || "unknown"));14 }15 }();16 };17}18export function module(id, fields, metadata) {19 if (id !== null && id !== undefined) {20 if (!(typeof id === "string")) {21 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));22 }23 }24 if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {25 throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));26 }27 var node = {28 type: "Module",29 id: id,30 fields: fields31 };32 if (typeof metadata !== "undefined") {33 node.metadata = metadata;34 }35 return node;36}37export function moduleMetadata(sections, functionNames, localNames, producers) {38 if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {39 throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));40 }41 if (functionNames !== null && functionNames !== undefined) {42 if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {43 throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));44 }45 }46 if (localNames !== null && localNames !== undefined) {47 if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {48 throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));49 }50 }51 if (producers !== null && producers !== undefined) {52 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {53 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));54 }55 }56 var node = {57 type: "ModuleMetadata",58 sections: sections59 };60 if (typeof functionNames !== "undefined" && functionNames.length > 0) {61 node.functionNames = functionNames;62 }63 if (typeof localNames !== "undefined" && localNames.length > 0) {64 node.localNames = localNames;65 }66 if (typeof producers !== "undefined" && producers.length > 0) {67 node.producers = producers;68 }69 return node;70}71export function moduleNameMetadata(value) {72 if (!(typeof value === "string")) {73 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));74 }75 var node = {76 type: "ModuleNameMetadata",77 value: value78 };79 return node;80}81export function functionNameMetadata(value, index) {82 if (!(typeof value === "string")) {83 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));84 }85 if (!(typeof index === "number")) {86 throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || "unknown"));87 }88 var node = {89 type: "FunctionNameMetadata",90 value: value,91 index: index92 };93 return node;94}95export function localNameMetadata(value, localIndex, functionIndex) {96 if (!(typeof value === "string")) {97 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));98 }99 if (!(typeof localIndex === "number")) {100 throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || "unknown"));101 }102 if (!(typeof functionIndex === "number")) {103 throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || "unknown"));104 }105 var node = {106 type: "LocalNameMetadata",107 value: value,108 localIndex: localIndex,109 functionIndex: functionIndex110 };111 return node;112}113export function binaryModule(id, blob) {114 if (id !== null && id !== undefined) {115 if (!(typeof id === "string")) {116 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));117 }118 }119 if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {120 throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));121 }122 var node = {123 type: "BinaryModule",124 id: id,125 blob: blob126 };127 return node;128}129export function quoteModule(id, string) {130 if (id !== null && id !== undefined) {131 if (!(typeof id === "string")) {132 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));133 }134 }135 if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {136 throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));137 }138 var node = {139 type: "QuoteModule",140 id: id,141 string: string142 };143 return node;144}145export function sectionMetadata(section, startOffset, size, vectorOfSize) {146 if (!(typeof startOffset === "number")) {147 throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || "unknown"));148 }149 var node = {150 type: "SectionMetadata",151 section: section,152 startOffset: startOffset,153 size: size,154 vectorOfSize: vectorOfSize155 };156 return node;157}158export function producersSectionMetadata(producers) {159 if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {160 throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));161 }162 var node = {163 type: "ProducersSectionMetadata",164 producers: producers165 };166 return node;167}168export function producerMetadata(language, processedBy, sdk) {169 if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {170 throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));171 }172 if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {173 throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));174 }175 if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {176 throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));177 }178 var node = {179 type: "ProducerMetadata",180 language: language,181 processedBy: processedBy,182 sdk: sdk183 };184 return node;185}186export function producerMetadataVersionedName(name, version) {187 if (!(typeof name === "string")) {188 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));189 }190 if (!(typeof version === "string")) {191 throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || "unknown"));192 }193 var node = {194 type: "ProducerMetadataVersionedName",195 name: name,196 version: version197 };198 return node;199}200export function loopInstruction(label, resulttype, instr) {201 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {202 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));203 }204 var node = {205 type: "LoopInstruction",206 id: "loop",207 label: label,208 resulttype: resulttype,209 instr: instr210 };211 return node;212}213export function instr(id, object, args, namedArgs) {214 if (!(typeof id === "string")) {215 throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));216 }217 if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {218 throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));219 }220 var node = {221 type: "Instr",222 id: id,223 args: args224 };225 if (typeof object !== "undefined") {226 node.object = object;227 }228 if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {229 node.namedArgs = namedArgs;230 }231 return node;232}233export function ifInstruction(testLabel, test, result, consequent, alternate) {234 if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {235 throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));236 }237 if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {238 throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));239 }240 if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {241 throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));242 }243 var node = {244 type: "IfInstruction",245 id: "if",246 testLabel: testLabel,247 test: test,248 result: result,249 consequent: consequent,250 alternate: alternate251 };252 return node;253}254export function stringLiteral(value) {255 if (!(typeof value === "string")) {256 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));257 }258 var node = {259 type: "StringLiteral",260 value: value261 };262 return node;263}264export function numberLiteral(value, raw) {265 if (!(typeof value === "number")) {266 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));267 }268 if (!(typeof raw === "string")) {269 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));270 }271 var node = {272 type: "NumberLiteral",273 value: value,274 raw: raw275 };276 return node;277}278export function longNumberLiteral(value, raw) {279 if (!(typeof raw === "string")) {280 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));281 }282 var node = {283 type: "LongNumberLiteral",284 value: value,285 raw: raw286 };287 return node;288}289export function floatLiteral(value, nan, inf, raw) {290 if (!(typeof value === "number")) {291 throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));292 }293 if (nan !== null && nan !== undefined) {294 if (!(typeof nan === "boolean")) {295 throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || "unknown"));296 }297 }298 if (inf !== null && inf !== undefined) {299 if (!(typeof inf === "boolean")) {300 throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || "unknown"));301 }302 }303 if (!(typeof raw === "string")) {304 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));305 }306 var node = {307 type: "FloatLiteral",308 value: value,309 raw: raw310 };311 if (nan === true) {312 node.nan = true;313 }314 if (inf === true) {315 node.inf = true;316 }317 return node;318}319export function elem(table, offset, funcs) {320 if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {321 throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));322 }323 if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {324 throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));325 }326 var node = {327 type: "Elem",328 table: table,329 offset: offset,330 funcs: funcs331 };332 return node;333}334export function indexInFuncSection(index) {335 var node = {336 type: "IndexInFuncSection",337 index: index338 };339 return node;340}341export function valtypeLiteral(name) {342 var node = {343 type: "ValtypeLiteral",344 name: name345 };346 return node;347}348export function typeInstruction(id, functype) {349 var node = {350 type: "TypeInstruction",351 id: id,352 functype: functype353 };354 return node;355}356export function start(index) {357 var node = {358 type: "Start",359 index: index360 };361 return node;362}363export function globalType(valtype, mutability) {364 var node = {365 type: "GlobalType",366 valtype: valtype,367 mutability: mutability368 };369 return node;370}371export function leadingComment(value) {372 if (!(typeof value === "string")) {373 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));374 }375 var node = {376 type: "LeadingComment",377 value: value378 };379 return node;380}381export function blockComment(value) {382 if (!(typeof value === "string")) {383 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));384 }385 var node = {386 type: "BlockComment",387 value: value388 };389 return node;390}391export function data(memoryIndex, offset, init) {392 var node = {393 type: "Data",394 memoryIndex: memoryIndex,395 offset: offset,396 init: init397 };398 return node;399}400export function global(globalType, init, name) {401 if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {402 throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));403 }404 var node = {405 type: "Global",406 globalType: globalType,407 init: init,408 name: name409 };410 return node;411}412export function table(elementType, limits, name, elements) {413 if (!(limits.type === "Limit")) {414 throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || "unknown"));415 }416 if (elements !== null && elements !== undefined) {417 if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {418 throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));419 }420 }421 var node = {422 type: "Table",423 elementType: elementType,424 limits: limits,425 name: name426 };427 if (typeof elements !== "undefined" && elements.length > 0) {428 node.elements = elements;429 }430 return node;431}432export function memory(limits, id) {433 var node = {434 type: "Memory",435 limits: limits,436 id: id437 };438 return node;439}440export function funcImportDescr(id, signature) {441 var node = {442 type: "FuncImportDescr",443 id: id,444 signature: signature445 };446 return node;447}448export function moduleImport(module, name, descr) {449 if (!(typeof module === "string")) {450 throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || "unknown"));451 }452 if (!(typeof name === "string")) {453 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));454 }455 var node = {456 type: "ModuleImport",457 module: module,458 name: name,459 descr: descr460 };461 return node;462}463export function moduleExportDescr(exportType, id) {464 var node = {465 type: "ModuleExportDescr",466 exportType: exportType,467 id: id468 };469 return node;470}471export function moduleExport(name, descr) {472 if (!(typeof name === "string")) {473 throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));474 }475 var node = {476 type: "ModuleExport",477 name: name,478 descr: descr479 };480 return node;481}482export function limit(min, max) {483 if (!(typeof min === "number")) {484 throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || "unknown"));485 }486 if (max !== null && max !== undefined) {487 if (!(typeof max === "number")) {488 throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || "unknown"));489 }490 }491 var node = {492 type: "Limit",493 min: min494 };495 if (typeof max !== "undefined") {496 node.max = max;497 }498 return node;499}500export function signature(params, results) {501 if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {502 throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));503 }504 if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {505 throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));506 }507 var node = {508 type: "Signature",509 params: params,510 results: results511 };512 return node;513}514export function program(body) {515 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {516 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));517 }518 var node = {519 type: "Program",520 body: body521 };522 return node;523}524export function identifier(value, raw) {525 if (!(typeof value === "string")) {526 throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));527 }528 if (raw !== null && raw !== undefined) {529 if (!(typeof raw === "string")) {530 throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));531 }532 }533 var node = {534 type: "Identifier",535 value: value536 };537 if (typeof raw !== "undefined") {538 node.raw = raw;539 }540 return node;541}542export function blockInstruction(label, instr, result) {543 if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {544 throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));545 }546 var node = {547 type: "BlockInstruction",548 id: "block",549 label: label,550 instr: instr,551 result: result552 };553 return node;554}555export function callInstruction(index, instrArgs, numeric) {556 if (instrArgs !== null && instrArgs !== undefined) {557 if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {558 throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));559 }560 }561 var node = {562 type: "CallInstruction",563 id: "call",564 index: index565 };566 if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {567 node.instrArgs = instrArgs;568 }569 if (typeof numeric !== "undefined") {570 node.numeric = numeric;571 }572 return node;573}574export function callIndirectInstruction(signature, intrs) {575 if (intrs !== null && intrs !== undefined) {576 if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {577 throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));578 }579 }580 var node = {581 type: "CallIndirectInstruction",582 id: "call_indirect",583 signature: signature584 };585 if (typeof intrs !== "undefined" && intrs.length > 0) {586 node.intrs = intrs;587 }588 return node;589}590export function byteArray(values) {591 if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {592 throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));593 }594 var node = {595 type: "ByteArray",596 values: values597 };598 return node;599}600export function func(name, signature, body, isExternal, metadata) {601 if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {602 throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));603 }604 if (isExternal !== null && isExternal !== undefined) {605 if (!(typeof isExternal === "boolean")) {606 throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown"));607 }608 }609 var node = {610 type: "Func",611 name: name,612 signature: signature,613 body: body614 };615 if (isExternal === true) {616 node.isExternal = true;617 }618 if (typeof metadata !== "undefined") {619 node.metadata = metadata;620 }621 return node;622}623export function internalBrUnless(target) {624 if (!(typeof target === "number")) {625 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));626 }627 var node = {628 type: "InternalBrUnless",629 target: target630 };631 return node;632}633export function internalGoto(target) {634 if (!(typeof target === "number")) {635 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));636 }637 var node = {638 type: "InternalGoto",639 target: target640 };641 return node;642}643export function internalCallExtern(target) {644 if (!(typeof target === "number")) {645 throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));646 }647 var node = {648 type: "InternalCallExtern",649 target: target650 };651 return node;652}653export function internalEndAndReturn() {654 var node = {655 type: "InternalEndAndReturn"656 };657 return node;658}659export var isModule = isTypeOf("Module");...
forminator-form.js
Source:forminator-form.js
2 * WPMU DEV Forminator UI3 * Copyright 2019 Incsub (https://incsub.com)4 * Licensed under GPL v3 (http://www.gnu.org/licenses/gpl-3.0.html)5 */6function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }7(function ($) {8 // Enable strict mode.9 'use strict'; // Define global SUI object if it doesn't exist.10 if ('object' !== _typeof(window.FUI)) {11 window.FUI = {};12 }13 FUI.inputStates = function (el) {14 var input = $(el);15 var form = input.closest('form');16 if (!input.is('input') && (!form.is('.forminator-poll') || !form.is('.forminator-ui') && !form.is('.forminator-custom-form'))) {17 return;18 }19 function hover(element) {20 var getInput = $(element);21 var getField = getInput.closest('.forminator-field');22 getInput.mouseover(function (e) {23 getField.addClass('forminator-is_hover');24 e.stopPropagation();25 }).mouseout(function (e) {26 getField.removeClass('forminator-is_hover');27 e.stopPropagation();28 });29 }30 function focused(element) {31 var getInput = $(element);32 var getField = getInput.closest('.forminator-field');33 getInput.focus(function (e) {34 getField.addClass('forminator-is_active');35 e.stopPropagation();36 }).blur(function (e) {37 getField.removeClass('forminator-is_active');38 e.stopPropagation();39 });40 }41 function filled(element) {42 var getInput = $(element);43 var getField = getInput.closest('.forminator-field'); // On input load44 if ('' !== getInput.val().trim()) {45 getField.addClass('forminator-is_filled');46 } // On input changes47 getInput.on('change', function () {48 if ('' !== getInput.val().trim()) {49 getField.addClass('forminator-is_filled');50 } else {51 getField.removeClass('forminator-is_filled');52 }53 });54 }55 function init() {56 input.each(function () {57 hover(this);58 focused(this);59 filled(this);60 });61 }62 init();63 return this;64 };65})(jQuery);66function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }67(function ($) {68 // Enable strict mode.69 'use strict'; // Define global SUI object if it doesn't exist.70 if ('object' !== _typeof(window.FUI)) {71 window.FUI = {};72 }73 FUI.inputMaterial = function (el) {74 var input = $(el);75 var field = input.closest('.forminator-field');76 var label = field.find('.forminator-label');77 var form = input.closest('form');78 if (!input.is('input') && (!form.is('.forminator-poll') || !form.is('.forminator-ui') && !form.is('.forminator-custom-form'))) {79 return;80 }81 function init() {82 // Wrap Element83 if (!input.parent().hasClass('forminator-input--wrap')) {84 input.wrap('<div class="forminator-input--wrap"></div>');85 } // Wrap Label86 if (label.length) {87 // Add floating class88 label.addClass('forminator-floating--input'); // Add icon class (if applies)89 if (field.find('.forminator-input-with-icon').length) {90 label.addClass('forminator-has_icon');91 } // Add phone class (if applies)92 if (field.find('.forminator-input-with-phone').length) {93 label.addClass('forminator-has_phone');94 if (field.find('.intl-tel-input').hasClass('allow-dropdown')) {95 label.addClass('allow-dropdown');96 }97 }98 }99 }100 init();101 return this;102 };103})(jQuery);104function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }105(function ($) {106 // Enable strict mode.107 'use strict'; // Define global SUI object if it doesn't exist.108 if ('object' !== _typeof(window.FUI)) {109 window.FUI = {};110 }111 FUI.textareaStates = function (el) {112 var textarea = $(el);113 var form = textarea.closest('form');114 if (!textarea.is('textarea') && !form.is('.forminator-ui') && !form.is('.forminator-custom-form')) {115 return;116 }117 function hover(element) {118 var getTextarea = $(element);119 var getField = getTextarea.closest('.forminator-field');120 getTextarea.mouseover(function (e) {121 getField.addClass('forminator-is_hover');122 e.stopPropagation();123 }).mouseout(function (e) {124 getField.removeClass('forminator-is_hover');125 e.stopPropagation();126 });127 }128 function focused(element) {129 var getTextarea = $(element);130 var getField = getTextarea.closest('.forminator-field');131 getTextarea.focus(function (e) {132 getField.addClass('forminator-is_active');133 e.stopPropagation();134 }).blur(function (e) {135 getField.removeClass('forminator-is_active');136 e.stopPropagation();137 });138 }139 function filled(element) {140 var getTextarea = $(element);141 var getField = getTextarea.closest('.forminator-field'); // On textarea load142 getTextarea.on('load', function () {143 if ('' !== getTextarea.val().trim()) {144 getField.addClass('forminator-is_filled');145 }146 }); // On textarea changes147 getTextarea.on('change', function () {148 if ('' !== getTextarea.val().trim()) {149 getField.addClass('forminator-is_filled');150 } else {151 getField.removeClass('forminator-is_filled');152 }153 });154 }155 function init() {156 textarea.each(function () {157 hover(this);158 focused(this);159 filled(this);160 });161 }162 init();163 return this;164 };165})(jQuery);166function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }167(function ($) {168 // Enable strict mode.169 'use strict'; // Define global SUI object if it doesn't exist.170 if ('object' !== _typeof(window.FUI)) {171 window.FUI = {};172 }173 FUI.textareaMaterial = function (el) {174 var textarea = $(el);175 var field = textarea.closest('.forminator-field');176 var label = field.find('.forminator-label');177 var form = textarea.closest('form');178 if (!textarea.is('textarea') && !form.is('.forminator-ui') && !form.is('.forminator-custom-form')) {179 return;180 }181 if (textarea.hasClass('wp-editor-area')) {182 return;183 }184 function init() {185 // Wrap Element186 if (!textarea.parent().hasClass('forminator-textarea--wrap')) {187 textarea.wrap('<div class="forminator-textarea--wrap"></div>');188 } // Wrap Label189 if (label.length) {190 var labelHeight = label.height();191 var labelPadding = 9;192 var labelMath = labelHeight + labelPadding; // Add floating class193 label.addClass('forminator-floating--textarea'); // Align textarea194 field.css({195 'position': 'relative'196 });197 if (!field.hasClass('forminator-is_filled') || !field.hasClass('forminator-is_active')) {198 label.css({199 'padding-top': labelMath + 'px'200 });201 }202 textarea.css({203 'padding-top': labelMath + 'px'204 });205 }206 }207 init();208 return this;209 };210})(jQuery);211function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }212(function ($) {213 // Enable strict mode.214 'use strict'; // Define global FUI object if it doesn't exist.215 if ('object' !== _typeof(window.FUI)) {216 window.FUI = {};217 }218 FUI.radioStates = function (el) {219 var label = $(el);220 var input = label.find('input');221 if (!label.is('label') || 'radio' !== input.prop('type')) {222 return;223 }224 function init() {225 input.each(function () {226 $(this).on('click', function () {227 var radioInput = $(this);228 var radioLabel = radioInput.parent();229 var radioField = radioLabel.closest('.forminator-field');230 var radioOptions = radioField.find('.forminator-radio'); // Remove checked attribute231 radioOptions.find('input').prop('checked', false); // Remove checked class232 radioOptions.removeClass('forminator-is_checked'); // Assign checked attribute233 radioInput.prop('checked', 'checked'); // Assign checked class234 radioLabel.addClass('forminator-is_checked');235 });236 });237 }238 init();239 return this;240 };241})(jQuery);242function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }243(function ($) {244 // Enable strict mode.245 'use strict'; // Define global FUI object if it doesn't exist.246 if ('object' !== _typeof(window.FUI)) {247 window.FUI = {};248 }249 FUI.checkboxStates = function (el) {250 var label = $(el);251 var input = label.find('input');252 if (!label.is('label') || 'checkbox' !== input.prop('type')) {253 return;254 }255 function init() {256 input.each(function () {257 $(this).on('click', function () {258 var checkInput = $(this);259 var checkLabel = checkInput.parent();260 if (checkLabel.is('.forminator-is_checked')) {261 checkLabel.removeClass('forminator-is_checked');262 } else {263 checkLabel.addClass('forminator-is_checked');264 }265 });266 });267 }268 init();269 return this;270 };271})(jQuery);272function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }273(function ($) {274 // Enable strict mode.275 'use strict'; // Define global FUI object if it doesn't exist.276 if ('object' !== _typeof(window.FUI)) {277 window.FUI = {};278 }279 FUI.multiSelectStates = function (el) {280 var container = $(el);281 var option = container.find('.forminator-option');282 var input = option.find('input');283 if (!container.is('.forminator-multiselect') || 0 === option.length) {284 return;285 }286 function init() {287 input.each(function () {288 $(this).on('click', function () {289 var checkInput = $(this);290 var checkLabel = checkInput.parent();291 if (checkLabel.is('.forminator-is_checked')) {292 checkLabel.removeClass('forminator-is_checked');293 } else {294 checkLabel.addClass('forminator-is_checked');295 }296 });297 });298 }299 init();300 return this;301 };302})(jQuery);303function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }304(function ($) {305 // Enable strict mode306 'use strict'; // Define global FUI object if it doesn't exist.307 if ('object' !== _typeof(window.FUI)) {308 window.FUI = {};309 }310 FUI.select2 = function () {311 $('.forminator-custom-form').each(function () {312 var $element = $(this),313 $formid = $element.data('form-id'),314 $select = $element.find('.forminator-select2');315 var $themes = ['bold', 'flat', 'default', 'material', 'none'];316 $.each($themes, function (index, $theme) {317 var $dir,318 $language = 'en',319 $placeholder = null,320 $hasSearch = -1;321 if ($element.hasClass('forminator-design--' + $theme) && $select.length) {322 $select.each(function () {323 var $select = $(this),324 $parent = $select.closest('.sui-dialog-content');325 if (true === $select.data('rtl-support')) {326 $dir = 'rtl';327 } else {328 $dir = 'ltr';329 }330 if ('' !== $select.data('placeholder')) {331 $placeholder = $select.data('placeholder');332 } else {333 $placeholder = null;334 }335 if ('' !== $select.data('language')) {336 $language = $select.data('language');337 } else {338 $language = 'en';339 }340 if (true === $select.data('search')) {341 $hasSearch = 0;342 }343 if (!$parent.length) {344 $parent = $(document.body);345 }346 $select.FUIselect2({347 dir: $dir,348 language: $language,349 placeholder: $placeholder,350 dropdownCssClass: 'forminator-custom-form-' + $formid + ' forminator-dropdown--' + $theme,351 minimumResultsForSearch: $hasSearch,352 dropdownParent: $parent353 }).on('select2:opening', function () {354 $select.data('select2').$dropdown.find(':input.select2-search__field').prop('placeholder', $placeholder);355 if ($select.closest('.hustle-popup').length || $select.closest('.hustle-slidein')) {356 $(document.body).addClass('forminator-hustle-dropdown-fix');357 }358 }).on('select2:closing', function () {359 $(document.body).removeClass('forminator-hustle-dropdown-fix');360 });361 });362 }363 });364 });365 };366})(jQuery);367function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }368(function () {369 // Enable strict mode.370 'use strict'; // Define global FUI object if it doesn't exist.371 if ('object' !== _typeof(window.FUI)) {372 window.FUI = {};373 }374 /**375 * @namespace aria376 */377 var aria = aria || {}; // REF: Key codes.378 aria.KeyCode = {379 BACKSPACE: 8,380 TAB: 9,381 RETURN: 13,382 ESC: 27,383 SPACE: 32,384 PAGE_UP: 33,385 PAGE_DOWN: 34,386 END: 35,387 HOME: 36,388 LEFT: 37,389 UP: 38,390 RIGHT: 39,391 DOWN: 40,392 DELETE: 46393 };394 aria.Utils = aria.Utils || {}; // UTILS: Remove function.395 aria.Utils.remove = function (item) {396 if (item.remove && 'function' === typeof item.remove) {397 return item.remove();398 }399 if (item.parentNode && item.parentNode.removeChild && 'function' === typeof item.parentNode.removeChild) {400 return item.parentNode.removeChild(item);401 }402 return false;403 }; // UTILS: Verify if element can be focused.404 aria.Utils.isFocusable = function (element) {405 if (0 < element.tabIndex || 0 === element.tabIndex && null !== element.getAttribute('tabIndex')) {406 return true;407 }408 if (element.disabled) {409 return false;410 }411 switch (element.nodeName) {412 case 'A':413 return !!element.href && 'ignore' != element.rel;414 case 'INPUT':415 return 'hidden' != element.type && 'file' != element.type;416 case 'BUTTON':417 case 'SELECT':418 case 'TEXTAREA':419 return true;420 default:421 return false;422 }423 };424 /**425 * Simulate a click event.426 * @public427 * @param {Element} element the element to simulate a click on428 */429 aria.Utils.simulateClick = function (element) {430 // Create our event (with options)431 var evt = new MouseEvent('click', {432 bubbles: true,433 cancelable: true,434 view: window435 }); // If cancelled, don't dispatch our event436 var canceled = !element.dispatchEvent(evt);437 }; // When util functions move focus around, set this true so438 // the focus listener can ignore the events.439 aria.Utils.IgnoreUtilFocusChanges = false;440 aria.Utils.dialogOpenClass = 'forminator-authentication-enabled';441 /**442 * @desc Set focus on descendant nodes until the first443 * focusable element is found.444 *445 * @param element446 * DOM node for which to find the first focusable descendant.447 *448 * @returns449 * true if a focusable element is found and focus is set.450 */451 aria.Utils.focusFirstDescendant = function (element) {452 for (var i = 0; i < element.childNodes.length; i++) {453 var child = element.childNodes[i];454 if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) {455 return true;456 }457 }458 return false;459 }; // end focusFirstDescendant.460 /**461 * @desc Find the last descendant node that is focusable.462 *463 * @param element464 * DOM node for which to find the last focusable descendant.465 *466 * @returns467 * true if a focusable element is found and focus is set.468 */469 aria.Utils.focusLastDescendant = function (element) {470 for (var i = element.childNodes.length - 1; 0 <= i; i--) {471 var child = element.childNodes[i];472 if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) {473 return true;474 }475 }476 return false;477 }; // end focusLastDescendant478 /**479 * @desc Set Attempt to set focus on the current node.480 *481 * @param element482 * The node to attempt to focus on.483 *484 * @returns485 * true if element is focused.486 */487 aria.Utils.attemptFocus = function (element) {488 if (!aria.Utils.isFocusable(element)) {489 return false;490 }491 aria.Utils.IgnoreUtilFocusChanges = true;492 try {493 element.focus();494 } catch (e) {}495 aria.Utils.IgnoreUtilFocusChanges = false;496 return document.activeElement === element;497 }; // end attemptFocus498 // Modals can open modals. Keep track of them with this array.499 aria.OpenDialogList = aria.OpenDialogList || new Array(0);500 /**501 * @returns the last opened dialog (the current dialog)502 */503 aria.getCurrentDialog = function () {504 if (aria.OpenDialogList && aria.OpenDialogList.length) {505 return aria.OpenDialogList[aria.OpenDialogList.length - 1];506 }507 };508 aria.closeCurrentDialog = function () {509 var currentDialog = aria.getCurrentDialog();510 if (currentDialog) {511 currentDialog.close();512 return true;513 }514 return false;515 };516 aria.handleEscape = function (event) {517 var key = event.which || event.keyCode;518 if (key === aria.Utils.ESC && aria.closeCurrentDialog()) {519 event.stopPropagation();520 }521 };522 document.addEventListener('keyup', aria.handleEscape);523 /**524 * @constructor525 * @desc Dialog object providing modal focus management.526 *527 * Assumptions: The element serving as the dialog container is present in the528 * DOM and hidden. The dialog container has role='dialog'.529 *530 * @param dialogId531 * The ID of the element serving as the dialog container.532 *533 * @param focusAfterClosed534 * Either the DOM node or the ID of the DOM node to focus when the535 * dialog closes.536 *537 * @param focusFirst538 * Optional parameter containing either the DOM node or the ID of the539 * DOM node to focus when the dialog opens. If not specified, the540 * first focusable element in the dialog will receive focus.541 */542 aria.Authentication = function (dialogId, focusAfterClosed, focusFirst) {543 this.dialogNode = document.getElementById(dialogId);544 if (null === this.dialogNode) {545 throw new Error('No element found with id="' + dialogId + '".');546 }547 var validRoles = ['dialog', 'alertdialog'];548 var isDialog = (this.dialogNode.getAttribute('role') || '').trim().split(/\s+/g).some(function (token) {549 return validRoles.some(function (role) {550 return token === role;551 });552 });553 if (!isDialog) {554 throw new Error('Dialog() requires a DOM element with ARIA role of dialog or alertdialog.');555 } // Wrap in an individual backdrop element if one doesn't exist556 // Native <dialog> elements use the ::backdrop pseudo-element, which557 // works similarly.558 var backdropClass = 'forminator-authentication';559 if (this.dialogNode.parentNode.classList.contains(backdropClass)) {560 this.backdropNode = this.dialogNode.parentNode;561 } else {562 this.backdropNode = document.createElement('div');563 this.backdropNode.className = backdropClass;564 this.backdropNode.data('markup', 'new');565 this.dialogNode.parentNode.insertBefore(this.backdropNode, this.dialogNodev);566 this.backdropNode.appendChild(this.dialogNode);567 }568 this.backdropNode.classList.add('forminator-active'); // Disable scroll on the body element569 document.body.parentNode.classList.add(aria.Utils.dialogOpenClass);570 if ('string' === typeof focusAfterClosed) {571 this.focusAfterClosed = document.getElementById(focusAfterClosed);572 } else if ('object' === _typeof(focusAfterClosed)) {573 this.focusAfterClosed = focusAfterClosed;574 } else {575 throw new Error('the focusAfterClosed parameter is required for the aria.Authentication constructor.');576 }577 if ('string' === typeof focusFirst) {578 this.focusFirst = document.getElementById(focusFirst);579 } else if ('object' === _typeof(focusFirst)) {580 this.focusFirst = focusFirst;581 } else {582 this.focusFirst = null;583 } // Bracket the dialog node with two invisible, focusable nodes.584 // While this dialog is open, we use these to make sure that focus never585 // leaves the document even if dialogNode is the first or last node.586 var preDiv = document.createElement('div');587 this.preNode = this.dialogNode.parentNode.insertBefore(preDiv, this.dialogNode);588 this.preNode.tabIndex = 0;589 var postDiv = document.createElement('div');590 this.postNode = this.dialogNode.parentNode.insertBefore(postDiv, this.dialogNode.nextSibling);591 this.postNode.tabIndex = 0; // If this modal is opening on top of one that is already open,592 // get rid of the document focus listener of the open dialog.593 if (0 < aria.OpenDialogList.length) {...
index.js
Source:index.js
...23 expect(window.Branch).toBeDefined();24 });25 it("should contain a method called getLatestReferringParams()", function() {26 expect(window.Branch.getLatestReferringParams).toBeDefined();27 expect(_typeof(window.Branch.getLatestReferringParams)).toBe("function");28 });29 it("should contain a method called getFirstReferringParams()", function() {30 expect(window.Branch.getFirstReferringParams).toBeDefined();31 expect(_typeof(window.Branch.getFirstReferringParams)).toBe("function");32 });33 it("should contain a method called setIdentity()", function() {34 expect(window.Branch.setIdentity).toBeDefined();35 expect(_typeof(window.Branch.setIdentity)).toBe("function");36 });37 it("should contain a method called logout()", function() {38 expect(window.Branch.logout).toBeDefined();39 expect(_typeof(window.Branch.logout)).toBe("function");40 });41 it("should contain a method called createBranchUniversalObject()", function() {42 expect(window.Branch.createBranchUniversalObject).toBeDefined();43 expect(_typeof(window.Branch.createBranchUniversalObject)).toBe(44 "function"45 );46 });47 it("should contain a method called userCompletedAction()", function() {48 expect(window.Branch.userCompletedAction).toBeDefined();49 expect(_typeof(window.Branch.userCompletedAction)).toBe("function");50 });51 it("should contain a method called loadRewards()", function() {52 expect(window.Branch.loadRewards).toBeDefined();53 expect(_typeof(window.Branch.loadRewards)).toBe("function");54 });55 it("should contain a method called redeemRewards()", function() {56 expect(window.Branch.redeemRewards).toBeDefined();57 expect(_typeof(window.Branch.redeemRewards)).toBe("function");58 });59 it("should contain a method called creditHistory()", function() {60 expect(window.Branch.creditHistory).toBeDefined();61 expect(_typeof(window.Branch.creditHistory)).toBe("function");62 });63 });64 describe("Branch.getLatestReferringParams()", function() {65 beforeEach(function(done) {66 window.Branch.initSession().then(function() {67 done();68 });69 }, 3000);70 it(71 "should return an object response",72 function(done) {73 window.Branch.getLatestReferringParams().then(function(res) {74 expect(typeof res === "undefined" ? "undefined" : _typeof(res)).toBe(75 "object"76 );77 done();78 });79 },80 1000081 );82 });83 describe("Branch.getFirstReferringParams()", function() {84 beforeEach(function(done) {85 window.Branch.initSession().then(function() {86 done();87 });88 }, 3000);89 it(90 "should return an object response",91 function(done) {92 window.Branch.getFirstReferringParams().then(function(res) {93 // We expect false since we won't open this from a branch link94 expect(res).toBe(false);95 done();96 });97 },98 1000099 );100 });101 describe("Branch.setIdentity()", function() {102 beforeEach(function(done) {103 window.Branch.initSession().then(function() {104 done();105 });106 }, 3000);107 it(108 'should return "Success" response',109 function(done) {110 window.Branch.setIdentity("new_identity").then(function(res) {111 expect(typeof res === "undefined" ? "undefined" : _typeof(res)).toBe(112 "object"113 );114 done();115 });116 },117 10000118 );119 });120 describe("Branch.createBranchUniversalObject()", function() {121 var branchUniversalObj;122 beforeEach(function(done) {123 window.Branch.initSession().then(function() {124 var properties = {125 canonicalIdentifier: "testbed",126 title: "testbed",127 contentDescription: "Testbed Application",128 contentImageUrl: "https://imgflip.com/s/meme/Derp.jpg",129 contentIndexingMode: "public",130 contentMetadata: {}131 };132 window.Branch.createBranchUniversalObject(properties).then(function(133 res134 ) {135 branchUniversalObj = res;136 done();137 });138 });139 }, 3000);140 it(141 "should execute register view",142 function(done) {143 branchUniversalObj.registerView().then(function(res) {144 expect(typeof res === "undefined" ? "undefined" : _typeof(res)).toBe(145 "object"146 );147 done();148 });149 },150 5000151 );152 it(153 "should execute generate short url",154 function(done) {155 var properties = {156 feature: "test",157 alias: "testbed",158 channel: "test",159 stage: "test",160 duration: 10000161 };162 var controlParams = {163 $fallback_url: "www.another.com",164 $desktop_url: "www.desktop.com",165 $android_url: "test",166 $ios_url: "ios",167 $ipad_url: "ipad",168 $fire_url: "fire",169 $blackberry_url: "blackberry",170 $windows_phone_url: "win-phone"171 };172 branchUniversalObj173 .generateShortUrl(properties, controlParams)174 .then(function(res) {175 expect(176 typeof res === "undefined" ? "undefined" : _typeof(res)177 ).toBe("object");178 done();179 });180 },181 5000182 );183 });184 describe("Branch.userCompletedAction()", function() {185 beforeEach(function(done) {186 window.Branch.initSession().then(function() {187 done();188 });189 }, 3000);190 it(191 "should successfully execute the method",192 function(done) {193 window.Branch.userCompletedAction("login");194 expect("Success").toBe("Success");195 done();196 },197 10000198 );199 });200 describe("Branch.loadRewards()", function() {201 beforeEach(function(done) {202 window.Branch.initSession().then(function() {203 done();204 });205 }, 3000);206 it(207 "should return an object response",208 function(done) {209 window.Branch.loadRewards().then(210 function(res) {211 expect(212 typeof res === "undefined" ? "undefined" : _typeof(res)213 ).toBe("number");214 done();215 },216 function(err) {217 expect(218 typeof err === "undefined" ? "undefined" : _typeof(err)219 ).toBe("string");220 done();221 }222 );223 },224 10000225 );226 });227 describe("Branch.redeemRewards()", function() {228 beforeEach(function(done) {229 window.Branch.initSession().then(function() {230 done();231 });232 }, 3000);233 it(234 "should return an object/string error response",235 function(done) {236 window.Branch.redeemRewards(100).then(237 function(res) {238 expect(239 typeof res === "undefined" ? "undefined" : _typeof(res)240 ).toBe("object");241 done();242 },243 function(err) {244 expect(245 typeof err === "undefined" ? "undefined" : _typeof(err)246 ).toBe("string");247 done();248 }249 );250 },251 10000252 );253 });254 describe("Branch.creditHistory()", function() {255 beforeEach(function(done) {256 window.Branch.initSession().then(function() {257 done();258 });259 }, 3000);260 it(261 "should return the credit balance",262 function(done) {263 window.Branch.creditHistory().then(function(res) {264 expect(typeof res === "undefined" ? "undefined" : _typeof(res)).toBe(265 "object"266 );267 done();268 });269 },270 10000271 );272 });...
touch.js
Source:touch.js
1"use strict";2function _typeof(obj) { if (typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol") { _typeof = function (_typeof2) { function _typeof(_x) { return _typeof2.apply(this, arguments); } _typeof.toString = function () { return _typeof2.toString(); }; return _typeof; }(function (obj) { return typeof obj === "undefined" ? "undefined" : _typeof(obj); }); } else { _typeof = function (_typeof3) { function _typeof(_x2) { return _typeof3.apply(this, arguments); } _typeof.toString = function () { return _typeof3.toString(); }; return _typeof; }(function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); }); } return _typeof(obj); }3/*! touch.js | Friendkit | 2019-2020 */4/* ==========================================================================5Touch functions6========================================================================== */7$(document).ready(function () {8 "use strict";9 (function (factory) {10 if (typeof define === 'function' && define.amd) {11 define(['jquery', 'hammerjs'], factory);12 } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') {13 factory(require('jquery'), require('hammerjs'));14 } else {15 factory(jQuery, Hammer);16 }17 })(function ($, Hammer) {18 function hammerify(el, options) {19 var $el = $(el);20 if (!$el.data("hammer")) {21 $el.data("hammer", new Hammer($el[0], options));22 }23 }24 $.fn.hammer = function (options) {25 return this.each(function () {26 hammerify(this, options);...
Using AI Code Generation
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };2var obj = new Object();3obj.name = "test";4obj.age = 10;5console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));6console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));7console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));8console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));9console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));10console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));11console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));12console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));13console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));14console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));15console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));16console.log("type of object is " + (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)));17console.log("type of
Using AI Code Generation
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };2var util = require('util');3var myObject = {4};5console.log(util.inspect(myObject));6console.log(_typeof(myObject));7{ a: 2 }
Using AI Code Generation
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };2var foo = 1;3var bar = "abc";4var baz = true;5var qux = null;6var quux = undefined;7var quuz = Symbol();8var corge = {};9var grault = [];10var garply = function garply() {};11var waldo = new Date();12var fred = /abc/;13var plugh = new Map();14var xyzzy = new Set();15var thud = new WeakMap();16var thud2 = new WeakSet();17var thud3 = new Promise(function (resolve) {18 return resolve();19});20console.log(_typeof(foo));21console.log(_typeof(bar));22console.log(_typeof(baz));23console.log(_typeof(qux));24console.log(_typeof(quux));25console.log(_typeof(quuz));26console.log(_typeof(corge));27console.log(_typeof(grault));28console.log(_typeof(garply));29console.log(_typeof(waldo));30console.log(_typeof(fred));31console.log(_typeof(plugh));32console.log(_typeof(xyzzy));33console.log(_typeof(thud));34console.log(_typeof(thud2));35console.log(_typeof(thud3));36{37 {38 },39 {40 },41 {42 },43 {44 }45 {
Using AI Code Generation
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };2var fs = require('fs');3var _ = require('lodash');4var glob = require('glob');5var path = require('path');6var argv = require('minimist')(process.argv.slice(2));7var config = require('./backstop.json');8var configFileName = 'backstop.json';9var scenarioFileName = 'scenario.js';10var scenarios = [];11var scenarioCount = 0;12var scenariosDir = argv.scenarios;13var configDir = argv.config;14if (configDir) {15 config = require(path.join(process.cwd(), configDir, configFileName));16}17if (scenariosDir) {18 scenarios = getScenarios(scenariosDir);19 config.scenarios = scenarios;20}21function getScenarios(scenariosDir) {22 var scenarios = [];23 var files = glob.sync(path.join(scenariosDir, '**', scenarioFileName));24 files.forEach(function (file) {25 var scenario = require(path.join(process.cwd(), file));26 if (scenario) {27 if (scenario.constructor === Array) {28 scenario.forEach(function (s) {29 return scenarios.push(s);30 });31 } else {32 scenarios.push(scenario);33 }34 }35 });36 return scenarios;37}38function getScenarioCount(scenarios) {39 scenarios.forEach(function (scenario) {40 if (scenario.constructor === Array) {41 scenarioCount += scenario.length;42 } else {43 scenarioCount++;44 }45 });46 return scenarioCount;47}48if (argv._[0] === 'init') {49 fs.writeFileSync(path.join(process.cwd(), configFileName), JSON.stringify(config, null, 2), 'utf8');50 console.log('BackstopJS config file created');51}52if (argv._[0] === 'reference') {53 if (argv.scenarios) {54 config.scenarios = getScenarios(scenariosDir);55 scenarioCount = getScenarioCount(config.scenarios);56 }57 if (config.scenarios.length === 0) {58 console.log('No scenarios found');59 } else {60 console.log('Found ' + scenarioCount + ' scenarios');
Using AI Code Generation
1var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };2console.log(_typeof('test'));3console.log(_typeof(1));4console.log(_typeof(true));5console.log(_typeof({}));6console.log(_typeof([]));7console.log(_typeof(null));8console.log(_typeof(undefined));9console.log(_typeof(NaN));10console.log(_typeof(new Date()));11console.log(typeof 'test');12console.log(typeof 1);13console.log(typeof true);14console.log(typeof {});15console.log(typeof []);16console.log(typeof null);17console.log(typeof undefined);18console.log(typeof NaN);19console.log(typeof new Date());
Using AI Code Generation
1var backstop = require('backstopjs');2var backstop = require('backstopjs');3backstop('reference', { config: 'backstop.json' })4 .then(function (bsConfig) {5 console.log(bsConfig);6 })7 .catch(function (err) {8 console.error(err);9 });10var backstop = require('backstopjs');11backstop('reference', { config: 'backstop.json' })12 .then(function (bsConfig) {13 console.log(bsConfig);14 })15 .catch(function (err) {16 console.error(err);17 });18var backstop = require('backstopjs');19backstop('reference', { config: 'backstop.json' })20 .then(function (bsConfig) {21 console.log(bsConfig);22 })23 .catch(function (err) {24 console.error(err);25 });26var backstop = require('backstopjs');27backstop('reference', { config: 'backstop.json' })28 .then(function (bsConfig) {29 console.log(bsConfig);30 })31 .catch(function (err) {32 console.error(err);33 });34var backstop = require('backstopjs');35backstop('reference', { config: 'backstop.json' })36 .then(function (bsConfig) {37 console.log(bsConfig);38 })39 .catch(function (err) {40 console.error(err);41 });42var backstop = require('backstopjs');43backstop('reference', { config: 'backstop.json' })44 .then(function (bsConfig) {45 console.log(bsConfig);46 })47 .catch(function (err) {48 console.error(err);49 });50var backstop = require('backstopjs');51backstop('reference', { config: 'backstop.json' })52 .then(function (bsConfig) {53 console.log(bsConfig);54 })55 .catch(function (err) {56 console.error(err);57 });58var backstop = require('backstopjs');59backstop('reference', { config: 'backstop.json' })60 .then(function (bsConfig) {61 console.log(bsConfig);62 })63 .catch(function (err) {64 console.error(err);65 });
Using AI Code Generation
1const _typeof = require('backstopjs/core/util/typeof');2const expect = require('chai').expect;3describe('typeof', function() {4 it('should return the correct type of an object', function() {5 expect(_typeof({})).to.equal('object');6 });7});8{9 "scripts": {10 },11 "dependencies": {12 }13}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!