Best JavaScript code snippet using wpt
VariableSaveInputPanel.ts
Source:VariableSaveInputPanel.ts
...87 this.accStrainEnergyCB = new JCheckBox("Total Strain Energy");88 this.momentumCB = new JCheckBox("Momentum");89 this.totalMassCB = new JCheckBox("Mass");90 this.centerOfMassCB = new JCheckBox("Center of Mass");91 this.d_summedVar.addElement(this.kineticEnergyCB);92 this.d_summedVarStr.addElement(<string>new String("KineticEnergy"));93 this.d_summedVar.addElement(this.strainEnergyCB);94 this.d_summedVarStr.addElement(<string>new String("StrainEnergy"));95 this.d_summedVar.addElement(this.accStrainEnergyCB);96 this.d_summedVarStr.addElement(<string>new String("AccStrainEnergy"));97 this.d_summedVar.addElement(this.totalMassCB);98 this.d_summedVarStr.addElement(<string>new String("TotalMass"));99 this.d_summedVar.addElement(this.centerOfMassCB);100 this.d_summedVarStr.addElement(<string>new String("CenterOfMassPosition"));101 var numSummedVar : number = this.d_summedVar.size();102 for(var ii : number = 0; ii < numSummedVar; ++ii) {103 var checkBox : JCheckBox = this.d_summedVar.elementAt(ii);104 checkBox.setSelected(true);105 checkBox.addItemListener(this);106 this.d_summedVarState.addElement(<boolean>new Boolean(true));107 panel1.add(checkBox);108 }109 var label2 : JLabel = new JLabel("Particle Variables");110 panel2.add(label2);111 this.p_particleIDCB = new JCheckBox("Particle ID");112 this.p_positionCB = new JCheckBox("Position");113 this.p_massCB = new JCheckBox("Mass");114 this.p_volumeCB = new JCheckBox("Volume");115 this.p_temperatureCB = new JCheckBox("Temperature");116 this.p_deformationGradientCB = new JCheckBox("Def. Gradient");117 this.p_displacementCB = new JCheckBox("Displacement");118 this.p_velocityCB = new JCheckBox("Velocity");119 this.p_stressCB = new JCheckBox("Stress");120 this.p_externalForceCB = new JCheckBox("External Force");121 this.p_strainRateCB = new JCheckBox("Strain Rate");122 this.p_localizedCB = new JCheckBox("Failed Particles");123 this.p_damageCB = new JCheckBox("Damage");124 this.p_porosityCB = new JCheckBox("Porosity");125 this.p_plasticStrainCB = new JCheckBox("Plastic Strain");126 this.p_plasticStrainRateCB = new JCheckBox("Plastic Strain Rate");127 this.d_partVar.addElement(this.p_particleIDCB);128 this.d_partVarStr.addElement(<string>new String("p.particleID"));129 this.d_partVar.addElement(this.p_positionCB);130 this.d_partVarStr.addElement(<string>new String("p.x"));131 this.d_partVar.addElement(this.p_massCB);132 this.d_partVarStr.addElement(<string>new String("p.mass"));133 this.d_partVar.addElement(this.p_volumeCB);134 this.d_partVarStr.addElement(<string>new String("p.volume"));135 this.d_partVar.addElement(this.p_temperatureCB);136 this.d_partVarStr.addElement(<string>new String("p.temperature"));137 this.d_partVar.addElement(this.p_deformationGradientCB);138 this.d_partVarStr.addElement(<string>new String("p.deformationGradient"));139 this.d_partVar.addElement(this.p_displacementCB);140 this.d_partVarStr.addElement(<string>new String("p.displacement"));141 this.d_partVar.addElement(this.p_velocityCB);142 this.d_partVarStr.addElement(<string>new String("p.velocity"));143 this.d_partVar.addElement(this.p_stressCB);144 this.d_partVarStr.addElement(<string>new String("p.stress"));145 this.d_partVar.addElement(this.p_externalForceCB);146 this.d_partVarStr.addElement(<string>new String("p.externalforce"));147 this.d_partVar.addElement(this.p_strainRateCB);148 this.d_partVarStr.addElement(<string>new String("p.strainRate"));149 this.d_partVar.addElement(this.p_localizedCB);150 this.d_partVarStr.addElement(<string>new String("p.localized"));151 this.d_partVar.addElement(this.p_damageCB);152 this.d_partVarStr.addElement(<string>new String("p.damage"));153 this.d_partVar.addElement(this.p_porosityCB);154 this.d_partVarStr.addElement(<string>new String("p.porosity"));155 this.d_partVar.addElement(this.p_plasticStrainCB);156 this.d_partVarStr.addElement(<string>new String("p.plasticStrain"));157 this.d_partVar.addElement(this.p_plasticStrainRateCB);158 this.d_partVarStr.addElement(<string>new String("p.plasticStrainRate"));159 var numPartVar : number = this.d_partVar.size();160 for(var ii : number = 0; ii < numPartVar; ++ii) {161 var checkBox : JCheckBox = this.d_partVar.elementAt(ii);162 checkBox.setSelected(true);163 checkBox.addItemListener(this);164 this.d_partVarState.addElement(<boolean>new Boolean(true));165 panel2.add(checkBox);166 }167 this.p_strainRateCB.setSelected(false);168 this.p_localizedCB.setSelected(false);169 this.p_damageCB.setSelected(false);170 this.p_porosityCB.setSelected(false);171 this.p_plasticStrainCB.setSelected(false);172 this.p_plasticStrainRateCB.setSelected(false);173 var label3 : JLabel = new JLabel("Grid Variables");174 panel3.add(label3);175 this.g_massCB = new JCheckBox("Mass");176 this.g_volumeCB = new JCheckBox("Volume");177 this.g_velocityCB = new JCheckBox("Velocity");178 this.g_stressCB = new JCheckBox("Stress");179 this.g_accelerationCB = new JCheckBox("Acceleration");180 this.d_gridVar.addElement(this.g_massCB);181 this.d_gridVarStr.addElement(<string>new String("g.mass"));182 this.d_gridVar.addElement(this.g_volumeCB);183 this.d_gridVarStr.addElement(<string>new String("g.volume"));184 this.d_gridVar.addElement(this.g_velocityCB);185 this.d_gridVarStr.addElement(<string>new String("g.velocity"));186 this.d_gridVar.addElement(this.g_stressCB);187 this.d_gridVarStr.addElement(<string>new String("g.stressFS"));188 this.d_gridVar.addElement(this.g_accelerationCB);189 this.d_gridVarStr.addElement(<string>new String("g.acceleration"));190 var numGridVar : number = this.d_gridVar.size();191 for(var ii : number = 0; ii < numGridVar; ++ii) {192 var checkBox : JCheckBox = this.d_gridVar.elementAt(ii);193 checkBox.setSelected(true);194 checkBox.addItemListener(this);195 this.d_gridVarState.addElement(<boolean>new Boolean(true));196 panel3.add(checkBox);197 }198 var label4 : JLabel = new JLabel("Cell-Centered Variables");199 panel4.add(label4);200 this.cc_densityCB = new JCheckBox("Density");201 this.cc_temperatureCB = new JCheckBox("Temperature");202 this.cc_velocityCB = new JCheckBox("Velocity");203 this.cc_spVolumeCB = new JCheckBox("Specific Volume");204 this.cc_volFracCB = new JCheckBox("Volume Fraction");205 this.cc_pressureCB = new JCheckBox("Pressure");206 this.cc_equilPressureCB = new JCheckBox("Equilibriation Pressure");207 this.cc_intEnergyLCB = new JCheckBox("Internal Energy");208 this.cc_intEnergySourceCB = new JCheckBox("Internal Energy Source");209 this.cc_TdotCB = new JCheckBox("Temperature Rate");210 this.cc_momentumLCB = new JCheckBox("Momentum");211 this.cc_momentumSourceCB = new JCheckBox("Momentum Source");212 this.cc_delPDilatateCB = new JCheckBox("delP Dilatation");213 this.d_cellVar.addElement(this.cc_densityCB);214 this.d_cellVarStr.addElement(<string>new String("rho_CC"));215 this.d_cellVar.addElement(this.cc_temperatureCB);216 this.d_cellVarStr.addElement(<string>new String("temp_CC"));217 this.d_cellVar.addElement(this.cc_velocityCB);218 this.d_cellVarStr.addElement(<string>new String("vel_CC"));219 this.d_cellVar.addElement(this.cc_spVolumeCB);220 this.d_cellVarStr.addElement(<string>new String("sp_vol_CC"));221 this.d_cellVar.addElement(this.cc_volFracCB);222 this.d_cellVarStr.addElement(<string>new String("vol_frac_CC"));223 this.d_cellVar.addElement(this.cc_pressureCB);224 this.d_cellVarStr.addElement(<string>new String("press_CC"));225 this.d_cellVar.addElement(this.cc_equilPressureCB);226 this.d_cellVarStr.addElement(<string>new String("press_equil_CC"));227 this.d_cellVar.addElement(this.cc_intEnergyLCB);228 this.d_cellVarStr.addElement(<string>new String("int_eng_L_CC"));229 this.d_cellVar.addElement(this.cc_intEnergySourceCB);230 this.d_cellVarStr.addElement(<string>new String("intE_source_CC"));231 this.d_cellVar.addElement(this.cc_TdotCB);232 this.d_cellVarStr.addElement(<string>new String("Tdot"));233 this.d_cellVar.addElement(this.cc_momentumLCB);234 this.d_cellVarStr.addElement(<string>new String("mom_L_CC"));235 this.d_cellVar.addElement(this.cc_momentumSourceCB);236 this.d_cellVarStr.addElement(<string>new String("mom_source_CC"));237 this.d_cellVar.addElement(this.cc_delPDilatateCB);238 this.d_cellVarStr.addElement(<string>new String("delP_Dilatate"));239 var numCellVar : number = this.d_cellVar.size();240 for(var ii : number = 0; ii < numCellVar; ++ii) {241 var checkBox : JCheckBox = this.d_cellVar.elementAt(ii);242 checkBox.setSelected(true);243 checkBox.addItemListener(this);244 this.d_cellVarState.addElement(<boolean>new Boolean(true));245 panel4.add(checkBox);246 }247 var gb : GridBagLayout = new GridBagLayout();248 var gbc : GridBagConstraints = new GridBagConstraints();249 this.setLayout(gb);250 UintahGui.setConstraints(gbc, GridBagConstraints.BOTH, 1.0, 1.0, 0, 0, GridBagConstraints.REMAINDER, 1, 5);251 gb.setConstraints(panel0, gbc);252 this.add(panel0);253 UintahGui.setConstraints(gbc, GridBagConstraints.BOTH, 1.0, 1.0, 0, 1, 1, 1, 5);254 gb.setConstraints(panel1, gbc);255 this.add(panel1);256 UintahGui.setConstraints(gbc, GridBagConstraints.BOTH, 1.0, 1.0, 0, 2, 1, 1, 5);257 gb.setConstraints(panel2, gbc);258 this.add(panel2);...
newpractice-customer.js
Source:newpractice-customer.js
...18 19 20 21 /*if(itemObject.typeID!=15 && itemObject.typeID!=16){ //TITOLARE DEL CREDITO22 grp_hideout.addElement(hgrp_realCreditOwner);23 }*/24 25 switch(PRACTICE_PERSON_DAMAGE_TYPES_LIST[typeID]){26 case 'M': ///// MATERIALE27 /*tip_statusTypeID.text = '1';28 tip_typeID.text = itemObject.typeID.toString();29 lbl_statusTitle.text = 'STATO DANNO MATERIALE';30 lbl_insuranceStatusTitle.text = 'STATO DANNO MATERIALE (POLIZZA)';*/31 $("#lbl_insuranceTypeName").html('POLIZZA KASKO ' + PRACTICE_PERSON_TYPES_LIST[typeID]);32 33 /* grp_hideout.addElement(hgrp_coroner);34 grp_hideout.addElement(hgrp_insuranceCoroner);35 grp_hideout.addElement(hgrp_insuranceCustomerCoroner);36 grp_hideout.addElement(hgrp_insuranceInsuranceCoroner);37 grp_hideout.addElement(vgrp_specialists);38 grp_hideout.addElement(vgrp_specialistAdd);39 grp_hideout.addElement(hgrp_tribunal);40 grp_hideout.addElement(hgrp_judge);41 42 43 grp_hideout.addElement(tip_relationshipID);*/44 $("#gotAccidentInsuranceLabel").html("ha una polizza kasko")45 break;46 47 case 'P': ///// FISICO48 /*tip_statusTypeID.text = '2';49 lbl_statusTitle.text = 'STATO DANNO FISICO';50 lbl_insuranceStatusTitle.text = 'STATO DANNO FISICO (POLIZZA)';*/51 $("#lbl_insuranceTypeName").html('POLIZZA INFORT. ' + PRACTICE_PERSON_TYPES_LIST[typeID]);52 53 /* grp_hideout.addElement(hgrp_surveyor);54 grp_hideout.addElement(hgrp_bodywork);55 grp_hideout.addElement(hgrp_insuranceSurveyor);56 grp_hideout.addElement(hgrp_insuranceBodywork);57 grp_hideout.addElement(hgrp_tribunal);58 grp_hideout.addElement(hgrp_judge);59 60 grp_hideout.addElement(tip_relationshipID);*/61 $("#gotAccidentInsuranceLabel").html("ha una polizza infortuni")62 break;63 64 case 'D': ///// MORTALE65 /*tip_statusTypeID.text = '3';66 lbl_statusTitle.text = 'STATO DANNO MORTALE';67 lbl_insuranceStatusTitle.text = 'STATO DANNO MORTALE (POLIZZA)';*/68 $("#lbl_insuranceTypeName").html('POLIZZA INFORT. ' + PRACTICE_PERSON_TYPES_LIST[typeID]);69 70 /*grp_hideout.addElement(hgrp_surveyor);71 grp_hideout.addElement(hgrp_bodywork);72 grp_hideout.addElement(hgrp_insuranceSurveyor);73 grp_hideout.addElement(hgrp_insuranceBodywork);74 grp_hideout.addElement(hgrp_tribunal);75 grp_hideout.addElement(hgrp_judge);76 77 grp_hideout.addElement(tip_relationshipID);*/78 break;79 80 case 'DC': ///// MORTALE (CONGIUNTO)81 /*tip_statusTypeID.text = '3';82 lbl_statusTitle.text = 'STATO DANNO MORALE';83 84 btn_damageCount.enabled = false;85 86 grp_hideout.addElement(hgrp_surveyor);87 grp_hideout.addElement(hgrp_bodywork);88 grp_hideout.addElement(hgrp_insuranceSurveyor);89 grp_hideout.addElement(hgrp_insuranceBodywork);90 grp_hideout.addElement(hgrp_tribunal);91 grp_hideout.addElement(hgrp_judge);*/92 93 $("#hgrp_gotAccidentInsurance").hide();94 break;95 96 case 'CL': ///// CONSULENZA LEGALE97 /*tip_statusTypeID.text = '4';98 lbl_statusTitle.text = 'PROCEDIMENTO';99 100 btn_damageCount.enabled = false;101 102 grp_hideout.addElement(hgrp_insurancePoint);103 grp_hideout.addElement(hgrp_coroner);104 grp_hideout.addElement(hgrp_insuranceCoroner);105 grp_hideout.addElement(hgrp_liquidator);106 grp_hideout.addElement(hgrp_surveyor);107 grp_hideout.addElement(hgrp_bodywork);108 grp_hideout.addElement(vgrp_specialists);109 grp_hideout.addElement(vgrp_specialistAdd);110 111 112 grp_hideout.addElement(tip_relationshipID);*/113 $("#hgrp_gotAccidentInsurance").hide();114 break;115 116 case 'AB': ///// ECONOMICO117 /*tip_statusTypeID.text = '5';118 lbl_statusTitle.text = 'STATO DANNO ECONOMICO';119 120 btn_damageCount.enabled = false;121 122 grp_hideout.addElement(hgrp_insurancePoint);123 grp_hideout.addElement(hgrp_coroner);124 grp_hideout.addElement(hgrp_insuranceCoroner);125 grp_hideout.addElement(hgrp_liquidator);126 grp_hideout.addElement(hgrp_surveyor);127 grp_hideout.addElement(hgrp_bodywork);128 grp_hideout.addElement(vgrp_specialists);129 grp_hideout.addElement(vgrp_specialistAdd);130 131 132 grp_hideout.addElement(tip_relationshipID);*/133 $("#hgrp_gotAccidentInsurance").hide();134 break;135 136 default:137 /*itemObject.getFieldByName('statusTypeID').isNeeded = false;138 itemObject.getFieldByName('statusCategoryID').isNeeded = false;139 itemObject.getFieldByName('statusUpdateDate').isNeeded = false;*/140 141 142 /*grp_hideout.addElement(tip_relationshipID);143 grp_hideout.addElement(hgrp_documents);144 grp_hideout.addElement(vgrp_damageStatus);145 grp_hideout.addElement(vgrp_contacts);*/146 break;147 }148 149 /*if(PRACTICE_PERSON_PG_LIST[typeID] == 'G'){ //p. giuridica150 tip_customerID.dataProvider = archiveCompanies;151 tip_customerID.labelField = 'company_name';152 itemObject.getFieldByName('customerID').label = 'Rag. Sociale';153 }else {154 tip_customerID.dataProvider = archiveCustomers;155 tip_customerID.labelField = 'customer_name';156 itemObject.getFieldByName('customerID').label = 'Nome';157 }158 if(itemExists) itemObject.getFieldByName('customerID').setValue(tip_customerID,itemObject.startingValues.practiceCustomer_customerID);159 ...
6Async.js
Source:6Async.js
1'use strict';2// addElement("first")3// addElement("second")4// addElement("third")5// addElement("fourth")6// addElement("first promise")7// .then(function(){ return addElement("second promise")})8// .then(function(){ return addElement("third promise")})9// .then(function(){ return addElement("fourth promise")})10// addElement("first promise sexy syntax")11// .then(x => addElement("second promise syntax"))12// .then(x => addElement("third promise syntax"))13// .then(x => addElement("fourth promise syntax"))14async function myFunction(){15 await addElement("first async");16 await addElement("second async");17 await addElement("third async"); 18 await addElement("forth async"); 19};20myFunction();21function addElement(elementText){22 return new Promise(function(resolve,reject){23 setTimeout(function(){24 var element=document.createElement('H1');25 element.innerText = `${elementText} ${Date.now()}`;26 document.body.appendChild(element);27 resolve();28 }, Math.random() * 2000);29})}30// function addElement(elementText){31// setTimeout(function(){32// var element=document.createElement('H1');33// element.innerText = `${elementText} ${Date.now()}`;34// document.body.appendChild(element);35// }, Math.random() * 2000);...
Using AI Code Generation
1var tree = new wptree(1);2tree.addElement(2, 1);3tree.addElement(3, 1);4tree.addElement(4, 2);5tree.addElement(5, 2);6tree.addElement(6, 3);7tree.addElement(7, 3);8tree.addElement(8, 4);9tree.addElement(9, 4);10tree.addElement(10, 5);11tree.addElement(11, 6);12tree.addElement(12, 6);13tree.addElement(13, 8);14tree.addElement(14, 8);15tree.addElement(15, 8);16tree.addElement(16, 9);17tree.addElement(17, 9);18tree.addElement(18, 10);19tree.addElement(19, 11);20tree.addElement(20, 11);21tree.addElement(21, 12);22tree.addElement(22, 12);23tree.addElement(23, 13);24tree.addElement(24, 13);25tree.addElement(25, 14);26tree.addElement(26, 14);27tree.addElement(27, 15);28tree.addElement(28, 15);29tree.addElement(29, 16);30tree.addElement(30, 16);31tree.addElement(31, 17);32tree.addElement(32, 17);33tree.addElement(33, 18);34tree.addElement(34, 18);35tree.addElement(35, 19);36tree.addElement(36, 19);37tree.addElement(37, 20);38tree.addElement(38, 20);39tree.addElement(39, 21);40tree.addElement(40, 21);41tree.addElement(41, 22);42tree.addElement(42, 22);43tree.addElement(43, 23);44tree.addElement(44, 23);45tree.addElement(45, 24);46tree.addElement(46, 24);47tree.addElement(47, 25);48tree.addElement(48, 25);49tree.addElement(49, 26);50tree.addElement(50, 26);51tree.addElement(51, 27);52tree.addElement(52, 27);53tree.addElement(53, 28);54tree.addElement(54, 28);55tree.addElement(55, 29);56tree.addElement(56, 29);57tree.addElement(57, 30);58tree.addElement(58, 30);59tree.addElement(59, 31);60tree.addElement(60, 31);61tree.addElement(61, 32);62tree.addElement(62, 32
Using AI Code Generation
1var wpt = require('wpt.js');2var wptObject = new wpt('API_KEY');3var location = 'Dulles:Chrome';4var options = {5};6wptObject.runTest(url, options, function (err, data) {7 if (err) {8 console.log(err);9 } else {10 console.log('Test ID: ' + data.data.testId);11 console.log('Test status: ' + data.data.statusText);12 }13});14var wpt = require('wpt.js');15var wptObject = new wpt('API_KEY');16var testId = '150601_2Q_2d7d8e8c4a0d4b4d4e1a0a2b0e5e5a6d';17wptObject.getTestStatus(testId, function (err, data) {18 if (err) {19 console.log(err);20 } else {21 console.log('Test ID: ' + data.data.testId);22 console.log('Test status: ' + data.data.statusText);23 }24});25var wpt = require('wpt.js');26var wptObject = new wpt('API_KEY');27var testId = '150601_2Q_2d7d8e8c4a0d4b4d4e1a0a2b0e5e5a6d';28wptObject.getTestResults(testId, function (err, data) {29 if (err) {30 console.log(err);31 } else {32 console.log('Test ID: ' + data.data.testId);33 console.log('Test status: ' + data.data.statusText);34 console.log('First View: ' + data.data.average.firstView.loadTime);35 console.log('Repeat View: ' + data.data.average.repeatView.loadTime);36 }37});
Using AI Code Generation
1var addElement = require('./../wpt.js').addElement;2var wpt = require('./../wpt.js');3var assert = require('assert');4describe('addElement', function(){5 it('should add an element to the dom', function(){6 var test = addElement('p', 'Hello World');7 assert.equal(test, '<p>Hello World</p>');8 });9});10describe('wpt', function(){11 it('should be a function', function(){12 assert.equal(typeof wpt, 'function');13 });14 it('should return a string', function(){15 assert.equal(typeof wpt(), 'string');16 });17});18module.exports = {19};20module.exports = {21};22module.exports = {23};24module.exports = {25};26module.exports = {27};28module.exports = {29};30module.exports = {31};32module.exports = {33};34module.exports = {35};36module.exports = {37};
Using AI Code Generation
1var wpt = require('./wpt.js');2wpt.addElement('test', 'test');3### wpt.addElement(element, value)4### wpt.addArrayElement(element, value)5### wpt.addArrayElement(element, value)6### wpt.addArrayElement(element, value)7### wpt.getWpt()
Using AI Code Generation
1wpt.addElement('elementId', 'content');2wpt.addEvent('eventName', 'eventDetails');3wpt.addMetric('metricName', 'metricValue');4wpt.addStep('stepName', 'stepDetails');5wpt.addResult('resultName', 'resultValue');6wpt.addError('errorName', 'errorDetails');
Using AI Code Generation
1var wpt = require('./wpt.js');2wpt.addElement('test', 'test');3### wpt.addElement(element, value)4### wpt.addArrayElement(element, value)5### wpt.addArrayElement(element, value)6### wpt.addArrayElement(element, value)7### wpt.getWpt()
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!