How to use _typeof method in wpt

Best JavaScript code snippet using wpt

nodes.js

Source:nodes.js Github

copy

Full Screen

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");...

Full Screen

Full Screen

forminator-form.js

Source:forminator-form.js Github

copy

Full Screen

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) {...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...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 });...

Full Screen

Full Screen

touch.js

Source:touch.js Github

copy

Full Screen

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);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.get(function(err, resp) {4 if (err) {5 console.log('Error: ' + err);6 } else {7 console.log(resp);8 }9});10var wptools = require('wptools');11var page = wptools.page('Barack Obama');12page.get(function(err, resp) {13 if (err) {14 console.log('Error: ' + err);15 } else {16 console.log(resp);17 }18});19var wptools = require('wptools');20var page = wptools.page('Barack Obama');21page.get(function(err, resp) {22 if (err) {23 console.log('Error: ' + err);24 } else {25 console.log(resp);26 }27});28var wptools = require('wptools');29var page = wptools.page('Barack Obama');30page.get(function(err, resp) {31 if (err) {32 console.log('Error: ' + err);33 } else {34 console.log(resp);35 }36});37var wptools = require('wptools');38var page = wptools.page('Barack Obama');39page.get(function(err, resp) {40 if (err) {41 console.log('Error: ' + err);42 } else {43 console.log(resp);44 }45});46var wptools = require('wptools');47var page = wptools.page('Barack Obama');48page.get(function(err, resp) {49 if (err) {50 console.log('Error: ' + err);51 } else {52 console.log(resp);53 }54});55var wptools = require('wptools');56var page = wptools.page('Barack Obama');57page.get(function(err, resp

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptool = require('./wptool.js');2var obj = {a:1, b:2, c:3};3var wptool = {4 _typeof: function(obj){5 return Object.prototype.toString.call(obj).slice(8,-1).toLowerCase();6 }7}8module.exports = wptool;9var a = "abc";10var b = a;11a = "def";12var a = "abc";13var b = a;14a = "def";15var a = {x:1, y:2};16var b = a;17a.x = 3;18var a = {x:1, y:2};19var b = a;20a = {x:3, y:4};21var a = {x:1, y:2};22var b = a;23a.x = 3;24console.log(b

Full Screen

Using AI Code Generation

copy

Full Screen

1var _typeof = require('wpt.js')._typeof;2var _typeof = require('wpt.js')._typeof;3var _typeof = require('wpt.js')._typeof;4var _typeof = require('wpt.js')._typeof;5var _typeof = require('wpt.js')._typeof;6var _typeof = require('wpt.js')._typeof;7var _typeof = require('wpt.js')._typeof;8var _typeof = require('wpt.js')._typeof;9var _typeof = require('wpt.js')._typeof;10var _typeof = require('wpt.js')._typeof;11var _typeof = require('wpt.js')._typeof;12var _typeof = require('wpt.js')._typeof;13var _typeof = require('wpt.js')._typeof;14var _typeof = require('wpt.js')._typeof;15var _typeof = require('wpt.js')._typeof;16var _typeof = require('wpt.js')._typeof;17var _typeof = require('wpt.js')._typeof;18var _typeof = require('wpt.js')._typeof;19var _typeof = require('wpt.js')._typeof;20var _typeof = require('wpt.js')._typeof;21var _typeof = require('wpt.js')._typeof;22var _typeof = require('wpt.js')._typeof;23var _typeof = require('wpt.js')._typeof;24var _typeof = require('wpt.js')._typeof;25var _typeof = require('wpt.js')._typeof;26var _typeof = require('wpt.js')._typeof;27var _typeof = require('wpt.js')._typeof;28var _typeof = require('wpt.js')._typeof;29var _typeof = require('wpt.js')._typeof;30var _typeof = require('wpt.js')._typeof

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptool = require('wptool');2var type = wptool._typeof("test");3console.log(type);4var wptool = require('wptool');5var type = wptool._typeof("test");6console.log(type);7var wptool = require('wptool');8var type = wptool._typeof("test");9console.log(type);10var wptool = require('wptool');11var type = wptool._typeof("test");12console.log(type);13var wptool = require('wptool');14var type = wptool._typeof("test");15console.log(type);16var wptool = require('wptool');17var type = wptool._typeof("test");18console.log(type);19var wptool = require('wptool');20var type = wptool._typeof("test");21console.log(type);22var wptool = require('wptool');23var type = wptool._typeof("test");24console.log(type);25var wptool = require('wptool');26var type = wptool._typeof("test");27console.log(type);28var wptool = require('wptool');29var type = wptool._typeof("test");30console.log(type);31var wptool = require('wptool

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var _typeof = wptoolkit._typeof;3var obj = {name : 'wptoolkit'};4var arr = [1,2,3];5var str = 'wptoolkit';6var num = 1;7var bool = true;8var undef = undefined;9var nul = null;10var wptoolkit = require('wptoolkit');11var _isTypeOf = wptoolkit._isTypeOf;12var obj = {name : 'wptoolkit'};13var arr = [1,2,3];14var str = 'wptoolkit';15var num = 1;16var bool = true;17var undef = undefined;18var nul = null;19var wptoolkit = require('wptoolkit');20var _isTypeOf = wptoolkit._isTypeOf;21var obj = {name : 'wptoolkit'};22var arr = [1,2,3];23var str = 'wptoolkit';24var num = 1;25var bool = true;26var undef = undefined;27var nul = null;28console.log(_isTypeOf(num,

Full Screen

Using AI Code Generation

copy

Full Screen

1var x = "hello";2var y = 10;3var z = true;4var a = [1, 2, 3];5var b = { name: "John", age: 30 };6var c = new Date();7var d = function () { };8var e = null;9var f = undefined;10var g = NaN;11var h = Infinity;12var i = -Infinity;13var j = 0 / 0;14var k = 1 / 0;15var l = -1 / 0;16function _typeof(obj) {17 return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();18}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt.js');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.getTestResults('171025_7E_1d8a8a9b0a9b4b4e4b1c8d0e4b2f4a4d', function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var x = 10;3console.log(wptoolkit._typeof(x));4var wptoolkit = require('wptoolkit');5var x = 10;6console.log(wptoolkit._typeof(x));7var wptoolkit = require('wptoolkit');8var x = 10;9console.log(wptoolkit._typeof(x));10var wptoolkit = require('wptoolkit');11var x = 10;12console.log(wptoolkit._typeof(x));13var wptoolkit = require('wptoolkit');14var x = 10;15console.log(wptoolkit._typeof(x));16var wptoolkit = require('wptoolkit');17var x = 10;18console.log(wptoolkit._typeof(x));

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful