Best JavaScript code snippet using wpt
typedarray-growablesharedarraybuffer.js
Source:typedarray-growablesharedarraybuffer.js
1// Copyright 2021 the V8 project authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4// Flags: --harmony-rab-gsab --allow-natives-syntax5"use strict";6class MyUint8Array extends Uint8Array {};7const ctors = [8 Uint8Array,9 Int8Array,10 Uint16Array,11 Int16Array,12 Int32Array,13 Float32Array,14 Float64Array,15 Uint8ClampedArray,16 BigUint64Array,17 BigInt64Array,18 MyUint8Array19];20(function TypedArrayPrototype() {21 const gsab = new GrowableSharedArrayBuffer(40, 80);22 const sab = new SharedArrayBuffer(80);23 for (let ctor of ctors) {24 const ta_gsab = new ctor(gsab, 0, 3);25 const ta_sab = new ctor(sab, 0, 3);26 assertEquals(ta_gsab.__proto__, ta_sab.__proto__);27 }28})();29(function TypedArrayLengthAndByteLength() {30 const gsab = new GrowableSharedArrayBuffer(40, 80);31 for (let ctor of ctors) {32 const ta = new ctor(gsab, 0, 3);33 assertEquals(gsab, ta.buffer);34 assertEquals(3, ta.length);35 assertEquals(3 * ctor.BYTES_PER_ELEMENT, ta.byteLength);36 const empty_ta = new ctor(gsab, 0, 0);37 assertEquals(gsab, empty_ta.buffer);38 assertEquals(0, empty_ta.length);39 assertEquals(0, empty_ta.byteLength);40 const ta_with_offset = new ctor(gsab, 2 * ctor.BYTES_PER_ELEMENT, 3);41 assertEquals(gsab, ta_with_offset.buffer);42 assertEquals(3, ta_with_offset.length);43 assertEquals(3 * ctor.BYTES_PER_ELEMENT, ta_with_offset.byteLength);44 const empty_ta_with_offset = new ctor(gsab, 2 * ctor.BYTES_PER_ELEMENT, 0);45 assertEquals(gsab, empty_ta_with_offset.buffer);46 assertEquals(0, empty_ta_with_offset.length);47 assertEquals(0, empty_ta_with_offset.byteLength);48 const length_tracking_ta = new ctor(gsab);49 assertEquals(gsab, length_tracking_ta.buffer);50 assertEquals(40 / ctor.BYTES_PER_ELEMENT, length_tracking_ta.length);51 assertEquals(40, length_tracking_ta.byteLength);52 const offset = 8;53 const length_tracking_ta_with_offset = new ctor(gsab, offset);54 assertEquals(gsab, length_tracking_ta_with_offset.buffer);55 assertEquals((40 - offset) / ctor.BYTES_PER_ELEMENT,56 length_tracking_ta_with_offset.length);57 assertEquals(40 - offset, length_tracking_ta_with_offset.byteLength);58 const length_tracking_ta_zero = new ctor(gsab, 40);59 assertEquals(gsab, length_tracking_ta_zero.buffer);60 assertEquals(0, length_tracking_ta_zero.length);61 assertEquals(0, length_tracking_ta_zero.byteLength);62 }63})();64(function ConstructInvalid() {65 const gsab = new GrowableSharedArrayBuffer(40, 80);66 for (let ctor of ctors) {67 // Length too big.68 assertThrows(() => { new ctor(gsab, 0, 40 / ctor.BYTES_PER_ELEMENT + 1); },69 RangeError);70 // Offset too close to the end.71 assertThrows(() => { new ctor(gsab, 40 - ctor.BYTES_PER_ELEMENT, 2); },72 RangeError);73 // Offset beyond end.74 assertThrows(() => { new ctor(gsab, 40, 1); }, RangeError);75 if (ctor.BYTES_PER_ELEMENT > 1) {76 // Offset not a multiple of ctor.BYTES_PER_ELEMENT.77 assertThrows(() => { new ctor(gsab, 1, 1); }, RangeError);78 assertThrows(() => { new ctor(gsab, 1); }, RangeError);79 }80 }81 // Verify the error messages.82 assertThrows(() => { new Int16Array(gsab, 1, 1); }, RangeError,83 /start offset of Int16Array should be a multiple of 2/);84 assertThrows(() => { new Int16Array(gsab, 38, 2); }, RangeError,85 /Invalid typed array length: 2/);86})();87(function TypedArrayLengthWhenGrown1() {88 const gsab = new GrowableSharedArrayBuffer(16, 40);89 // Create TAs which cover the bytes 0-7.90 let tas_and_lengths = [];91 for (let ctor of ctors) {92 const length = 8 / ctor.BYTES_PER_ELEMENT;93 tas_and_lengths.push([new ctor(gsab, 0, length), length]);94 }95 for (let [ta, length] of tas_and_lengths) {96 assertEquals(length, ta.length);97 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);98 }99 gsab.grow(20);100 for (let [ta, length] of tas_and_lengths) {101 assertEquals(length, ta.length);102 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);103 }104 gsab.grow(40);105 for (let [ta, length] of tas_and_lengths) {106 assertEquals(length, ta.length);107 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);108 }109})();110// The previous test with offsets.111(function TypedArrayLengthWhenGrown2() {112 const gsab = new GrowableSharedArrayBuffer(20, 40);113 // Create TAs which cover the bytes 8-15.114 let tas_and_lengths = [];115 for (let ctor of ctors) {116 const length = 8 / ctor.BYTES_PER_ELEMENT;117 tas_and_lengths.push([new ctor(gsab, 8, length), length]);118 }119 for (let [ta, length] of tas_and_lengths) {120 assertEquals(length, ta.length);121 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);122 }123 gsab.grow(20);124 for (let [ta, length] of tas_and_lengths) {125 assertEquals(length, ta.length);126 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);127 }128 gsab.grow(40);129 for (let [ta, length] of tas_and_lengths) {130 assertEquals(length, ta.length);131 assertEquals(length * ta.BYTES_PER_ELEMENT, ta.byteLength);132 }133})();134(function LengthTracking1() {135 const gsab = new GrowableSharedArrayBuffer(16, 40);136 let tas = [];137 for (let ctor of ctors) {138 tas.push(new ctor(gsab));139 }140 for (let ta of tas) {141 assertEquals(16 / ta.BYTES_PER_ELEMENT, ta.length);142 assertEquals(16, ta.byteLength);143 }144 gsab.grow(24);145 for (let ta of tas) {146 assertEquals(24 / ta.BYTES_PER_ELEMENT, ta.length);147 assertEquals(24, ta.byteLength);148 }149 // Grow to a number which is not a multiple of all byte_lengths.150 gsab.grow(26);151 for (let ta of tas) {152 const expected_length = Math.floor(26 / ta.BYTES_PER_ELEMENT);153 assertEquals(expected_length, ta.length);154 assertEquals(expected_length * ta.BYTES_PER_ELEMENT, ta.byteLength);155 }156 gsab.grow(40);157 for (let ta of tas) {158 assertEquals(40 / ta.BYTES_PER_ELEMENT, ta.length);159 assertEquals(40, ta.byteLength);160 }161})();162// The previous test with offsets.163(function LengthTracking2() {164 const gsab = new GrowableSharedArrayBuffer(16, 40);165 const offset = 8;166 let tas = [];167 for (let ctor of ctors) {168 tas.push(new ctor(gsab, offset));169 }170 for (let ta of tas) {171 assertEquals((16 - offset) / ta.BYTES_PER_ELEMENT, ta.length);172 assertEquals(16 - offset, ta.byteLength);173 }174 gsab.grow(24);175 for (let ta of tas) {176 assertEquals((24 - offset) / ta.BYTES_PER_ELEMENT, ta.length);177 assertEquals(24 - offset, ta.byteLength);178 }179 // Grow to a number which is not a multiple of all byte_lengths.180 gsab.grow(26);181 for (let ta of tas) {182 const expected_length = Math.floor((26 - offset)/ ta.BYTES_PER_ELEMENT);183 assertEquals(expected_length, ta.length);184 assertEquals(expected_length * ta.BYTES_PER_ELEMENT, ta.byteLength);185 }186 gsab.grow(40);187 for (let ta of tas) {188 assertEquals((40 - offset) / ta.BYTES_PER_ELEMENT, ta.length);189 assertEquals(40 - offset, ta.byteLength);190 }191})();192(function LoadWithFeedback() {193 function ReadElement2(ta) {194 return ta[2];195 }196 %EnsureFeedbackVectorForFunction(ReadElement2);197 const gsab = new GrowableSharedArrayBuffer(16, 40);198 const i8a = new Int8Array(gsab, 0, 4);199 for (let i = 0; i < 3; ++i) {200 assertEquals(0, ReadElement2(i8a));201 }202 // Within-bounds write203 for (let i = 0; i < 4; ++i) {204 i8a[i] = i;205 }206 // Within-bounds read207 for (let i = 0; i < 3; ++i) {208 assertEquals(2, ReadElement2(i8a));209 }210 gsab.grow(20);211 // Within-bounds read212 for (let i = 0; i < 3; ++i) {213 assertEquals(2, ReadElement2(i8a));214 }215 gsab.grow(40);216 // Within-bounds read217 for (let i = 0; i < 3; ++i) {218 assertEquals(2, ReadElement2(i8a));219 }220})();221(function LoadAndStoreWithFeedback() {222 function ReadElement(ta, i) {223 return ta[i];224 }225 function HasElement(ta, i) {226 return i in ta;227 }228 function WriteElement(ta, i, v) {229 ta[i] = v;230 }231 %EnsureFeedbackVectorForFunction(ReadElement);232 %EnsureFeedbackVectorForFunction(HasElement);233 %EnsureFeedbackVectorForFunction(WriteElement);234 const gsab = new GrowableSharedArrayBuffer(16, 40);235 const i8a = new Int8Array(gsab); // length-tracking236 assertEquals(16, i8a.length);237 // Within-bounds read238 for (let i = 0; i < i8a.length; ++i) {239 assertEquals(0, ReadElement(i8a, i));240 assertTrue(HasElement(i8a, i));241 }242 assertFalse(HasElement(i8a, 17));243 // Within-bounds write244 for (let i = 0; i < i8a.length; ++i) {245 WriteElement(i8a, i, i);246 }247 // Within-bounds read248 for (let i = 0; i < i8a.length; ++i) {249 assertEquals(i, ReadElement(i8a, i));250 }251 let old_length = i8a.length;252 gsab.grow(20);253 assertEquals(20, i8a.length);254 for (let i = 0; i < i8a.length; ++i) {255 if (i < old_length) {256 assertEquals(i, ReadElement(i8a, i));257 } else {258 assertEquals(0, ReadElement(i8a, i));259 }260 assertTrue(HasElement(i8a, i));261 }262 assertFalse(HasElement(i8a, 21));263 // Within-bounds write264 for (let i = 0; i < i8a.length; ++i) {265 WriteElement(i8a, i, i + 1);266 }267 // Within-bounds read268 for (let i = 0; i < i8a.length; ++i) {269 assertEquals(i + 1, ReadElement(i8a, i));270 }271})();272(function EnumerateElements() {273 let gsab = new GrowableSharedArrayBuffer(100, 200);274 for (let ctor of ctors) {275 const ta = new ctor(gsab, 0, 3);276 let keys = '';277 for (const key in ta) {278 keys += key;279 }280 assertEquals('012', keys);281 }...
controlFlowCaching.js
Source:controlFlowCaching.js
1//// [controlFlowCaching.ts]2// Repro for #84013function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {4 var isRtl = this._isRtl(); // chart mirroring5 // prepare variable6 var o = this.opt, ta = this.chart.theme.axis, position = o.position,7 leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,8 start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,9 labelGap = this.chart.theme.axis.tick.labelGap,10 taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),11 taTitleFont = o.titleFont || (ta.title && ta.title.font),12 taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",13 taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",14 taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,15 taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",16 taMajorTick = this.chart.theme.getTick("major", o),17 taMinorTick = this.chart.theme.getTick("minor", o),18 taMicroTick = this.chart.theme.getTick("micro", o),19 taStroke = "stroke" in o ? o.stroke : ta.stroke,20 size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,21 cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),22 sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),23 tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;24 if (rotation < 0) {25 rotation += 360;26 }27 var cachedLabelW = this._getMaxLabelSize();28 cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;29 titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,30 taMinorTick.length > 0 ? taMinorTick.length : 0) +31 tsize + taTitleGap;32 axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring33 switch (rotation) {34 default:35 if (rotation < (90 - centerAnchorLimit)) {36 labelOffset.y = leftBottom ? size : 0;37 } else if (rotation < (90 + centerAnchorLimit)) {38 labelOffset.x = -size * 0.4;39 } else if (rotation < 180) {40 labelOffset.y = leftBottom ? 0 : -size;41 } else if (rotation < (270 - centerAnchorLimit)) {42 labelOffset.y = leftBottom ? 0 : -size;43 } else if (rotation < (270 + centerAnchorLimit)) {44 labelOffset.y = leftBottom ? size * 0.4 : 0;45 } else {46 labelOffset.y = leftBottom ? size : 0;47 }48 }49 titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;50 titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);51 switch (labelAlign) {52 case "start":53 labelAlign = "end";54 break;55 case "end":56 labelAlign = "start";57 break;58 case "middle":59 labelOffset.y -= size;60 break;61 }62 let _ = rotation;63}646566//// [controlFlowCaching.js]67// Repro for #840168function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {69 var isRtl = this._isRtl(); // chart mirroring70 // prepare variable71 var o = this.opt, ta = this.chart.theme.axis, position = o.position, leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, labelGap = this.chart.theme.axis.tick.labelGap, taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), taTitleFont = o.titleFont || (ta.title && ta.title.font), taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", taMajorTick = this.chart.theme.getTick("major", o), taMinorTick = this.chart.theme.getTick("minor", o), taMicroTick = this.chart.theme.getTick("micro", o), taStroke = "stroke" in o ? o.stroke : ta.stroke, size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;72 if (rotation < 0) {73 rotation += 360;74 }75 var cachedLabelW = this._getMaxLabelSize();76 cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;77 titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) +78 tsize + taTitleGap;79 axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring80 switch (rotation) {81 default:82 if (rotation < (90 - centerAnchorLimit)) {83 labelOffset.y = leftBottom ? size : 0;84 }85 else if (rotation < (90 + centerAnchorLimit)) {86 labelOffset.x = -size * 0.4;87 }88 else if (rotation < 180) {89 labelOffset.y = leftBottom ? 0 : -size;90 }91 else if (rotation < (270 - centerAnchorLimit)) {92 labelOffset.y = leftBottom ? 0 : -size;93 }94 else if (rotation < (270 + centerAnchorLimit)) {95 labelOffset.y = leftBottom ? size * 0.4 : 0;96 }97 else {98 labelOffset.y = leftBottom ? size : 0;99 }100 }101 titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;102 titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);103 switch (labelAlign) {104 case "start":105 labelAlign = "end";106 break;107 case "end":108 labelAlign = "start";109 break;110 case "middle":111 labelOffset.y -= size;112 break;113 }114 var _ = rotation;
...
autosize.js
Source:autosize.js
1const set = (typeof Set === "function") ? new Set() : (function () {2 const list = [];3 return {4 has(key) {5 return Boolean(list.indexOf(key) > -1);6 },7 add(key) {8 list.push(key);9 },10 delete(key) {11 list.splice(list.indexOf(key), 1);12 },13 }14})();15let createEvent = (name)=> new Event(name);16try {17 new Event('test');18} catch(e) {19 // IE does not support `new Event()`20 createEvent = (name)=> {21 const evt = document.createEvent('Event');22 evt.initEvent(name, true, false);23 return evt;24 };25}26function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) {27 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;28 let heightOffset = null;29 let overflowY = null;30 let clientWidth = ta.clientWidth;31 function init() {32 const style = window.getComputedStyle(ta, null);33 overflowY = style.overflowY;34 if (style.resize === 'vertical') {35 ta.style.resize = 'none';36 } else if (style.resize === 'both') {37 ta.style.resize = 'horizontal';38 }39 if (style.boxSizing === 'content-box') {40 heightOffset = -(parseFloat(style.paddingTop)+parseFloat(style.paddingBottom));41 } else {42 heightOffset = parseFloat(style.borderTopWidth)+parseFloat(style.borderBottomWidth);43 }44 // Fix when a textarea is not on document body and heightOffset is Not a Number45 if (isNaN(heightOffset)) {46 heightOffset = 0;47 }48 update();49 }50 function changeOverflow(value) {51 {52 // Chrome/Safari-specific fix:53 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space54 // made available by removing the scrollbar. The following forces the necessary text reflow.55 const width = ta.style.width;56 ta.style.width = '0px';57 // Force reflow:58 /* jshint ignore:start */59 ta.offsetWidth;60 /* jshint ignore:end */61 ta.style.width = width;62 }63 overflowY = value;64 if (setOverflowY) {65 ta.style.overflowY = value;66 }67 resize();68 }69 function resize() {70 const htmlTop = window.pageYOffset;71 const bodyTop = document.body.scrollTop;72 const originalHeight = ta.style.height;73 ta.style.height = 'auto';74 let endHeight = ta.scrollHeight+heightOffset;75 if (ta.scrollHeight === 0) {76 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.77 ta.style.height = originalHeight;78 return;79 }80 ta.style.height = endHeight+'px';81 // used to check if an update is actually necessary on window.resize82 clientWidth = ta.clientWidth;83 // prevents scroll-position jumping84 document.documentElement.scrollTop = htmlTop;85 document.body.scrollTop = bodyTop;86 }87 function update() {88 const startHeight = ta.style.height;89 resize();90 const style = window.getComputedStyle(ta, null);91 if (style.height !== ta.style.height) {92 if (overflowY !== 'visible') {93 changeOverflow('visible');94 }95 } else {96 if (overflowY !== 'hidden') {97 changeOverflow('hidden');98 }99 }100 if (startHeight !== ta.style.height) {101 const evt = createEvent('autosize:resized');102 ta.dispatchEvent(evt);103 }104 }105 const pageResize = () => {106 if (ta.clientWidth !== clientWidth) {107 update();108 }109 };110 const destroy = style => {111 window.removeEventListener('resize', pageResize, false);112 ta.removeEventListener('input', update, false);113 ta.removeEventListener('keyup', update, false);114 ta.removeEventListener('autosize:destroy', destroy, false);115 ta.removeEventListener('autosize:update', update, false);116 set.delete(ta);117 Object.keys(style).forEach(key => {118 ta.style[key] = style[key];119 });120 }.bind(ta, {121 height: ta.style.height,122 resize: ta.style.resize,123 overflowY: ta.style.overflowY,124 overflowX: ta.style.overflowX,125 wordWrap: ta.style.wordWrap,126 });127 ta.addEventListener('autosize:destroy', destroy, false);128 // IE9 does not fire onpropertychange or oninput for deletions,129 // so binding to onkeyup to catch most of those events.130 // There is no way that I know of to detect something like 'cut' in IE9.131 if ('onpropertychange' in ta && 'oninput' in ta) {132 ta.addEventListener('keyup', update, false);133 }134 window.addEventListener('resize', pageResize, false);135 ta.addEventListener('input', update, false);136 ta.addEventListener('autosize:update', update, false);137 set.add(ta);138 if (setOverflowX) {139 ta.style.overflowX = 'hidden';140 ta.style.wordWrap = 'break-word';141 }142 init();143}144function destroy(ta) {145 if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;146 const evt = createEvent('autosize:destroy');147 ta.dispatchEvent(evt);148}149function update(ta) {150 if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return;151 const evt = createEvent('autosize:update');152 ta.dispatchEvent(evt);153}154let autosize = null;155// Do nothing in Node.js environment and IE8 (or lower)156if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {157 autosize = el => el;158 autosize.destroy = el => el;159 autosize.update = el => el;160} else {161 autosize = (el, options) => {162 if (el) {163 Array.prototype.forEach.call(el.length ? el : [el], x => assign(x, options));164 }165 return el;166 };167 autosize.destroy = el => {168 if (el) {169 Array.prototype.forEach.call(el.length ? el : [el], destroy);170 }171 return el;172 };173 autosize.update = el => {174 if (el) {175 Array.prototype.forEach.call(el.length ? el : [el], update);176 }177 return el;178 };179}...
main.js
Source:main.js
1require.config({2 baseUrl : Base.globvar.basePath + "ta/resource/external/plugin",3 paths : {4 // pluginï¼ta-api-all5 "api.datagrid" : "ta-api-all/api.datagrid",6 "api.fieldset" : "ta-api-all/api.fieldset",7 "api.forms" : "ta-api-all/api.forms",8 "api.panel" : "ta-api-all/api.panel",9 "api.print" : "ta-api-all/api.print",10 "api.selectinput" : "ta-api-all/api.selectinput",11 "api.taajax" : "ta-api-all/api.taajax",12 "api.tabs" : "ta-api-all/api.tabs",13 "api.tree" : "ta-api-all/api.tree",14 "api.window" : "ta-api-all/api.window",15 "api.listview" :"ta-api-all/api.listview",16 // pluginï¼ta-base-all17 "cookie" : "ta-base-all/cookie",18 "draggable" : "ta-base-all/draggable",19 "event.drag-2.2" : "ta-base-all/event.drag-2.2",20 "hotkeys" : "ta-base-all/hotkeys",21 "json-2.3" : "ta-base-all/json-2.3",22 "sortable" : "ta-base-all/sortable",23 "ta.jquery.ext" : "ta-base-all/ta.jquery.ext",24 // pluginï¼ta-bubblepopup-all25 "bubblepopup" : "ta-bubblepopup-all/bubblepopup.v2.3.1.min",26 // pluginï¼ta-contener-all27 "panel" : "ta-contener-all/panel",28 "query" : "ta-contener-all/query",29 "selectpanel" : "ta-contener-all/selectpanel",30 "tauipanel" : "ta-contener-all/tauipanel",31 "tauitabs" : "ta-contener-all/tauitabs",32 // pluginï¼ta-core-all33 "jquery" : "ta-core-all/jquery-1.11.0.min",34 "jquery-1.11.0.min.map" : "ta-core-all/jquery-1.11.0.min.map",35 "TaJsUtil" : "ta-core-all/TaJsUtil",36 "TaUIManager" : "ta-core-all/TaUIManager",37 "domReady" : "ta-core-all/domReady",38 // pluginï¼ta-datepicker-all39// "calendar" : "ta-datepicker-all/calendar",40// "lang" : "ta-datepicker-all/lang",41// "skin" : "ta-datepicker-all/skin",42 "WdatePicker" : "ta-datepicker-all/WdatePicker",43// "å¼åå
" : "ta-datepicker-all/å¼åå
",44 // pluginï¼ta-dialog-all45 "dialog" : "ta-dialog-all/dialog",46 "window" : "ta-dialog-all/window",47 "windowmessage" : "ta-dialog-all/windowmessage",48 // pluginï¼ta-echart-all49// "chart" : "ta-echart-all/chart",50// "echarts-all" : "ta-echart-all/echarts-all",51// "echarts" : "ta-echart-all/echarts",52 // pluginï¼ta-form-all53 "datetimeMask" : "ta-form-all/datetimeMask",54 "issue" : "ta-form-all/issue",55 "moneyInput" : "ta-form-all/moneyInput",56 "numberBox" : "ta-form-all/numberBox",57 "numberSpinner" : "ta-form-all/numberSpinner",58 "selectGrid" : "ta-form-all/selectGrid",59 "selectGrid_temp" : "ta-form-all/selectGrid_temp",60 "selectInput" : "ta-form-all/selectInput",61 "selectTree" : "ta-form-all/selectTree",62 "uploadify" : "ta-form-all/uploadify",63 "upload" : "ta-form-all/upload",64 "ajaxfileupload" : "ta-form-all/ajaxfileupload",65 // pluginï¼ta-grid-all66 "grid.base" : "ta-grid-all/grid.base",67 "grid.checkbox" : "ta-grid-all/grid.checkbox",68 "grid.core" : "ta-grid-all/grid.core",69 "grid.dataview" : "ta-grid-all/grid.dataview",70 "grid.editors" : "ta-grid-all/grid.editors",71 "grid.group" : "ta-grid-all/grid.group",72 "grid.pager" : "ta-grid-all/grid.pager",73 "grid.pager.expdata" : "ta-grid-all/grid.pager.exportdata",74 "grid.pager.impdata" : "ta-grid-all/grid.pager.importdata",75 "grid.radioselect" : "ta-grid-all/grid.radioselect",76 "grid.rowselect" : "ta-grid-all/grid.rowselect",77 // pluginï¼ta-layout-all78 "autoPercentHeight" : "ta-layout-all/autoPercentHeight",79 "border" : "ta-layout-all/border",80 "fit" : "ta-layout-all/fit",81 "resizable" : "ta-layout-all/resizable",82 "taLayout" : "ta-layout-all/taLayout",83 // pluginï¼ta-menu-all84 "menu" : "ta-menu-all/menu",85 "tamenu" : "ta-menu-all/tamenu",86 // pluginï¼ta-other87 "jquery-2.0.3.min" : "ta-other/jquery-2.0.3.min",88 "scrollable" : "ta-other/jquery.scrollable.1.2.5",89 "listView":"ta-other/jquery.listview",90 91 // pluginï¼ta-password-all92 "passwordCheck" : "ta-password-all/passwordCheck",93 // pluginï¼ta-softkeyboard-all94 "softkeyboard" : "ta-softkeyboard-all/softkeyboard",95 // pluginï¼ta-tools-all96 "GB2312" : "ta-tools-all/GB2312",97 "hint-tip": "ta-tools-all/hint-tip",98 "webPrint": "ta-tools-all/webPrint",99 // pluginï¼ta-tree-all100 "ztree.core.min" : "ta-tree-all/ztree.core.min",101 "ztree.excheck.min" : "ta-tree-all/ztree.excheck.min",102 "ztree.exedit" : "ta-tree-all/ztree.exedit",103 "ztree.exhide.min" : "ta-tree-all/ztree.exhide.min",104 // pluginï¼ta-validate-all105 "validateBox" : "ta-validate-all/validateBox"106 107 }...
Using AI Code Generation
1var webdriver = require('selenium-webdriver'),2 until = webdriver.until;3var driver = new webdriver.Builder()4 .forBrowser('chrome')5 .build();6driver.findElement(By.name('q')).sendKeys('webdriver');7driver.findElement(By.name('btnG')).click();8driver.wait(until.titleIs('webdriver - Google Search'), 1000);9driver.quit();
Using AI Code Generation
1var wpt = require('webpagetest');2var test = new wpt('www.webpagetest.org');3var options = {4};5test.runTest(options, function(err, data) {6 if (err) return console.error(err);7 console.log(data);8});9var wpt = require('webpagetest');10var test = new wpt('www.webpagetest.org');11var options = {12};13test.runTest(options, function(err, data) {14 if (err) return console.error(err);15 console.log(data);16});17 at errnoException (net.js:901:11)18 at Object.afterConnect [as oncomplete] (net.js:892:19)
Using AI Code Generation
1var wpt = require('webpagetest');2var client = wpt('www.webpagetest.org');3client.getLocations(function(err, data) {4 console.log(data);5});6 console.log(data);7});8 console.log(data);9});10 console.log(data);11});12client.getTesters(function(err, data) {13 console.log(data);14});15client.getTesters('ec2-us-west-1', function(err, data) {16 console.log(data);17});18client.getTesters('ec2-us-west-1', 'ec2', function(err, data) {19 console.log(data);20});21client.getTesters('ec2-us-west-1', 'ec2', 'Linux', function(err, data) {22 console.log(data);23});24client.getTesters('ec2-us-west-1', 'ec2', 'Linux', 'Firefox', function(err, data) {25 console.log(data);26});27client.getTesters('ec2-us-west-1', 'ec2', 'Linux', 'Firefox', '3.6', function(err, data) {28 console.log(data);29});30client.getTesters('ec2-us-west-1', 'ec2', 'Linux', 'Firefox', '3.6', '3.6', function(err, data) {31 console.log(data);32});33client.getTesters('ec2-us-west-1', 'ec2', 'Linux', 'Firefox', '3.6', '3.6', 'mobile', function(err, data) {34 console.log(data);35});36client.getTesters('ec2-us-west-
Using AI Code Generation
1var wpt = require('wpt');2wpt.ta('some text', function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10wpt.ta('some text', 'some other text', function(err, data) {11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18wpt.ta('some text', 'some other text', 'some more text', function(err, data) {19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var wpt = require('wpt');26wpt.ta('some text', 'some other text', 'some more text', 'some more text', function(err, data) {27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var wpt = require('wpt');34wpt.ta('some text', 'some other text', 'some more text', 'some more text', 'some more text', function(err, data) {35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var wpt = require('wpt');42wpt.ta('some text', 'some other text', 'some more text', 'some more text', 'some more text', 'some more text', function(err, data) {43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var wpt = require('wpt');50wpt.ta('some text', 'some other text', 'some more text', 'some more text', 'some more text', 'some more text', 'some more text', function(err, data) {51 if (err) {52 console.log(err);53 } else {54 console.log(data);55 }56});
Using AI Code Generation
1var wpt = require('wpt');2var ta = new wpt.ta('API_KEY');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10var test = new wpt.test('API_KEY');11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18var test = new wpt.test('API_KEY');19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var wpt = require('wpt');26var test = new wpt.test('API_KEY');27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var wpt = require('wpt');34var test = new wpt.test('API_KEY');35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var wpt = require('wpt');42var test = new wpt.test('API_KEY');43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var wpt = require('wpt');50var test = new wpt.test('API_KEY');
Using AI Code Generation
1var wpt = require('./wpt.js');2var wpt = new wpt();3wpt.ta();4var wpt = function() {5 this.ta = function() {6 }7}8module.exports = wpt;
Using AI Code Generation
1var wpt = require('./webpagetest.js');2var api = new wpt('www.webpagetest.org', 'A.5d6d7e8f9g0h1i2j3k4l5m6n7o8p9q0r1s2t3u4v5w6x7y8z9');3 console.log(data);4});5api.getTestResults('140121_5A_1P', function(err, data) {6 console.log(data);7});8api.getLocations(function(err, data) {9 console.log(data);10});11api.getTesters(function(err, data) {12 console.log(data);13});14api.getTestStatus('140121_5A_1P', function(err, data) {15 console.log(data);16});17api.getTestInfo('140121_5A_1P', function(err, data) {18 console.log(data);19});20api.getLocations(function(err, data) {21 console.log(data);22});23api.getTesters(function(err, data) {24 console.log(data);25});26api.getTestStatus('140121_5A_1P', function(err, data) {27 console.log(data);28});29api.getTestInfo('140121_5A_1P', function(err, data) {30 console.log(data);31});32api.getTestResults('140121_5A_1P', function(err, data) {33 console.log(data);34});35api.getLocations(function(err, data) {36 console.log(data);37});38api.getTesters(function(err, data) {39 console.log(data);40});41api.getTestStatus('140121_5A_1P', function(err, data) {42 console.log(data);43});44api.getTestInfo('140121_5A_1P', function(err, data) {45 console.log(data);46});47api.getTestResults('140121_5A_1P', function(err, data) {48 console.log(data);49});50api.getLocations(function(err, data) {51 console.log(data);52});53api.getTesters(function(err, data) {54 console.log(data);55});56api.getTestStatus('140121_5A_1P', function(err, data) {57 console.log(data);58});
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!!