How to use createOption method in Testcafe

Best JavaScript code snippet using testcafe

Respondo2Calculator.js

Source:Respondo2Calculator.js Github

copy

Full Screen

...13/*!14 * Function for the creating select option values15 *16 */17function createOption(text, value) {18 var option = new Option();19 option.text = text;20 option.value = value;21 return option;22}23/*!24 * Function for the clearing select option values25 *26 */27function clearOptions(list) {28 for(var i = 0; i < list.options.length; i ++)29 list.options[i] = null;30}31/*!32 * Function for loading the Cylinder % Full values33 *34 */35function loadcylinderFull() {36 var cylinderFullList = document.getElementById('cylinderFull');37 var options = getcylinderFullListOptions();38 for(var i = 0; i < options.length; i++) {39 cylinderFullList.options[i] = options[i];40 }41}42/*!43 * Function for creating the Cylinder % Full values44 *45 */46function getcylinderFullListOptions() {47 cylinderFullOptions = new Array();48 cylinderFullOptions[cylinderFullOptions.length] = createOption("Select Cylinder % Full", '');49 cylinderFullOptions[cylinderFullOptions.length] = createOption("Full Cylinder", 1);50 cylinderFullOptions[cylinderFullOptions.length] = createOption("75 % Full - 1500 PSI", 0.75);51 cylinderFullOptions[cylinderFullOptions.length] = createOption("50% Full - 1000 PSI)", 0.5);52 cylinderFullOptions[cylinderFullOptions.length] = createOption("25% Full - 500 PSI)", 0.25);53 return cylinderFullOptions;54}55/*!56 * Function for loading the Liter Flow Selection57 *58 */59function loadLiterFlow(o2DeviceId) {60 var literFlowSizeList = document.getElementById('literFlowId');61 clearOptions(literFlowSizeList);62 var options = getliterFlowOptions(o2DeviceId);63 for(var i = 0; i < options.length; i++) {64 literFlowSizeList.options[i] = options[i];65 }66}67/*!68 * Function for creating the liter flow options69 *70 */71function getliterFlowOptions(o2DeviceId) {72 literFlowOptions = new Array();73 if (o2DeviceId == 'Conserver 5:1') {74 literFlowOptions[literFlowOptions.length] = createOption("Select Liter Flow", '');75 literFlowOptions[literFlowOptions.length] = createOption("1 LPM", 1);76 literFlowOptions[literFlowOptions.length] = createOption("2 LPM", 2);77 literFlowOptions[literFlowOptions.length] = createOption("2.5 LPM", 2.5);78 literFlowOptions[literFlowOptions.length] = createOption("3 LPM", 3);79 literFlowOptions[literFlowOptions.length] = createOption("4 LPM", 4);80 literFlowOptions[literFlowOptions.length] = createOption("5 LPM", 5);81 } else if(o2DeviceId == 'Conserver 3:1') {82 literFlowOptions[literFlowOptions.length] = createOption("Select Liter Flow", '');83 literFlowOptions[literFlowOptions.length] = createOption("1 LPM", 1);84 literFlowOptions[literFlowOptions.length] = createOption("2 LPM", 2);85 literFlowOptions[literFlowOptions.length] = createOption("2.5 LPM", 2.5);86 literFlowOptions[literFlowOptions.length] = createOption("3 LPM", 3);87 literFlowOptions[literFlowOptions.length] = createOption("4 LPM", 4);88 literFlowOptions[literFlowOptions.length] = createOption("5 LPM", 5);89 literFlowOptions[literFlowOptions.length] = createOption("6 LPM", 6);90 } else if(o2DeviceId == 'Adult Regulator') {91 literFlowOptions[literFlowOptions.length] = createOption("Select Liter Flow", '');92 literFlowOptions[literFlowOptions.length] = createOption("1 LPM", 1);93 literFlowOptions[literFlowOptions.length] = createOption("1.5 LPM", 1.5);94 literFlowOptions[literFlowOptions.length] = createOption("2 LPM", 2);95 literFlowOptions[literFlowOptions.length] = createOption("2.5 LPM", 2.5);96 literFlowOptions[literFlowOptions.length] = createOption("3 LPM", 3);97 literFlowOptions[literFlowOptions.length] = createOption("4 LPM", 4);98 literFlowOptions[literFlowOptions.length] = createOption("5 LPM", 5);99 literFlowOptions[literFlowOptions.length] = createOption("6 LPM", 6);100 literFlowOptions[literFlowOptions.length] = createOption("7 LPM", 7);101 literFlowOptions[literFlowOptions.length] = createOption("8 LPM", 8);102 literFlowOptions[literFlowOptions.length] = createOption("10 LPM", 10);103 literFlowOptions[literFlowOptions.length] = createOption("12 LPM", 12);104 literFlowOptions[literFlowOptions.length] = createOption("15 LPM", 15);105 } else if(o2DeviceId == 'Pediatric Regulator') {106 literFlowOptions[literFlowOptions.length] = createOption("Select Liter Flow", '');107 literFlowOptions[literFlowOptions.length] = createOption("0.03 LPM", 0.03);108 literFlowOptions[literFlowOptions.length] = createOption("0.06 LPM", 0.06);109 literFlowOptions[literFlowOptions.length] = createOption("0.12 LPM", 0.12);110 literFlowOptions[literFlowOptions.length] = createOption("0.25 LPM", 0.25);111 literFlowOptions[literFlowOptions.length] = createOption("0.375 LPM", 0.375);112 literFlowOptions[literFlowOptions.length] = createOption("0.5 LPM", 0.5);113 literFlowOptions[literFlowOptions.length] = createOption("0.75 LPM", 0.75);114 literFlowOptions[literFlowOptions.length] = createOption("1 LPM", 1);115 literFlowOptions[literFlowOptions.length] = createOption("1.5 LPM", 1.5);116 literFlowOptions[literFlowOptions.length] = createOption("2.0 LPM", 2.0);117 literFlowOptions[literFlowOptions.length] = createOption("2.5 LPM", 2.5);118 literFlowOptions[literFlowOptions.length] = createOption("3 LPM", 3);119 literFlowOptions[literFlowOptions.length] = createOption("4 LPM", 4);120 } else if(o2DeviceId == 'EMS Regulator') {121 literFlowOptions[literFlowOptions.length] = createOption("Select Liter Flow", '');122 literFlowOptions[literFlowOptions.length] = createOption("1 LPM", 1);123 literFlowOptions[literFlowOptions.length] = createOption("2 LPM", 2);124 literFlowOptions[literFlowOptions.length] = createOption("3 LPM", 3);125 literFlowOptions[literFlowOptions.length] = createOption("4 LPM", 4);126 literFlowOptions[literFlowOptions.length] = createOption("6 LPM", 6);127 literFlowOptions[literFlowOptions.length] = createOption("8 LPM", 8);128 literFlowOptions[literFlowOptions.length] = createOption("10 LPM", 10);129 literFlowOptions[literFlowOptions.length] = createOption("15 LPM", 15);130 literFlowOptions[literFlowOptions.length] = createOption("20 LPM", 20);131 literFlowOptions[literFlowOptions.length] = createOption("25 LPM", 25);132 }133 return literFlowOptions;134}135/*!136 * Function For changing the Liter Flow Selection137 *138 */139function fn_literflow(literFlowId) {140 141 if($('#o2Device').val()!='' && $('#literFlowId').val()!='' && $('#cylinderSize').val()!='' && $('#cylinderFull').val()!='') { 142 var CalcObject = new Respondo2Calculator();143 var result = CalcObject.calculateDuration($('#o2Device').val(), $('#literFlowId').val(), $('#cylinderSize').val(), $('#cylinderFull').val());144 setTimeout("displayResult('err_div', '"+result+"')", 400);145 //$('#err_div').html(result);146 } else {147 $('#err_div').html('Please make selections.');148 return false;149 }150}151/*!152 * Function For changing the Cylinder Size Selection153 *154 */155function fn_cylinderSize() {156 157 if($('#o2Device').val()!='' && $('#literFlowId').val()!='' && $('#cylinderSize').val()!='' && $('#cylinderFull').val()!='') { 158 var CalcObject = new Respondo2Calculator();159 var result = CalcObject.calculateDuration($('#o2Device').val(), $('#literFlowId').val(), $('#cylinderSize').val(), $('#cylinderFull').val());160 setTimeout("displayResult('err_div', '"+result+"')", 400);161 //$('#err_div').html(result);162 } else {163 $('#err_div').html('Please make selections.');164 return false;165 }166} 167/*!168 * Function For changing the Cylinder % Full169 *170 */171function fn_cylinderFull(){172 if($('#o2Device').val()!='' && $('#literFlowId').val()!='' && $('#cylinderSize').val()!='' && $('#cylinderFull').val()!='') { 173 var CalcObject = new Respondo2Calculator();174 var result = CalcObject.calculateDuration($('#o2Device').val(), $('#literFlowId').val(), $('#cylinderSize').val(), $('#cylinderFull').val());175 setTimeout("displayResult('err_div', '"+result+"')", 400);176 //$('#err_div').html(result);177 } else {178 $('#err_div').html('Please make selections.');179 return false;180 }181}182/*!183 * Function for creating the Cylinder Size options184 *185 */186function getcylinderSizeOptions(o2DeviceId) {187 cylinderSizeOptions = new Array();188 if (o2DeviceId =='Conserver 3:1' || o2DeviceId =='Conserver 5:1')189 {190 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("Select Cylinder Size ", '');191 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M4 / 113L", 113);192 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M6 / 164L", 164);193 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M7 / 198L", 198);194 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M9 / 248L", 248);195 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("D / 415L", 415);196 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("E / 682L", 682);197 198 } else {199 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("Select Cylinder Size ", '');200 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M4 / 113L", 113);201 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M6 / 164L", 164);202 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M7 / 198L", 198);203 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M9 / 248L", 248);204 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("D / 415L", 415);205 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("Jumbo D / 647L", 647);206 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("E / 682L", 682);207 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("M60 / 1724L", 1724);208 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("MM / 3452L", 3452);209 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("H / 6226L", 6226);210 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("H250 / 7075L", 7075);211 cylinderSizeOptions[cylinderSizeOptions.length] = createOption("T300 / 8490L", 8490);212 }213 return cylinderSizeOptions;214 }215function loadCylindersize(o2DeviceId) {216 217 var cylinderSizeList = document.getElementById('cylinderSize');218 clearOptions(cylinderSizeList);219 var options = getcylinderSizeOptions(o2DeviceId);220 for(var i = 0; i < options.length; i++) {221 cylinderSizeList.options[i] = options[i];222 }223}224$(document).ready(function() {225 ...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1$(document).ready(function () {2 $('.slider-container').slick({3 dots: false,4 arrows: false,5 centerMode: true,6 infinite: true,7 speed: 300,8 fade: true,9 centerPadding: '60px',10 slidesToShow: 1,11 mobileFirst: true,12 responsive: [13 {14 breakpoint: 1280,15 settings: {16 arrows: true,17 },18 },19 ],20 });21});22window.addEventListener('DOMContentLoaded', (e) => {23 const form = document.getElementById('mainForm');24 const submitButton = document.getElementById('submitBtn');25 const name = document.getElementById('name');26 const surname = document.getElementById('surname');27 const email = document.getElementById('email');28 const state = document.getElementById('state');29 const locality = document.getElementById('locality');30 const ciInput = document.getElementById('ci');31 const checkboxBases = document.getElementById('checkboxBases');32 var dptosLocs = {33 Artigas: ['Artigas', 'Bella Unión'],34 Canelones: ['Canelones', 'Santa Lucía'],35 Montevideo: ['Montevideo'],36 Salto: ['Salto', 'Daymán', 'Arapey'],37 };38 //Mensaje de alerta cuando hay error en algun input del form39 function warningText(element) {40 if (!element.parentNode.querySelector('.warning-text')) {41 let message = '';42 switch (element) {43 case name:44 message = 'Debe tener al menos dos caracteres';45 break;46 case surname:47 message = 'Debe tener al menos dos caracteres';48 break;49 case email:50 message = 'Formato xxx@xxxx.xx';51 break;52 case state:53 message = 'Seleccione el Departamento';54 break;55 case locality:56 message = 'Seleccione la Localidad';57 break;58 case ciInput:59 message = 'Formato 1.111.111-1 o sin . ni -';60 break;61 default:62 message = 'Error, vuelva a ingresar los valores';63 break;64 }65 if (element !== checkboxBases) {66 const warning = document.createElement('span');67 warning.classList.add('warning-text');68 warning.innerHTML = message;69 element.parentNode.insertBefore(warning, element);70 return true;71 }72 }73 return false;74 }75 //Agrega borde rojo a los inputs del form cuando hay error76 function redBorder(element) {77 element.style.borderColor = 'red';78 warningText(element);79 }80 //Elimina borde rojo81 function removeRedBorder(element) {82 element.style.removeProperty('border');83 }84 //Validación de email85 function validateEmail(email) {86 const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;87 //devuelve true o false88 return re.test(String(email).toLowerCase());89 }90 function validation(element) {91 const theEmail = email.value;92 console.log(element.value);93 switch (true) {94 case element === checkboxBases && !element.checked:95 redBorder(element);96 break;97 case element === email && !validateEmail(theEmail):98 redBorder(element);99 break;100 case (element === name && element.value.length < 2) || (element === surname && element.value.length < 2):101 redBorder(element);102 break;103 case element === state && element.value == '':104 redBorder(element);105 break;106 case element === locality && element.value == '':107 redBorder(element);108 break;109 default:110 removeRedBorder(element);111 break;112 }113 // if (element === checkboxBases && !element.checked) {114 // redBorder(element);115 // return false;116 // } else {117 // if (!validateEmail(theEmail) || !element.value || (element.value.length < 2 && element.value == 888)) {118 // redBorder(element);119 // return false;120 // } else {121 // removeRedBorder(element);122 // return true;123 // }124 // }125 }126 function checkForm() {127 if (!checkboxBases.checked) {128 // alert('Por favor acepta las bases y condiciones');129 checkboxBases.focus();130 return false;131 }132 return true;133 }134 /*************************************************************************************************************************/135 /********************** VALIDACION DADA PARA SER UTILIZADA ***************************************************************/136 /*************************************************************************************************************************/137 function validarCedula(ci) {138 //valido para formato (1.111.111-1)139 const checkRegEx = /^(\d).(\d{3}).(\d{3})-(\d)$/g;140 const check = checkRegEx.test(ci);141 //elimino . y -142 if (check) {143 ci = ci.replaceAll('.', '').replace('-', '');144 }145 //Inicializo los coefcientes en el orden correcto146 const arrCoefs = new Array(2, 9, 8, 7, 6, 3, 4, 1);147 let suma = 0;148 //Para el caso en el que la CI tiene menos de 8 digitos149 //calculo cuantos coeficientes no voy a usar150 const difCoef = parseInt(arrCoefs.length - ci.length);151 //recorro cada digito empezando por el de más a la derecha152 //o sea, el digito verificador, el que tiene indice mayor en el array153 for (let i = ci.length - 1; i > -1; i--) {154 //Obtengo el digito correspondiente de la ci recibida155 const dig = ci.substring(i, i + 1);156 //Lo tenía como caracter, lo transformo a int para poder operar157 const digInt = parseInt(dig);158 //Obtengo el coeficiente correspondiente al ésta posición del digito159 const coef = arrCoefs[i + difCoef];160 //Multiplico dígito por coeficiente y lo acumulo a la suma total161 suma = suma + digInt * coef;162 }163 let result = false;164 // si la suma es múltiplo de 10 es una ci válida165 if (suma % 10 === 0 && ci) {166 //Doy formato de cedula (1.111.111-1)167 const regEx = /^(\d)(\d{3})(\d{3})(\d)$/g;168 ci = ci.replace(regEx, '$1.$2.$3-$4');169 ciInput.value = ci;170 //Elimino borde inline171 removeRedBorder(ciInput);172 removeWarningText(ciInput);173 result = true;174 } else {175 redBorder(ciInput);176 result = false;177 }178 return result;179 }180 //Elimino Mensaje de error181 function removeWarningText(element) {182 //Selecciono el elemento con clase .warning-text183 let getSpan = element.parentNode.querySelector('.warning-text');184 if (getSpan) {185 getSpan.remove();186 result = true;187 } else {188 result = false;189 }190 return result;191 }192 function inFocus(element) {193 const hasFocus = element === document.activeElement;194 if (hasFocus) {195 removeRedBorder(element);196 removeWarningText(element);197 }198 }199 //Borra elementos del DOM200 function clearSelect(empty) {201 while (empty.childNodes.length > 2) {202 empty.removeChild(empty.lastChild);203 }204 }205 //Selección de departamento206 function selectedState(toAppend) {207 clearSelect(locality);208 let stateVal = state.value;209 switch (stateVal) {210 case '1':211 dptosLocs.Artigas.forEach((e) => {212 let createOption = document.createElement('option');213 createOption.innerHTML += `214 ${e}`;215 toAppend.appendChild(createOption);216 });217 break;218 case '2':219 dptosLocs.Canelones.forEach((e) => {220 let createOption = document.createElement('option');221 createOption.innerHTML += `222 ${e}`;223 toAppend.appendChild(createOption);224 });225 break;226 case '3':227 dptosLocs.Montevideo.forEach((e) => {228 let createOption = document.createElement('option');229 createOption.innerHTML += `230 ${e}`;231 toAppend.appendChild(createOption);232 });233 break;234 case '4':235 dptosLocs.Salto.forEach((e) => {236 let createOption = document.createElement('option');237 createOption.innerHTML += `238 ${e}`;239 toAppend.appendChild(createOption);240 });241 break;242 default:243 // console.log('default');244 // let createOption = document.createElement('option');245 // createOption.innerHTML += `Seleccione un departamento`;246 // toAppend.appendChild(createOption);247 break;248 }249 }250 //Carga los departamentos251 function loadStates(toAppend) {252 for (const prop in dptosLocs) {253 let i = parseInt(Object.keys(dptosLocs).indexOf(prop) + 1);254 let createOption = document.createElement('option');255 createOption.innerHTML += `256 ${prop}`;257 toAppend.appendChild(createOption);258 createOption.setAttribute('value', i);259 }260 }261 loadStates(state);262 form.addEventListener('change', (e) => {263 let element = e.target;264 if (element.value !== '' && element.id == 'state') {265 selectedState(locality);266 }267 });268 //Agrega evento269 form.addEventListener('click', (e) => {270 let element = e.target;271 if (element.type !== 'checkbox') {272 if (element.tagName == 'INPUT' || element.tagName == 'SELECT') {273 e.preventDefault();274 inFocus(element);275 }276 } else {277 inFocus(element);278 }279 });280 //Agrega evento al botón de submit281 submitButton.addEventListener('click', (e) => {282 e.preventDefault();283 validation(name);284 validation(surname);285 validation(email);286 validation(state);287 validation(locality);288 validation(checkboxBases);289 checkForm();290 validarCedula(ci.value);291 });...

Full Screen

Full Screen

options_init.js

Source:options_init.js Github

copy

Full Screen

...6const log = require('./log');7const dateUtils = require('./date_utils');8const keyboardActions = require('./keyboard_actions');9async function initDocumentOptions() {10 await optionService.createOption('documentId', utils.randomSecureToken(16), false);11 await optionService.createOption('documentSecret', utils.randomSecureToken(16), false);12}13async function initSyncedOptions(username, password) {14 await optionService.createOption('username', username, true);15 await optionService.createOption('passwordVerificationSalt', utils.randomSecureToken(32), true);16 await optionService.createOption('passwordDerivedKeySalt', utils.randomSecureToken(32), true);17 const passwordVerificationKey = utils.toBase64(await myScryptService.getVerificationHash(password), true);18 await optionService.createOption('passwordVerificationHash', passwordVerificationKey, true);19 // passwordEncryptionService expects these options to already exist20 await optionService.createOption('encryptedDataKey', '', true);21 await passwordEncryptionService.setDataKey(password, utils.randomSecureToken(16), true);22}23async function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) {24 await optionService.createOption('openTabs', JSON.stringify([25 {26 notePath: startNotePath,27 active: true,28 sidebar: {29 widgets: []30 }31 }32 ]), false);33 await optionService.createOption('lastDailyBackupDate', dateUtils.utcNowDateTime(), false);34 await optionService.createOption('lastWeeklyBackupDate', dateUtils.utcNowDateTime(), false);35 await optionService.createOption('lastMonthlyBackupDate', dateUtils.utcNowDateTime(), false);36 await optionService.createOption('dbVersion', appInfo.dbVersion, false);37 await optionService.createOption('initialized', initialized ? 'true' : 'false', false);38 await optionService.createOption('lastSyncedPull', '0', false);39 await optionService.createOption('lastSyncedPush', '0', false);40 await optionService.createOption('theme', opts.theme || 'white', false);41 await optionService.createOption('syncServerHost', opts.syncServerHost || '', false);42 await optionService.createOption('syncServerTimeout', '5000', false);43 await optionService.createOption('syncProxy', opts.syncProxy || '', false);44}45const defaultOptions = [46 { name: 'noteRevisionSnapshotTimeInterval', value: '600', isSynced: true },47 { name: 'protectedSessionTimeout', value: '600', isSynced: true },48 { name: 'hoistedNoteId', value: 'root', isSynced: false },49 { name: 'zoomFactor', value: '1.0', isSynced: false },50 { name: 'mainFontSize', value: '100', isSynced: false },51 { name: 'treeFontSize', value: '100', isSynced: false },52 { name: 'detailFontSize', value: '110', isSynced: false },53 { name: 'calendarWidget', value: '{"enabled":true,"expanded":true,"position":20}', isSynced: false },54 { name: 'editedNotesWidget', value: '{"enabled":true,"expanded":true,"position":50}', isSynced: false },55 { name: 'noteInfoWidget', value: '{"enabled":true,"expanded":true,"position":100}', isSynced: false },56 { name: 'attributesWidget', value: '{"enabled":true,"expanded":true,"position":200}', isSynced: false },57 { name: 'linkMapWidget', value: '{"enabled":true,"expanded":true,"position":300}', isSynced: false },58 { name: 'noteRevisionsWidget', value: '{"enabled":true,"expanded":true,"position":400}', isSynced: false },59 { name: 'whatLinksHereWidget', value: '{"enabled":false,"expanded":true,"position":500}', isSynced: false },60 { name: 'similarNotesWidget', value: '{"enabled":true,"expanded":true,"position":600}', isSynced: false },61 { name: 'spellCheckEnabled', value: 'true', isSynced: false },62 { name: 'spellCheckLanguageCode', value: 'en-US', isSynced: false },63 { name: 'imageMaxWidthHeight', value: '1200', isSynced: true },64 { name: 'imageJpegQuality', value: '75', isSynced: true },65 { name: 'autoFixConsistencyIssues', value: 'true', isSynced: false },66 { name: 'codeNotesMimeTypes', value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-swift","text/xml","text/x-yaml"]', isSynced: true },67 { name: 'leftPaneWidth', value: '25', isSynced: false },68 { name: 'leftPaneVisible', value: 'true', isSynced: false },69 { name: 'rightPaneWidth', value: '25', isSynced: false },70 { name: 'rightPaneVisible', value: 'true', isSynced: false },71 { name: 'nativeTitleBarVisible', value: 'false', isSynced: false },72 { name: 'eraseNotesAfterTimeInSeconds', value: '604800', isSynced: true }, // default is 7 days73 { name: 'hideArchivedNotes_main', value: 'false', isSynced: false },74 { name: 'hideIncludedImages_main', value: 'true', isSynced: false }75];76async function initStartupOptions() {77 const optionsMap = await optionService.getOptionsMap();78 const allDefaultOptions = defaultOptions.concat(getKeyboardDefaultOptions());79 for (const {name, value, isSynced} of allDefaultOptions) {80 if (!(name in optionsMap)) {81 await optionService.createOption(name, value, isSynced);82 log.info(`Created missing option "${name}" with default value "${value}"`);83 }84 }85}86function getKeyboardDefaultOptions() {87 return keyboardActions.DEFAULT_KEYBOARD_ACTIONS88 .filter(ka => !!ka.actionName)89 .map(ka => ({90 name: "keyboardShortcuts" + ka.actionName.charAt(0).toUpperCase() + ka.actionName.slice(1),91 value: JSON.stringify(ka.defaultShortcuts),92 isSynced: false93 }));94}95module.exports = {...

Full Screen

Full Screen

funds.js

Source:funds.js Github

copy

Full Screen

...50 switch (dist){51 case 'D01':52 division.options.length=0;53 for(i=0; i < D01.length; i++){54 createOption(division,V01[i],D01[i]);55 }56 break;57 58 case 'D02':59 division.options.length=0;60 for(i=0; i < D02.length; i++){61 createOption(division,V02[i],D02[i]);62 }63 break;64 case 'D03':65 division.options.length=0;66 for(i=0; i < D03.length; i++){67 createOption(division,V03[i],D03[i]);68 } 69 break;70 case 'D04':71 division.options.length=0;72 for(i=0; i < D04.length; i++){73 createOption(division,V04[i],D04[i]);74 } 75 break;76 case 'D05':77 division.options.length=0;78 for(i=0; i < D05.length; i++){79 createOption(division,V05[i],D05[i]);80 } 81 break;82 case 'D06':83 division.options.length=0;84 for(i=0; i < D06.length; i++){85 createOption(division,V06[i],D06[i]);86 } 87 break;88 case 'D07':89 division.options.length=0;90 for(i=0; i < D07.length; i++){91 createOption(division,V07[i],D07[i]);92 } 93 break;94 case 'D08':95 division.options.length=0;96 for(i=0; i < D08.length; i++){97 createOption(division,V08[i],D08[i]);98 } 99 break;100 case 'D09':101 division.options.length=0;102 for(i=0; i < D09.length; i++){103 createOption(division,V09[i],D09[i]);104 } 105 break;106 case 'D10':107 division.options.length=0;108 for(i=0; i < D10.length; i++){109 createOption(division,V10[i],D10[i]);110 } 111 break;112 case 'D11':113 division.options.length=0;114 for(i=0; i < D11.length; i++){115 createOption(division,V11[i],D11[i]);116 } 117 break;118 case 'D12':119 division.options.length=0;120 for(i=0; i < D12.length; i++){121 createOption(division,V12[i],D12[i]);122 } 123 break;124 case 'D13':125 division.options.length=0;126 for(i=0; i < D13.length; i++){127 createOption(division,V13[i],D13[i]);128 } 129 break;130 case 'D14':131 division.options.length=0;132 for(i=0; i < D14.length; i++){133 createOption(division,V14[i],D14[i]);134 } 135 break;136 case 'D15':137 division.options.length=0;138 for(i=0; i < D15.length; i++){139 createOption(division,V15[i],D15[i]);140 } 141 break;142 case 'D16':143 division.options.length=0;144 for(i=0; i < D16.length; i++){145 createOption(division,V16[i],D16[i]);146 } 147 break;148 case 'D17':149 division.options.length=0;150 for(i=0; i < D17.length; i++){151 createOption(division,V17[i],D17[i]);152 } 153 break;154 case 'D18':155 division.options.length=0;156 for(i=0; i < D18.length; i++){157 createOption(division,V18[i],D18[i]);158 } 159 break;160 case 'D19':161 division.options.length=0;162 for(i=0; i < D19.length; i++){163 createOption(division,V19[i],D19[i]);164 } 165 break;166 case 'D20':167 division.options.length=0;168 for(i=0; i < D20.length; i++){169 createOption(division,V20[i],D20[i]);170 } 171 break172 case 'D21':173 division.options.length=0;174 for(i=0; i < D21.length; i++){175 createOption(division,V21[i],D21[i]);176 } 177 break178 case 'D22':179 division.options.length=0;180 for(i=0; i < D22.length; i++){181 createOption(division,V22[i],D22[i]);182 } 183 break;184 default:185 division.options.length=0;186 createOption(division,"0","Select Division");187 break;188 } 189 }); 190 function createOption(ddl, value, text){191 var opt = document.createElement('option');192 opt.value = value;193 opt.text = text;194 ddl.options.add(opt);195 }196 function mynormal(){197 var x = document.getElementById("#normal");198 alert("gotit");199 //x.value = x.value.toUpperCase();200 }201 202 }); ...

Full Screen

Full Screen

reactionroles.js

Source:reactionroles.js Github

copy

Full Screen

1exports.reactionRole = function (client) {2 //IMPORTANT : You have to turn on "Server Members Intent" option to use this package properly. in https://discord.com/developers/applications/3 const optionTest1 = client.createOption("🇦", "Obtained 'WATCH THIS' Role!", "Gave up 'WATCH THIS' Role!", ["890814402327117864",]);4 const optionTest2 = client.createOption("🇧", "Obtained 'TESTROLE' Role!", "Gave up 'TESTROLE' Role!", ["890806432293867540",]);5 const LIMIT = 160;6 const RESTRICTIONS = [];7 /* //Commenting Out Role request code 8 const option1 = client.createOption("🇦", "Joined Group A", "Left Group A", ["806190622330454016",]); //806190622330454016 = ROLE ID9 const option2 = client.createOption("🇧", "Joined Group B", "Left Group B", ["806190618602504232",]);10 const option3 = client.createOption("🇨", "Joined Group C", "Left Group C", ["806190613619671131",]);11 const option4 = client.createOption("🇩", "Joined Group D", "Left Group D", ["806190608477585418",]);12 const option5 = client.createOption("🇪", "Joined Group E", "Left Group E", ["806190603947212811",]);13 const option6 = client.createOption("🇫", "Joined Group F", "Left Group F", ["806190600109686834",]);14 const option7 = client.createOption("🇬", "Joined Group G", "Left Group G", ["806190595609329723",]);15 const option8 = client.createOption("🇭", "Joined Group H", "Left Group H", ["806190547042566144",]);16 const option13 = client.createOption("🇮", "Joined Group I", "Left Group I", ["813102649334824970",]);17 const option14 = client.createOption("🇯", "Joined Group J", "Left Group J", ["813102651481784352",]);18 const option9 = client.createOption("🇨", "Obtained Computer Science Role!", "Gave up Computer Science Role!", ["807276618971611188",]);19 const option10 = client.createOption("🇸", "Obtained Software Engineering Role!", "Gave up Software Engineering Role!", ["807276623598190612",]);20 //"🔪"21 const LIMIT = 160;22 const RESTRICTIONS = [];23 */24 //================================================================================================25 client.createMessage(26 "890821509113843743",27 "890811493900251136",28 LIMIT,29 RESTRICTIONS,30 optionTest1,31 optionTest2,32 );33 /* //Commenting Out Role request code ...

Full Screen

Full Screen

options.js

Source:options.js Github

copy

Full Screen

1let embed = require("./embed.js")2let parse = require("./parse.js")3let c = require("../../config.json")4let types = require("../types/StatTypes.js").types5let dataType = createOption(["data","d"],"messages","which data set",types,validateOptions)6let from = createOption(["from","f"],"first record","start date in format `YYYY/MM/DD`",null,validateDate)7let to = createOption(["to","t"],"today","end date in format `YYYY/MM/DD`",null,validateDate)8let users = createOption(["users","u"],"everyone","mention users to see their related data",null,dummy)9let channels = createOption(["channels","ch"],"whole server","see related data of the tagged channels",null,dummy)10let color = createOption(["color","co"],c.defaultColor,"change color of graph by hex code",null,dummy)11let size = createOption(["size","s"],`${c.graphSize.width},${c.graphSize.height}`,"change size (in pixels) of graph in format `width,height` (max: 1000,1500)",null,dummy)12let base = createOption(["base","b"],"relative","change base of graph: starts at 0, or use min and max values",["zero","relative"],validateOptions)13let grouping = createOption(["group","g"],c.defaultGrouping,"group data points, max 100 points",["hours","weeks","months","<number>"],dummy)14let type = createOption(["type"],"line","line or bar graph",["line","bar"],validateOptions)15let compare = createOption(["compare"],"time","data over time, or comparing",["time","hours-day","days-week","days-month"],validateOptions)16module.exports ={17 options : [dataType,from,to,users,channels,color,size,base,grouping,type,compare],18 parse,19 embed20}21function createOption(calls,def,descr,values,validate){22 return {calls,descr,values,def,validate}23}24function validateDate(v){25 if(/\d{4}\/\d{2}\/\d{2}/.test(v)){26 let date = new Date(v.replace("/","-"))27 date.setMonth(date.getMonth()-1)28 date.setDate(date.getDate()-1) 29 return date30 }31 else throw `${v} doesn't fit the date format`32 33}34function dummy (v){35 return v...

Full Screen

Full Screen

constants-charts.js

Source:constants-charts.js Github

copy

Full Screen

1import {createPNES, createVitality, createOrderAmount} from 'components/_ai-charts/config-line'2import {createGender, createShop, createUser} from 'components/_ai-charts/config-pie'3import {createCityTop} from 'components/_ai-charts/config-bar'4import {createUserTop6, createUserTop6Detail} from 'components/_ai-charts/config-graph'5import {createSEM} from 'components/_ai-charts/config-line-sem'6import {createPower} from 'components/_ai-charts/config-radar'7export const BASE_CHARTS_HEIGHT = 64.67236467236467 // 折线图高度百分比8export const CHARTS_TYPE = {9 VITALITY: 'VITALITY', // 近7天活跃度10 PNES: 'PNES', // NES动力模型11 GENDER: 'GENDER', // 客户性别占比12 SHOP: 'SHOP', // 兴趣的商品占比13 USER: 'USER', // 用户分组14 CITY_TOP: 'CITY_TOP', // 城市TOP615 USER_TOP6: 'USER_TOP6', // kol 用户TOP616 USER_TOP6_DETAIL: 'USER_TOP6_DETAIL', // kol 用户TOP617 ORDER_AMOUNT: 'ORDER_AMOUNT', // 金额和订单18 SEM_LIST: 'SEM_LIST', // 营销列表缩略图19 POWER: 'POWER'20}21export const CHARTS_CONFIG = {22 [CHARTS_TYPE.PNES]: {23 createOption: createPNES,24 height: BASE_CHARTS_HEIGHT25 },26 [CHARTS_TYPE.VITALITY]: {27 createOption: createVitality,28 height: BASE_CHARTS_HEIGHT29 },30 [CHARTS_TYPE.GENDER]: {31 createOption: createGender32 },33 [CHARTS_TYPE.SHOP]: {34 createOption: createShop35 },36 [CHARTS_TYPE.USER]: {37 createOption: createUser38 },39 [CHARTS_TYPE.CITY_TOP]: {40 createOption: createCityTop41 },42 [CHARTS_TYPE.USER_TOP6]: {43 createOption: createUserTop6,44 height: BASE_CHARTS_HEIGHT45 },46 [CHARTS_TYPE.USER_TOP6_DETAIL]: {47 createOption: createUserTop6Detail,48 styles: `width:100vw;height:100vh;padding:0`49 },50 [CHARTS_TYPE.ORDER_AMOUNT]: {51 createOption: createOrderAmount52 },53 [CHARTS_TYPE.SEM_LIST]: {54 createOption: createSEM,55 height: 6156 },57 [CHARTS_TYPE.POWER]: {58 createOption: createPower,59 height: 61.3333333333333360 }...

Full Screen

Full Screen

selectField.js

Source:selectField.js Github

copy

Full Screen

1function createOption(value="",name,select=null, defaultOption = false){2 const createOption = document.createElement('option');3 if(value !== ""){4 createOption.value = value;5 }6 createOption.text = name;7 if(defaultOption){8 createOption.setAttribute("default","");9 createOption.setAttribute("selected","");10 createOption.setAttribute("disabled","");11 }12 if(select !== null){13 select.add(createOption);14 }else{15 return createOption;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#submit-button')23 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');24});25import { Selector } from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith')28 .click('#submit-button')29 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');30});31import { Selector } from 'testcafe';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 const select = Selector('#preferred-interface');4 .click(select)5 .click(select.find('option').withText('Both'));6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 const select = Selector('#preferred-interface');10 .click(select)11 .click(select.find('option').withText('Both'));12});13import { Role } from 'testcafe';14 .typeText('#developer-name', 'John Smith')15 .click('#submit-button');16});17import { RequestLogger, RequestHook } from 'testcafe';18const logger = RequestLogger(/testcafe/);19const hook = new RequestHook(/testcafe/);20 .requestHooks(logger, hook);21test('My test', async t => {22});23import { createTestCafe } from 'testcafe';24const testcafe = await createTestCafe('localhost', 1337, 1338);25const runner = testcafe.createRunner();26 .src('./testcafe-fixtures/*.js')27 .browsers('chrome')28 .run();29testcafe.close();30import { createTestFile

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My Test', async t => {3 const select = Selector('#preferred-interface');4 const option = select.createOption('JavaScript API');5 .click(select)6 .click(option);7});8import { Selector } from 'testcafe';9test('My Test', async t => {10 const select = Selector('#preferred-interface');11 const option = select.createOption('JavaScript API');12 .click(select)13 .click(option);14});15I have a test file test.js and another test file test2.js. I want to use the same selector and option inside both the files. I tried to import the selector and option but it is not working. What is the best way to do this?16import { Selector } from 'testcafe';17export const select = Selector('#preferred-interface');18export const option = select.createOption('JavaScript API');19import { select, option } from './select';20test('My Test', async t => {21 .click(select)22 .click(option);23});24import { select, option } from './select';25test('My Test', async t => {26 .click(select)27 .click(option);28});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2import { createOption } from 'testcafe-browser-provider-electron';3test('Test', async t => {4 .click(Selector('button'))5 .click(Selector('button').withText('Button 2'))6 .click(Selector('button').withText('Button 3'))7 .click(Selector('button').withText('Button 4'))8 .click(Selector('button').withText('Button 5'))9 .click(Selector('button').withText('Button 6'))10 .click(Selector('button').withText('Button 7'))11 .click(Selector('button').withText('Button 8'))12 .click(Selector('button').withText('Button 9'))13 .click(Selector('button').withText('Button 10'));14});15import { createBrowserProvider } from 'testcafe-browser-tools';16const browserProvider = createBrowserProvider();17export default {18 async createOption () {19 return {20 };21 }22};23{24 "scripts": {25 },26 "dependencies": {27 }28}29{

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2import { createOption } from 'testcafe-browser-provider-electron';3test('test', async t => {4 const option = createOption('path/to/my/app.exe', {5 env: {6 }7 });

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My test', async t => {3 const select = Selector('#mySelect');4 .click(select)5 .click(select.createOption('value'));6});7import { Selector } from 'testcafe';8test('My test', async t => {9 const select = Selector('#mySelect');10 .click(select)11 .click(select.createOption('value'));12});13import { Selector } from 'testcafe';14test('My test', async t => {15 const select = Selector('#mySelect');16 .click(select)17 .click(select.createOption('value'));18});19import { Selector } from 'testcafe';20test('My test', async t => {21 const select = Selector('#mySelect');22 .click(select)23 .click(select.createOption('value'));24});25import { Selector } from 'testcafe';26test('My test', async t => {27 const select = Selector('#mySelect');28 .click(select)29 .click(select.createOption('value'));30});31import { Selector } from 'testcafe';32test('My test', async t => {33 const select = Selector('#mySelect');34 .click(select)35 .click(select.createOption('value'));36});37import { Selector } from

Full Screen

Using AI Code Generation

copy

Full Screen

1await t.click(testElement);2await t.expect(testElement.value).eql('test');3await t.click(testElement);4await t.expect(testElement.value).eql('test2');5import { Selector } from 'testcafe';6const testElement = Selector('input').withAttribute('name', 'test');7 .beforeEach(async t => {8 await t.click(testElement);9 t.fixtureCtx.value = await testElement.value;10 });11test('Test1', async t => {12 await t.expect(testElement.value).eql(t.fixtureCtx.value);13});14test('Test2', async t => {15 await t.expect(testElement.value).eql(t.fixtureCtx.value);16});17import { Selector } from 'testcafe';18const testElement = Selector('input').withAttribute('name', 'test');19 .beforeEach(async t => {20 await t.click(testElement);21 t.fixtureCtx.value = await testElement.value;22 });23test('Test1', async t => {24 await t.expect(testElement.value).eql(t.fixtureCtx.value);25});26test('Test2', async t => {27 await t.expect(testElement.value).eql(t.fixtureCtx.value);28});

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 Testcafe 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