How to use context.getElementById method in Cypress

Best JavaScript code snippet using cypress

wpa.js

Source:wpa.js Github

copy

Full Screen

...1241 script: 'js/wpa_a01',1242 style: 'css/wpa',1243 init: function(context, helper){1244 // innerText is not supported in firefox1245 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1246 helper.getOnlineStatus();1247 //绑定事件1248 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1249 }1250 },1251 'a02': {1252 templ: '<div id="wpa_release_a02" class="wpa_release_a02"><a id="launchBtn" href="javascript:;"></a></div>',1253 script: 'js/wpa_a02',1254 style: 'css/wpa',1255 init: function(context, helper){1256 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1257 helper.getOnlineStatus();1258 //绑定事件1259 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1260 }1261 },1262 'a03': {1263 templ: '<div id="wpa_release_a03" class="wpa_release_a03"><a id="launchBtn" href="javascript:;"></a></div>',1264 script: 'js/wpa_a03',1265 style: 'css/wpa',1266 init: function(context, helper){1267 context.getElementById('launchBtn').innerHTML = '\u533F\u540D\u4EA4\u8C08'; //匿名交谈1268 helper.getOnlineStatus();1269 //绑定事件1270 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1271 //anonymous type should get config for click, to avoid block of window.open1272 helper.wpa.getConfig();1273 }1274 },1275 'a04': {1276 templ: '<div id="wpa_release_a04" class="wpa_release_a04"><a id="launchBtn" href="javascript:;"></a></div>',1277 script: 'js/wpa_a04',1278 style: 'css/wpa',1279 init: function(context, helper){1280 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1281 helper.getOnlineStatus();1282 //绑定事件1283 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1284 }1285 },1286 'a05': {1287 templ: '<div id="wpa_release_a05" class="wpa_release_a05"><a id="launchBtn" href="javascript:;"></a></div>',1288 script: 'js/wpa_a05',1289 style: 'css/wpa',1290 init: function(context, helper){1291 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1292 helper.getOnlineStatus();1293 //绑定事件1294 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1295 }1296 },1297 'a06': {1298 templ: '<div id="wpa_release_a06" class="wpa_release_a06"><a id="launchBtn" href="javascript:;"></a></div>',1299 script: 'js/wpa_a06',1300 style: 'css/wpa',1301 init: function(context, helper){1302 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1303 helper.getOnlineStatus();1304 //绑定事件1305 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1306 }1307 },1308 'a07': {1309 templ: '<div id="wpa_release_a07" class="wpa_release_a07 wpa_release_a07_01"><div><table><tr><td valign="middle" id="btn"></td></tr></table></div></div>',1310 script: 'js/wpa_a07',1311 style: 'css/wpa',1312 init: function(context, helper){1313 context.getElementById('btn').innerHTML = helper.xssFilter(helper.params['btn1']);1314 //获取头像风格1315 helper.addClass(context.getElementById('wpa_release_a07'), 'wpa_release_a07_0' + parseInt(helper.params['tx'], 10));1316 helper.getOnlineStatus();1317 //绑定事件1318 helper.addEvent(context.getElementById('wpa_release_a07'), 'click', helper.proxy(helper, helper.chat));1319 }1320 },1321 'a08': {1322 templ: '<div id="wpa_release_a08" class="wpa_release_a08 wpa_release_a08_01"><div><table><tr><td valign="middle" id="launchBtn"></td></tr></table></div></div>',1323 script: 'js/wpa_a08',1324 style: 'css/wpa',1325 init: function(context, helper){1326 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1327 //获取头像风格1328 helper.addClass(context.getElementById('wpa_release_a08'), 'wpa_release_a08_0' + parseInt(helper.params['tx'], 10));1329 helper.getOnlineStatus();1330 //绑定事件1331 helper.addEvent(context.getElementById('wpa_release_a08'), 'click', helper.proxy(helper, helper.chat));1332 }1333 },1334 'a09': {1335 templ: '<div id="wpa_release_a09" class="wpa_release_a09 wpa_release_a09_01"><a id="wpa_release_a09_btn" href="javascript:;"><span class="wpa_release_a09_c_s1" id="wpa_release_a09_c_s1"></span><br /><span class="wpa_release_a09_c_s2" id="wpa_release_a09_c_s2"></span></a></div>',1336 script: 'js/wpa_a09',1337 style: 'css/wpa',1338 init: function(context, helper){1339 context.getElementById('wpa_release_a09_c_s1').innerHTML = helper.xssFilter(helper.params['btn1']);1340 context.getElementById('wpa_release_a09_c_s2').innerHTML = helper.xssFilter(helper.params['btn2']);1341 //获取头像风格1342 helper.addClass(context.getElementById('wpa_release_a09'), 'wpa_release_a09_0' + parseInt(helper.params['tx'], 10));1343 helper.getOnlineStatus();1344 //绑定事件1345 helper.addEvent(context.getElementById('wpa_release_a09'), 'click', helper.proxy(helper, helper.chat));1346 }1347 },1348 'b01': {1349 templ: [1350 '<div id="wpa_release_b01" class="wpa_release_b01 wpa_release_b01_01">',1351 '<div id="wpa_release_b01_title" class="wpa_release_b01_title"></div>',1352 '<div id="wpa_release_b01_content" class="wpa_release_b01_content"></div>',1353 '<div id="wpa_release_b01_btn_box" class="wpa_release_b01_btn_box"><a id="wpa_release_b01_btn" href="javascript:;"></a></div>',1354 '</div>'1355 ].join(''),1356 script: 'js/wpa_b01',1357 style: 'css/wpa',1358 init: function(context, helper){1359 context.getElementById('wpa_release_b01_btn').innerHTML = helper.xssFilter(helper.params['btn1']);1360 context.getElementById('wpa_release_b01_title').innerHTML = helper.xssFilter(helper.params['title']);1361 //获取头像风格1362 var tx = decodeURIComponent(helper.params['tx']);1363 if(tx.indexOf('http') === -1){1364 //normal tx1365 tx = /^https/.test(window.location.href) ?1366 'https://id.b.qq.com/static/account/bizqq/images/wpa/wpa_tx_0' + tx + '.jpg' ://for preview1367 'http://cdn.b.qq.com/account/bizqq/images/wpa/wpa_tx_0' + tx + '.jpg';1368 }1369 context.getElementById('wpa_release_b01_content').innerHTML = '<img src="' + helper.xssFilter(tx) + '" alt="' + helper.xssFilter(helper.params['title']) + '" />';1370 helper.addClass(context.getElementById('wpa_release_b01'), 'wpa_release_b01_0' + parseInt(helper.params['csty'], 10));1371 //绑定事件1372 helper.addEvent(context.getElementById('wpa_release_b01_btn'), 'click', helper.proxy(helper, helper.chat));1373 }1374 },1375 'b02': {1376 templ: [1377 '<div id="wpa_release_b02" class="wpa_release_b02 wpa_release_b02_01">',1378 '<div class="wpa_release_b02_title"><span id="wpa_release_b02_title"></span></div>',1379 '<div id="wpa_release_b02_content" class="wpa_release_b02_content">',1380 '<div id="wpa_release_b02_c_lc" class="wpa_release_b02_c_lc"></div>',1381 '<div id="wpa_release_b02_c_rc" class="wpa_release_b02_c_rc"></div>',1382 '</div>',1383 '<div id="wpa_release_b02_btn_box" class="wpa_release_b02_btn_box"><a id="wpa_release_b02_btn_yes" class="wpa_release_b02_btn_yes" href="javascript:;"></a><a id="wpa_release_b02_btn_no" class="wpa_release_b02_btn_no" href="javascript:;"></a></div>',1384 '<div id="closeBtn" class="closeBtn"></div>',1385 '</div>'1386 ].join(''),1387 script: 'js/wpa_b02',1388 style: 'css/wpa',1389 init: function(context, helper){1390 var params = helper.params,1391 btn1 = params['btn1'] || '',1392 btn2 = params['btn2'] || '',1393 title = params['title'] || '',1394 cot = params['cot'] || '',1395 wpa_release_b02 = context.getElementById('wpa_release_b02'),1396 wpa_release_b02_title = context.getElementById('wpa_release_b02_title'),1397 //wpa_release_b02_btn_close = doc.getElementById('wpa_release_b02_btn_close'),1398 wpa_release_b02_c_lc = context.getElementById('wpa_release_b02_c_lc'),1399 wpa_release_b02_c_rc = context.getElementById('wpa_release_b02_c_rc'),1400 wpa_release_b02_btn_yes = context.getElementById('wpa_release_b02_btn_yes'),1401 wpa_release_b02_btn_no = context.getElementById('wpa_release_b02_btn_no'),1402 closeBtn = context.getElementById('closeBtn');1403 //填充内容1404 wpa_release_b02_title.innerHTML = helper.xssFilter(title);1405 wpa_release_b02_c_rc.innerHTML = helper.xssFilter(cot).replace(/\n/g, '<br />');1406 wpa_release_b02_btn_yes.innerHTML = helper.xssFilter(btn1);1407 wpa_release_b02_btn_no.innerHTML = helper.xssFilter(btn2);1408 //获取头像风格1409 var tx = decodeURIComponent(params['tx']);1410 if(tx.indexOf('http') === -1){1411 //normal tx1412 tx = /^https/.test(window.location.href) ?1413 'https://id.b.qq.com/static/account/bizqq/images/wpa/wpa_tx_0' + tx + '.jpg' ://for preview1414 'http://cdn.b.qq.com/account/bizqq/images/wpa/wpa_tx_0' + tx + '.jpg';1415 }1416 wpa_release_b02_c_lc.innerHTML = '<img src="' + helper.xssFilter(tx) + '" alt="' + helper.xssFilter(title) + '" />';1417 helper.addClass(wpa_release_b02, 'wpa_release_b02_0' + parseInt(helper.params['csty'], 10));1418 //绑定事件1419 helper.addEvent(wpa_release_b02_btn_yes, 'click', helper.proxy(helper, helper.chat));1420 helper.addEvent(wpa_release_b02_btn_no, 'click', helper.proxy(helper, helper.remove));1421 helper.addEvent(closeBtn, 'click', helper.proxy(helper, helper.remove));1422 }1423 },1424 'b03': {1425 templ: [1426 '<div id="wpa_release_b03" class="wpa_release_b03 wpa_release_b03_01">',1427 '<div class="wpa_release_b03_title"><span id="wpa_release_b03_title"></span></div>',1428 '<div id="wpa_release_b03_content" class="wpa_release_b03_content">',1429 '<p id="wpa_release_b03_c_1" class="wpa_release_b03_c_1"></p>',1430 '<p id="wpa_release_b03_c_2" class="wpa_release_b03_c_2"></p>',1431 '</div>',1432 '<div id="wpa_release_b03_btn_box" class="wpa_release_b03_btn_box"><a id="wpa_release_b03_btn_yes" class="wpa_release_b03_btn_yes" href="javascript:;"></a><a id="wpa_release_b03_btn_no" class="wpa_release_b03_btn_no" href="javascript:;"></a></div>',1433 '<div id="closeBtn" class="closeBtn"></div>',1434 '</div>'1435 ].join(''),1436 script: 'js/wpa_b03',1437 style: 'css/wpa',1438 init: function(context, helper){1439 var params = helper.params,1440 btn1 = params['btn1'] || '',1441 btn2 = params['btn2'] || '',1442 title = params['title'] || '',1443 cot1 = params['cot1'] || '',1444 cot2 = params['cot2'] || '',1445 wpa_release_b03 = context.getElementById('wpa_release_b03'),1446 wpa_release_b03_title = context.getElementById('wpa_release_b03_title'),1447 //wpa_release_b03_btn_close = document.getElementById('wpa_release_b03_btn_close'),1448 wpa_release_b03_c_1 = context.getElementById('wpa_release_b03_c_1'),1449 wpa_release_b03_c_2 = context.getElementById('wpa_release_b03_c_2'),1450 wpa_release_b03_btn_yes = context.getElementById('wpa_release_b03_btn_yes'),1451 wpa_release_b03_btn_no = context.getElementById('wpa_release_b03_btn_no'),1452 closeBtn = context.getElementById('closeBtn');1453 //填充内容1454 wpa_release_b03_title.innerHTML = helper.xssFilter(title);1455 wpa_release_b03_c_1.innerHTML = helper.xssFilter(cot1);1456 wpa_release_b03_c_2.innerHTML = helper.xssFilter(cot2);1457 wpa_release_b03_btn_yes.innerHTML = helper.xssFilter(btn1);1458 wpa_release_b03_btn_no.innerHTML = helper.xssFilter(btn2);1459 //获取头像风格1460 helper.addClass(wpa_release_b03, 'wpa_release_b03_0' + parseInt(helper.params['tx'], 10));1461 //绑定事件1462 helper.addEvent(wpa_release_b03_btn_yes, 'click', helper.proxy(helper, helper.chat));1463 helper.addEvent(wpa_release_b03_btn_no, 'click', helper.proxy(helper, helper.remove));1464 helper.addEvent(closeBtn, 'click', helper.proxy(helper, helper.remove));1465 }1466 },1467 'b04': {1468 templ: [1469 '<div id="wpa_release_b04" class="wpa_release_b04 wpa_release_b04_01">',1470 '<div class="wpa_release_b04_title"><span id="wpa_release_b04_title"></span></div>',1471 '<div id="wpa_release_b04_content" class="wpa_release_b04_content">',1472 '<p id="wpa_release_b04_c_1" class="wpa_release_b04_c_1"></p>',1473 '<p id="wpa_release_b04_c_2" class="wpa_release_b04_c_2"></p>',1474 '</div>',1475 '<div id="wpa_release_b04_btn_box" class="wpa_release_b04_btn_box"><a id="wpa_release_b04_btn" class="wpa_release_b04_btn" href="javascript:;"></a></div>',1476 '<div id="closeBtn" class="closeBtn"></div>',1477 '</div>'1478 ].join(''),1479 script: 'js/wpa_b04',1480 style: 'css/wpa',1481 init: function(context, helper){1482 var params = helper.params,1483 kfuin = params['kfuin'] || '',1484 title = params['title'] || '',1485 cot1 = params['cot1'] || '',1486 btn1 = params['btn1'] || '',1487 wpa_release_b04 = context.getElementById('wpa_release_b04'),1488 wpa_release_b04_title = context.getElementById('wpa_release_b04_title'),1489 //wpa_release_b04_btn_close = doc.getElementById('wpa_release_b04_btn_close'),1490 wpa_release_b04_c_1 = context.getElementById('wpa_release_b04_c_1'),1491 wpa_release_b04_c_2 = context.getElementById('wpa_release_b04_c_2'),1492 wpa_release_b04_btn = context.getElementById('wpa_release_b04_btn'),1493 closeBtn = context.getElementById('closeBtn');1494 //填充内容1495 wpa_release_b04_title.innerHTML = helper.xssFilter(kfuin);1496 wpa_release_b04_c_1.innerHTML = helper.xssFilter(title);1497 wpa_release_b04_c_2.innerHTML = helper.xssFilter(cot1).replace(/\n/g, '<br />');1498 wpa_release_b04_btn.innerHTML = helper.xssFilter(btn1);1499 //获取头像风格1500 helper.addClass(wpa_release_b04, 'wpa_release_b04_0' + parseInt(helper.params['tx'], 10));1501 //绑定事件1502 helper.addEvent(wpa_release_b04_btn, 'click', helper.proxy(helper, helper.chat));1503 helper.addEvent(closeBtn, 'click', helper.proxy(helper, helper.remove));1504 }1505 },1506 'i01': {1507 templ: [1508 '<div id="wpa_release_i01" class="wpa_release_i01">',1509 '<div class="bg"></div>',1510 '<a id="wpa_release_i01_closeBtn" class="wpa_release_i01_closeBtn" href="javascript:;">close</a>',1511 '<a id="wpa_release_i01_confirmBtn" class="wpa_release_i01_confirmBtn" href="javascript:;">' + '\u5F00\u59CB\u4EA4\u8C08' + '</a>', //开始交谈1512 '<p id="cnt" class="cnt">' + '\u60A8\u597D\uFF0C\u8BF7\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u5230\u60A8\uFF1F\u8BF7\u63A5\u53D7\u804A\u5929\u9080\u8BF7\u3002' + '</p>', //您好,请问有什么可以帮到您?请接受聊天邀请。1513 '<div id="closeBtn" class="closeBtn"></div>',1514 '</div>'1515 ].join(''),1516 script: 'js/wpa_i01',1517 style: 'css/wpa',1518 init: function(context, helper){1519 var closeBtn = context.getElementById('closeBtn'),1520 chatBtn = context.getElementById('wpa_release_i01_confirmBtn');1521 context.getElementById('cnt').innerHTML = helper.xssFilter(helper.params['msg']);1522 //绑定事件1523 helper.addEvent(closeBtn, 'click', helper.proxy(helper, function(){1524 this.remove();1525 titleFlash.off();1526 report('http://visitor.crm2.qq.com/cgi/visitorcgi/ajax/reject_invite.php?nameAccount=' + this.params.nameAccount + '&uid=' + uid);1527 }));1528 helper.addEvent(chatBtn, 'click', helper.proxy(helper, function(){1529 this.chat();1530 this.remove();1531 titleFlash.off();1532 report('http://visitor.crm2.qq.com/cgi/visitorcgi/ajax/accept_invite.php?nameAccount=' + this.params.nameAccount + '&uid=' + uid);1533 }));1534 }1535 },1536 'w01': {1537 templ: '<div id="wpa_release_w01" class="wpa_release_w01"><a id="wpa_release_w01_btn" href="javascript:;"></a></div>',1538 script: 'js/wpa_w01',1539 style: 'css/wpa',1540 init: function(context, helper){1541 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1542 helper.getOnlineStatus();1543 //绑定事件1544 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1545 }1546 },1547 'w02': {1548 templ: '<div id="wpa_release_w02" class="wpa_release_w02"><a id="wpa_release_w02_btn" href="javascript:;"></a></div>',1549 script: 'js/wpa_w02',1550 style: 'css/wpa',1551 init: function(context, helper){1552 context.getElementById('launchBtn').innerHTML = helper.xssFilter(helper.params['btn1']);1553 helper.getOnlineStatus();1554 //绑定事件1555 helper.addEvent(context.getElementById('launchBtn'), 'click', helper.proxy(helper, helper.chat));1556 }1557 }1558 };1559 // wpa view helper1560 var ViewHelper = function( context, wpa ){1561 this.doc = context.document;1562 this.wpa = wpa;1563 this.params = wpa.params;1564 this.params['tx'] && (this.params['tx'] = this.txFilter(this.params['tx']));1565 };1566 ViewHelper.prototype = {1567 getJSONP: getJSONP,1568 proxy: proxy,1569 onLoad: onLoad,...

Full Screen

Full Screen

PosicionGlobalDelegate.js

Source:PosicionGlobalDelegate.js Github

copy

Full Screen

...108 if (existenCuentasMXP) {109 this.showTipoCuenta(cuentasMXP, constants.CUENTA_PESOS);110 this.showCuentas(cuentasMXP, 'article-Pesos', 'div-Pesos');111 112 context.getElementById("cuentas-pesos").setAttribute('style', '');113 114 cuentasPesosTotal=cuentasMXP.length;115 116 117 }118 119 if (existenCuentasUSD) {120 this.showTipoCuenta(cuentasUSD, constants.CUENTA_DOLARES);121 this.showCuentas(cuentasUSD, 'article-Dolares', 'div-Dolares');122 context.getElementById("cuentas-dolares").setAttribute('style', '');123 // alert("show dolares");124 cuentasDolaresTotal=cuentasUSD.length;125 //alert("llega a total dolares");126 127 128 } else {129 context.getElementById("cuentas-dolares").style.display = "none";130 }131 132 if (existenCuentasTDC) {133 this.showTipoCuenta(cuentasTDC, constants.TARJETA_CREDITO);134 cuentasCreditosTotal=cuentasTDC.length;135 136 this.showCuentas(cuentasTDC, 'article-Credito', 'div-Credito');137 138 context.getElementById("cuentas-credito").setAttribute('style', '');139 }140 141 if (existenCuentasPat) {142 143 this.showTipoCuenta(cuentasPat, constants.CUENTAS_PATRIMONIALES);144 145 cuentasPatrimonialesTotal = cuentasPat.length;146 147 this.showCuentas(cuentasPat, 'article-Patrimonial', 'div-Patrimonial');148 149 context.getElementById("cuentas-patrimonial").setAttribute('style', '');150 151 }152 153 this.accountsArray[this.MXP_ACCOUNTS_KEY] = false;154 this.accountsArray[this.USD_ACCOUNTS_KEY] = false;155 this.accountsArray[this.CREDIT_CARDS_KEY] = false;156 this.accountsArray[this.PAT_ACCOUNTS_KEY] = false;157 158 if (existenCuentasMXP) this.accountsArray[this.MXP_ACCOUNTS_KEY] = true;159 else if (existenCuentasUSD) this.accountsArray[this.USD_ACCOUNTS_KEY] = true;160 else if (existenCuentasTDC) this.accountsArray[this.CREDIT_CARDS_KEY] = true;161 else if (existenCuentasPat) this.accountsArray[this.PAT_ACCOUNTS_KEY] = true;162 163 this.updateAccounts();164 },165 166 showTipoCuenta: function(cuenta, tipo) {167 var amountTotal = 0.0;168 var contenedor_cuenta;169 var info_cantidad;170 var info_cuenta;171 172 var iFrame = document.getElementById('contentFrame');173 var contenido = iFrame.contentWindow.document || iFrame.contentDocument;174 175 if (tipo == "Cuentas en Pesos") {176 info_cantidad = contenido.getElementById("totalAmmountMXP");177 } else if (tipo == "Cuentas en D&oacutelares") {178 info_cantidad = contenido.getElementById("totalAmmountUSD");179 }180 181 if ((tipo != "Cuentas Patrimoniales") && (tipo != "Tarjeta de Cr&eacutedito")){182 183 for (var i in cuenta) {184 if (tipo == constants.TARJETA_CREDITO) { amountTotal = amountTotal + parseFloat(cuenta[i].saldofecha); }185 else { amountTotal = amountTotal + parseFloat(cuenta[i].saldo_disponible); }186 }187 188 info_cantidad.innerHTML = accounting.formatMoney(amountTotal, "$ ", 2, ",", ".");189 190 }191 },192 193 showCuentas: function(cuentas, article, checkbox) {194 var article_tipo = context.getElementById(article);195 var class_table = 'datos-tabla3';196 197 if (article == 'article-Credito') { class_table = 'datos-tabla4'; }198 if (this.numeroCuentas == 4) { article_tipo.setAttribute('class', 'xs-small'); }199 else if (this.numeroCuentas == 3) { article_tipo.setAttribute('class', 'small'); }200 else if (this.numeroCuentas == 2) { article_tipo.setAttribute('class', 'medium'); }201 else { article_tipo.setAttribute('class', 'large'); }202 203 if (cuentas.length > 0) {204 var tabla_cuenta;205 206 tabla_cuenta = context.createElement('table');207 tabla_cuenta.setAttribute('width', '100%');208 tabla_cuenta.setAttribute('cellpadding', '0');209 tabla_cuenta.setAttribute('cellspacing', '0');210 tabla_cuenta.setAttribute('class', class_table);211 212 for (var i in cuentas) {213 var alias = cuentas[i].alias;214 var cuenta = cuentas[i].numero;215 var idContrato = cuentas[i].id;216 var accountName = '';217 218 var tipo;219 if (article == 'article-Dolares') { tipo = cuentas[i].plaza; }220 else if (article == 'article-Patrimonial') { tipo = "&nbsp;"; }221 else { tipo = cuentas[i].tipo }222 switch (tipo) {223 case "AH": tipo = "Cuen/ Sin cheq"; break;224 case "CH": tipo = "Cuen/ Con cheq"; break;225 case "LI": tipo = "Libretón"; break;226 case "TC": tipo = "TDC"; break;227 default: tipo = tipo; break;228 }229 230 var saldo;231 if (article == 'article-Credito') { saldo = cuentas[i].saldofecha; }232 else { saldo = cuentas[i].saldo_disponible; }233 234 if (isNullOrUndefined(alias) || alias == '') {235 //accountName = maskAccountNumber(cuenta);236 accountName = cuenta.toString().substring(cuenta.length-10);237 }238 else {239 accountName = alias;240 }241 242 if (article != 'article-Patrimonial') {243 tabla_cuenta.innerHTML +=244 '<tr style="border-bottom:1px solid #E6E6E6">' +245 '<td>' + accountName + '</td>' +246 '<td>' + tipo + '</td>' +247 '<td>' + accounting.formatMoney(saldo, "$ ", 2, ",", ".") + '</td></tr>';248 } else {249 tabla_cuenta.innerHTML +=250 '<tr style="border-bottom:1px solid #E6E6E6">' +251 '<td>' + accountName + '</td>' +252 '<td>' + tipo + '</td>' +253 '<td class="saldo-patrimonial" data-idContrato="' + idContrato +'"></td></tr>';254 }255 256 article_tipo.appendChild(tabla_cuenta);257 }258 }259 },260 261 onlyOneChecked: function (checked) {262 if (this.numeroCuentas == 4) {263 context.getElementById('div-Pesos').checked = false;264 context.getElementById('div-Dolares').checked = false;265 context.getElementById('div-Credito').checked = false;266 context.getElementById('div-Patrimonial').checked = false;267 context.getElementById(checked).checked = true;268 }269 },270 selectAccountsTable: function (key) {271 if (1 === this.numeroCuentas) { return; }272 else if (2 === this.numeroCuentas) { this.accountsArray[key] = !this.accountsArray[key]; }273 else if (3 === this.numeroCuentas) {274 if (this.accountsArray[key]) { this.accountsArray[key] = !this.accountsArray[key]; }275 else {276 this.accountsArray[this.MXP_ACCOUNTS_KEY] = false;277 this.accountsArray[this.USD_ACCOUNTS_KEY] = false;278 this.accountsArray[this.CREDIT_CARDS_KEY] = false;279 this.accountsArray[key] = true;280 }281 } else if (4 == this.numeroCuentas) {282 if (this.accountsArray[key]) { this.accountsArray[key] = !this.accountsArray[key]; }283 else {284 this.accountsArray[this.MXP_ACCOUNTS_KEY] = false;285 this.accountsArray[this.USD_ACCOUNTS_KEY] = false;286 this.accountsArray[this.CREDIT_CARDS_KEY] = false;287 this.accountsArray[this.PAT_ACCOUNTS_KEY] = false;288 289 this.accountsArray[key] = true;290 }291 }292 this.updateAccounts();293 },294 updateAccounts: function() {295 this.updateAccountClasses(this.MXP_ACCOUNTS_KEY);296 this.updateAccountClasses(this.USD_ACCOUNTS_KEY);297 this.updateAccountClasses(this.CREDIT_CARDS_KEY);298 this.updateAccountClasses(this.PAT_ACCOUNTS_KEY);299 },300 updateAccountClasses: function (key) {301 var element = $('#' + key, context);302 303 var altura=0;304 305 306 307 element.removeClass('checked');308 309 if (this.accountsArray[key]) {310 311 element.addClass('checked');312 313 if (key=='mxpAccounts'){314 315 context.getElementById("cuentas-dolares").style.height="100%";316 context.getElementById("cuentas-credito").style.height="100%";317 context.getElementById("cuentas-patrimonial").style.height="100%";318 319 320 }else if (key=='usdAccounts'){321 322 context.getElementById("cuentas-pesos").style.height="100%";323 context.getElementById("cuentas-credito").style.height="100%";324 context.getElementById("cuentas-patrimonial").style.height="100%";325 326 } else if (key == 'patAccounts') {327 328 context.getElementById("cuentas-pesos").style.height="100%";329 context.getElementById("cuentas-credito").style.height="100%";330 context.getElementById("cuentas-dolares").style.height="100%";331 332 }else{333 334 context.getElementById("cuentas-pesos").style.height="100%";335 context.getElementById("cuentas-dolares").style.height="100%";336 context.getElementById("cuentas-patrimonial").style.height="100%";337 }338 339 this.accountsArray[this.MXP_ACCOUNTS_KEY] = false;340 this.accountsArray[this.USD_ACCOUNTS_KEY] = false;341 this.accountsArray[this.CREDIT_CARDS_KEY] = false;342 this.accountsArray[this.PAT_ACCOUNTS_KEY] = false;343 344 } else {345 346 347 if (key=='mxpAccounts'){348 context.getElementById("cuentas-pesos").style.height="100%";349 }350 351 if (key=='usdAccounts'){352 context.getElementById("cuentas-dolares").style.height="100%";353 }354 355 if (key=='creditCards'){356 context.getElementById("cuentas-credito").style.height="100%";357 }358 359 if (key=='patAccounts'){360 context.getElementById("cuentas-patrimonial").style.height="100%";361 362 }363 364 }365 366 },367 368 updatePosicionGlobal: function () {369 showLoadingLayer();370 exec(371 function (jsonResponse) { hideLoadingLayer(); posicionGlobalDelegate.savePosicionGlobal(jsonResponse); },372 function (errorMessage) { hideLoadingLayer(); posicionGlobalDelegate.savePosicionGlobal(errorMessage); },373 "PosicionGlobalDelegate",374 "updatePosicionGlobal",...

Full Screen

Full Screen

stock.js

Source:stock.js Github

copy

Full Screen

1/*2 * Licensed Materials - Property of IBM3 * 4 * 5724-U185 * 6 * (C) COPYRIGHT IBM CORP. 2007, 2011 All Rights Reserved.7 * 8 * US Government Users Restricted Rights - Use, duplication or9 * disclosure restricted by GSA ADP Schedule Contract with10 * IBM Corp.11 *12 */13dojo.provide("widgets.stock");14dojo.declare("stock",null,{15 constructor: function() {16 this.handlingFn = null;17 },18 onLoad: function () {19 console.log("test.onLoad ",this.iContext.getRootElement().getAttribute("id"));20 },21 onUnload: function() {22 console.log("test.onUnload", this.iContext.getRootElement() ? this.iContext.getRootElement().getAttribute("id") : "root element already gone");23 },24 handleAttributeChange:function(iEvent){25 console.log("handleAttributesChange");26 console.dir(iEvent);27 },28 handleIdescriptorChange:function(iEvent){29 console.log("handleIdescriptorChange");30 console.dir(iEvent);31 },32 updateQuote:function(iEvent){33 var data = iEvent.payload;34 if (typeof data == "undefined" || data == null) return;35 var company = data.company;36 if (typeof company == "undefined" || company == null) return;37 var element2 = this.iContext.getElementById("company");38 var temp = element2.innerHTML;39 if (temp == company) return;40 element2.innerHTML = company;41 var element = this.iContext.getElementById("stock");42 var oldQuote = parseInt(dojo.attr(element,'innerHTML'),10);43 if (oldQuote > 100) {44 element.innerHTML = "95";45 }46 else{47 element.innerHTML = "105";48 }49 },50 onNavStateChanged:function(iEvent){51// console.log("onNavStateChanged iEvent-->");52// console.dir(iEvent);53 },54 sendData:function(){55 56 var data = {};57 data.company = this.iContext.getElementById("company").innerHTML;58 data.stock = this.iContext.getElementById("stock").innerHTML;59 60 this.iContext.iEvents.fireEvent("sendStockData",null,data);61 62 //this.iContext.iEvents.fireEvent("onNavStateChanged",null, data); 63 64 var iDescriptor = this.iContext.getiDescriptor();65 if (typeof iDescriptor != undefined && iDescriptor != null) {66 console.debug("current mode is "+iDescriptor.getItemValue("mode"));67 }68 },69 broadcastData:function(){70 var data = {};71 data.company = this.iContext.getElementById("company").innerHTML;72 data.stock = this.iContext.getElementById("stock").innerHTML;73 //data.broker = this.iContext.getElementById("broker").innerHTML;74 //this.iContext.iEvents.fireEvent("sendStockData",null,data);75 76 var eventService = com.ibm.mashups.iwidget.services.ServiceManager.getService("eventService");77 eventService.broadcastEvent("Display Event Data",data); 78 79 },80 editBroker:function(){81 this.iContext.iEvents.fireEvent("onModeChanged",null, "{newMode:'edit'}");82 },83 switchBroker:function(){84 var element = this.iContext.getElementByClass("brokerSelection");85 element = element[0];86 var value = element.options[element.selectedIndex].value;87 88 var iDescriptor = this.iContext.getiDescriptor();89 if (typeof iDescriptor != undefined && iDescriptor != null) {90 console.debug("switch broker: current mode is "+iDescriptor.getItemValue("mode"));91 }92 93 var element1 = this.iContext.getElementByClass("companySelection")[0]; 94 var value1 = element1.options[element1.selectedIndex].value;95 var attributes = this.iContext.getiWidgetAttributes();96 attributes.setItemValue("broker",value);97 attributes.setItemValue("company",value1);98 attributes.save();99 this.iContext.iEvents.fireEvent("onModeChanged",null, "{newMode:'view'}"); 100 },101 setHandlingFn: function(fnc) {102 this.handlingFn = fnc;103 },104 handleCompanyChange:function(iEvent){105 var payload = iEvent.payload;106 var changes = payload.changes;107 for (var i in changes){108 var anItem = changes[i];109 var name = anItem.itemName;110 var type = anItem.type; //"newItem","updatedValue","removedItem"111 112 if (name == "companyid" && (type == "newItem" || type=="updatedValue"))113 {114 var element2 = this.iContext.getElementByClass("companyLabel")[0];115 element2.innerHTML = anItem.newVal;116 }117 if (name == "broker" && (type == "newItem" || type=="updatedValue")){118 var element3 =this.iContext.getElementById("broker");119 element3.innerHTML = anItem.newVal; 120 }121 }122 123 // delegate to a possible testing function124 if (this.handlingFn)125 this.handlingFn(iEvent);126 },127 onEditDone:function(){128 var elements = this.iContext.getElementByClass("companySelection");129 var element = elements[0];130 var value = element.options[element.selectedIndex].value;131 132 var itemSet = this.iContext.getShareableItemSet("companyinfo");133 itemSet.setItemValue("companyid",value); //"companyid is the local value"134 135 var element1 = this.iContext.getElementByClass("brokerSelection")[0];136 var value1 = element1.options[element1.selectedIndex].value;137 itemSet.setItemValue("broker",value1);138 itemSet.commit(); //commit the change so other widgets will be notified139 140 this.switchBroker();141 },142 onview:function(){143 var element = this.iContext.getElementById("stock");144 var attributesItemSet = this.iContext.getiWidgetAttributes();145 element.innerHTML = attributesItemSet.getItemValue("stock");146 var elements = this.iContext.getElementByClass("companyLabel");147 var element2 = elements[0];148 element2.innerHTML = attributesItemSet.getItemValue("company");149 var element3 =this.iContext.getElementById("broker");150 element3.innerHTML = attributesItemSet.getItemValue("broker"); 151 },152 onedit:function(){153 var element = this.iContext.getElementByClass("brokerSelection");154 var attributesItemSet = this.iContext.getiWidgetAttributes(); 155 var broker = attributesItemSet.getItemValue("broker");156 if (typeof broker == "undefined" || broker == null) return;157 element = element[0];158 for (var i=element.options.length-1; i >= 0;i--) {159 var value = element.options[i].value;160 if (value != null && value == broker) {161 element.options[i].selected = true;162 }163 }164 165 //test image Uri166 var imageUri = attributesItemSet.getItemValue("imageUri");167 var uri = this.iContext.io.rewriteURI(imageUri,false);168 console.debug("image uri:"+uri);169 170 }...

Full Screen

Full Screen

bella.js

Source:bella.js Github

copy

Full Screen

...9 "use strict";10 Drupal.behaviors.bellaThemeFixes = {11 attach: function (context) {12 // Use for the following navigation updates.13 var navbar = context.getElementById("navbar");14 var $navbar = $(".navbar", context);15 // // Set height of header for logo positioning.16 // var brand = navbar.querySelector(".navbar-header .navbar-brand");17 // var brandHeight = brand.offsetHeight;18 // // If the branding area is smaller than the navigation, vertically align the branding (name, logo).19 // if (brandHeight < navbarHeight) {20 // var regionHeight = navbar.querySelector(".region-navigation").offsetHeight;21 // brand.style.maxHeight = (regionHeight-10)+"px";22 // navbar.querySelector(".navbar-header").style.height = context.getElementById("navbar").offsetHeight+"px";23 // if (brand.classList) {24 // brand.classList.add("vertical-align");25 // } else {26 // brand.className += " " + "vertical-align";27 // }28 // }29 // Add extra pixels if we're logged in.30 if ($("body", context).hasClass("admin-menu")) {31 navbarHeight += 30;32 } else {33 navbarHeight += 1;34 }35 // Add padding to body if using fixed navbar.36 if (navbar.classList.contains("navbar-fixed-top")) {37 var navbarHeight = navbar.offsetHeight;38 var bodyHtml = context.querySelector("body.html");39 bodyHtml.style.paddingTop = navbarHeight + "px";40 // Update based on window resizing.41 $(window).resize(function () {42 navbarHeight = context.getElementById("navbar").offsetHeight;43 bodyHtml.style.paddingTop = navbarHeight + "px";44 });45 }46 }47 };48 /**49 * Responsive price table.50 */51 Drupal.behaviors.responsivePriceTable = {52 attach: function (context) {53 var $priceTable = $('.style-section-comparison-table', context);54 var $headers = $('header', $priceTable);55 var $info = $('.info', $priceTable);56 var $products = $('.products > .product', $priceTable);...

Full Screen

Full Screen

SeparateCodeMarkupAndBindings.js

Source:SeparateCodeMarkupAndBindings.js Github

copy

Full Screen

...114 Sys.Binding,115 {116 source: dataItem,117 path: "Name",118 target: context.getElementById('img'),119 targetProperty: "alt"120 }121 );122 $create(123 Sys.Binding,124 {125 source: dataItem,126 path: "Uri",127 target: context.getElementById('img'),128 targetProperty: "src"129 }130 );131 $create(132 Sys.Binding,133 {134 source: dataItem,135 path: "Name",136 target: context.getElementById('title'),137 targetProperty: "innerHTML"138 }139 );140 $create(141 Sys.Binding,142 {143 source: dataItem,144 path: "Name",145 target: context.getElementById('name'),146 targetProperty: "value"147 }148 );149 $create(150 Sys.Binding,151 {152 source: dataItem,153 path: "Description",154 target: context.getElementById('description'),155 targetProperty: "value"156 }157 );158 $create(159 Sys.Binding,160 {161 source: dataItem,162 path: "Contributor",163 target: context.getElementById('contributor'),164 targetProperty: "value"165 }166 );167 $create(168 Sys.Binding,169 {170 source: dataItem,171 path: "Uri",172 target: context.getElementById('uri'),173 targetProperty: "value"174 }175 );...

Full Screen

Full Screen

scratch-off-gallery.js

Source:scratch-off-gallery.js Github

copy

Full Screen

1/* eslint-disable */2import {ScratchCard, SCRATCH_TYPE} from 'scratchcard-js'3Drupal.behaviors.scratchOffGallery = {4 attach(context) {5 const scContainer1 = context.getElementById('js-canvas-1')6 const scContainer2 = context.getElementById('js-canvas-2')7 const scContainer3 = context.getElementById('js-canvas-3')8 const scContainer4 = context.getElementById('js-canvas-4')9 const scContainer5 = context.getElementById('js-canvas-5')10 const scContainer6 = context.getElementById('js-canvas-6')11 const sc1 = new ScratchCard('#js-canvas-1', {12 scratchType: SCRATCH_TYPE.CIRCLE,13 containerWidth: scContainer1.offsetWidth,14 containerHeight: 309,15 imageForwardSrc: 'https://source.unsplash.com/cPZ21gvclO8/500x400',16 imageBackgroundSrc: 'https://source.unsplash.com/n-vnWQmmVoY/500x400',17 clearZoneRadius: 50,18 nPoints: 30,19 pointSize: 4,20 callback: function() {21 console.log('done')22 },23 })24 const sc2 = new ScratchCard('#js-canvas-2', {...

Full Screen

Full Screen

textboxio-1.js

Source:textboxio-1.js Github

copy

Full Screen

...57 }58 };59 // Attach this editor to target element60 Drupal.wysiwyg.editor.attach.textboxio = function (context, params, settings) {61 var ta = context.getElementById(params.field);62 ta.style.display = "none";63 var div = context.createElement("div");64 var divIdName = 'tbio_id' + Date.now();65 div.setAttribute('id', divIdName);66 div.style.width = "100%";67 div.style.height = "400px";68 ta.detach_editor = function () {69 var e = textboxio.get("#" + divIdName);70 e[0].restore();71 $('#' + divIdName).remove();72 e[0] = null;73 };74 ta.parentElement.insertBefore(div, ta);75 var editor = textboxio.replace('#' + divIdName, defaultConfig);76 var contentToSet = (ta.value);77 editor.content.set(contentToSet);78 ta.get_editor = function () {79 return editor;80 };81 };82 /**83 * Detach a single or all editors.84 *85 * See Drupal.wysiwyg.editor.detach.none() for a full description of this hook.86 */87 Drupal.wysiwyg.editor.detach.textboxio = function (context, params, trigger) {88 //alert('detach');89 var ta = context.getElementById(params.field);90 var editor = ta.get_editor();91 ta.value = editor.content.get();92 ta.detach_editor();93 ta.style.display = "block";94 };95 Drupal.wysiwyg.editor.instance.textboxio = {96 insert: function (content) {97 //alert('Insert');98 var ta = context.getElementById(params.field);99 var editor = ta.get_editor();100 editor.content.insertHtmlAtCursor(content);101 },102 setContent: function (content) {103 //alert('Set Content');104 var ta = context.getElementById(params.field);105 var editor = ta.get_editor();106 editor.content.set(content);107 },108 getContent: function () {109 //alert('Get Content');110 var ta = context.getElementById(params.field);111 var editor = ta.get_editor();112 return editor.content.get();113 }114 };...

Full Screen

Full Screen

main-menu.js

Source:main-menu.js Github

copy

Full Screen

1Drupal.behaviors.mainMenu = {2 attach(context) {3 const toggleExpand = context.getElementById('toggle-expand');4 const menu = context.getElementById('main-nav');5 if (menu) {6 const expandMenu = menu.getElementsByClassName('expand-sub');7 // Mobile Menu Show/Hide.8 toggleExpand.addEventListener('click', (e) => {9 toggleExpand.classList.toggle('toggle-expand--open');10 menu.classList.toggle('main-nav--open');11 e.preventDefault();12 });13 // Expose mobile sub menu on click.14 for (let i = 0; i < expandMenu.length; i += 1) {15 expandMenu[i].addEventListener('click', (e) => {16 const menuItem = e.currentTarget;17 const subMenu = menuItem.nextElementSibling;18 menuItem.classList.toggle('expand-sub--open');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe("My First Test", function () {2 it("Visits the Kitchen Sink", function () {3 cy.contains("type").click();4 cy.url().should("include", "/commands/actions");5 cy.get(".action-email")6 .type("

Full Screen

Using AI Code Generation

copy

Full Screen

1const { context } = require('cypress/types/bluebird');2context('My First Test', () => {3 it('Does not do much!', () => {4 expect(true).to.equal(true)5 })6})7describe('My First Test', () => {8 it('Does not do much!', () => {9 expect(true).to.equal(true)10 })11})12{13 "env": {14 }15}16module.exports = (on, config) => {17}18import './commands'19Cypress.Commands.add('login', (username, password) => {20 cy.visit('/login')21 cy.get('input[name="username"]').type(username)22 cy.get('input[name="password"]').type(password)23 cy.get('button[type="submit"]').click()24})25describe('Login', () => {26 it('should login', () => {27 cy.login('admin', 'admin')28 cy.url().should('include', '/dashboard')29 })30})31describe('Dashboard', () => {32 beforeEach(() => {33 cy.login('admin', 'admin')34 })35 it('should show dashboard', () => {36 cy.url().should('include', '/dashboard')37 })38})39describe('User', () => {40 beforeEach(() => {

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('#myButton').click()2cy.get('button').click()3cy.get('button').click()4Cypress.Commands.add('getBySel', (selector, ...args) => {5 return cy.get(`[data-test=${selector}]`, ...args)6})7cy.getBySel('myButton').click()8cy.getBySel('myButton').click()9cy.getBySel('myButton').click()10Cypress.Commands.add('getBySelLike', (selector, ...args) => {11 return cy.get(`[data-test*=${selector}]`, ...args)12})13cy.getBySelLike('myButton').click()14cy.getBySelLike('myButton').click()15cy.getBySelLike('myButton').click()16Cypress.Commands.add('getBySelStrict', (selector, ...args) => {17 return cy.get(`[data-test^=${selector}][data-test$=${selector}]`, ...args)18})19cy.getBySelStrict('myButton').click()20cy.getBySelStrict('myButton').click()21cy.getBySelStrict('myButton').click()22Cypress.Commands.add('getBySelStartingWith', (selector, ...args) => {23 return cy.get(`[data-test^=${selector}]`, ...args)24})25cy.getBySelStartingWith('myButton').click()26cy.getBySelStartingWith('myButton').click()27cy.getBySelStartingWith('myButton').click()28Cypress.Commands.add('getBy

Full Screen

Using AI Code Generation

copy

Full Screen

1context('context', () => {2 it('context', () => {3 cy.get('#input').type('test')4 cy.get('#input').should('have.value', 'test')5 })6})7describe('It', () => {8 it('it', () => {9 cy.get('#input').type('test')10 cy.get('#input').should('have.value', 'test')11 })12})13Your name to display (optional):

Full Screen

Using AI Code Generation

copy

Full Screen

1it('Test', () => {2 cy.get('#myId')3})4it('Test', () => {5 cy.get('#myId')6})7it('Test', () => {8 cy.get('[id="myId"]')9})10it('Test', () => {11 cy.get('[id="myId"]')12})

Full Screen

Using AI Code Generation

copy

Full Screen

1context('Actions', () => {2 beforeEach(() => {3 })4 it('.type() - type into a DOM element', () => {5 cy.get('.action-email')6 .type('

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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