Best JavaScript code snippet using wpt
table.action.js
Source:table.action.js
1/**2 * Created with JetBrains PhpStorm.3 * User: taoqili4 * Date: 13-2-255 * Time: ä¸å4:406 * To change this template use File | Settings | File Templates.7 */89//test('', function () {10// stop()11//});12test('æ¡é', function () {13 var editor = te.obj[0];14 var range = te.obj[1];1516 editor.setContent('<p></p>');17 setTimeout(function () {18 range.setStart(editor.body.firstChild, 0).collapse(true).select();19 editor.execCommand('inserttable', {numCols: 3, numRows: 3});20 var tds = editor.body.getElementsByTagName('td');21 ua.mousedown(tds[0]);22 ua.mouseover(tds[4]);23 ua.mouseup(tds[4]);24 setTimeout(function () {25 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;26 var tds = editor.body.getElementsByTagName('td');27 equal(selectedTds.length, 4, 'æ¡é');28 if ( ua.browser.ie >8 && ua.browser.ie<11)29 ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 1, 1, true, 'æ£æ¥éä¸çrange')30 else31 ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 0, true, 'æ£æ¥éä¸çrange');32 range.setStart(tds[4], 0).collapse(true).select();33 ua.mousedown(tds[4], {button: 2});34 setTimeout(function () {35 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;36 var tds = editor.body.getElementsByTagName('td');37 equal(selectedTds.length, 4, 'å³é®æ¡éä¸å');38 if ( ua.browser.ie >8 && ua.browser.ie<11)39 ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 1, 1, true, 'æ£æ¥éä¸çrange')40 else41 ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 0, true, 'æ£æ¥éä¸çrange');42 start();43 }, 50);44 }, 50);45 }, 80);46 stop();47});4849test('tableDragable-æ¾ç¤ºåæ¶å¤±', function () {50 if (browser.ie && browser.version < 8) return;51 var div = document.body.appendChild(document.createElement('div'));52 div.id = 'ue';53 var editor = UE.getEditor('ue', {tableDragable: true});54 editor.ready(function () {55 var range = new baidu.editor.dom.Range(editor.document);56 editor.setContent('<p></p>');57 setTimeout(function () {58 range.setStart(editor.body.firstChild, 0).collapse(true).select();59 editor.execCommand('inserttable', {numCols: 3, numRows: 3});60 var tds = editor.body.getElementsByTagName('td');61 ua.mousemove(editor.body.firstChild);62 var pos = domUtils.getXY(editor.body.firstChild);63 var select = ua.browser.webkit ? '-webkit-user-select: none;' : ua.browser.gecko ? '-moz-user-select: none;' : ua.browser.ie >8?'-ms-user-select: none':'';//-ms-user-select: none64 var html = '<div contenteditable=\"false\" style=\"width:15px;height:15px;background-image:url(' + editor.options.UEDITOR_HOME_URL + 'dialogs/table/dragicon.png);position: absolute;cursor:move;top:' + (pos.y - 15) + 'px;left:' + pos.x + 'px; ' + select + '\"' + (ua.browser.ie && ua.browser.ie<9 ? 'unselectable=\"on\"' : '') + '></div>';65 setTimeout(function () {66 var button = editor.body.lastChild;67 ua.checkSameHtml(button.outerHTML.replace('"', ''), html, 'DragButtonæ¾ç¤º');68 ua.mouseout(button);69 ua.mousemove(editor.body);70 setTimeout(function () {71 equal(editor.body.getElementsByTagName('div').length, 0, 'æé®æ²¡æäº');72 UE.delEditor('ue');73 te.dom.push(document.getElementById('ue'));74 te.dom.push(document.getElementById('edui_fixedlayer'));75 start();76 }, 2100);77 }, 20);78 }, 50);79 });80 stop();81});82test('tableDragable-åå»', function () {//tableClicked83 if (browser.ie && browser.version < 8) return;84 var div = document.body.appendChild(document.createElement('div'));85 div.id = 'ue';86 var editor = UE.getEditor('ue', {tableDragable: true});87 expect(1);88 editor.ready(function () {89 var range = new baidu.editor.dom.Range(editor.document);90 editor.setContent('<p></p>');91 setTimeout(function () {92 range.setStart(editor.body.firstChild, 0).collapse(true).select();93 editor.execCommand('inserttable', {numCols: 3, numRows: 3});94 var tds = editor.body.getElementsByTagName('td');95 ua.mousemove(editor.body.firstChild);96 setTimeout(function () {97 var button = editor.body.lastChild;98 editor.addListener("tableClicked", function (type, table, buttonOn) {99 same(table, editor.body.getElementsByTagName('table')[0], 'tableClickedäºä»¶,ä¼ å
¥çåæ°æ£ç¡®');100 setTimeout(function () {101 UE.delEditor('ue');102 te.dom.push(document.getElementById('ue'));103 te.dom.push(document.getElementById('edui_fixedlayer'));104 start();105 }, 500);106 });107 ua.click(button);108 }, 20);109 }, 50);110 });111 stop();112});113test('tableDragable-åå»', function () {//tableClicked114 if (browser.ie && browser.version < 8) return;115 var div = document.body.appendChild(document.createElement('div'));116 div.id = 'ue';117 var editor = UE.getEditor('ue', {tableDragable: true});118 editor.ready(function () {119 var range = new baidu.editor.dom.Range(editor.document);120 editor.setContent('<p></p>');121 setTimeout(function () {122 range.setStart(editor.body.firstChild, 0).collapse(true).select();123 editor.execCommand('inserttable', {numCols: 3, numRows: 3});124 var tds = editor.body.getElementsByTagName('td');125 ua.mousemove(editor.body.firstChild);126 setTimeout(function () {127 var button = editor.body.lastChild;128 ua.dblclick(button);129 setTimeout(function () {130 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;131 var tds = editor.body.getElementsByTagName('td');132 equal(selectedTds.length, 9, 'å
¨é');133 if (ua.browser.ie > 8 && ua.browser.ie<11)134 ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 1, 1, true, 'æ£æ¥éä¸çrange');135 else136 ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 0, true, 'æ£æ¥éä¸çrange');137 setTimeout(function () {138 UE.delEditor('ue');139 te.dom.push(document.getElementById('ue'));140 te.dom.push(document.getElementById('edui_fixedlayer'));141 start();142 }, 500);143 }, 100);144 }, 100);145 }, 100);146 });147 stop();148});149test('ä»å¤é¢ç²è´´è¡¨æ ¼', function () {150 var editor = te.obj[0];151 var range = te.obj[1];152 editor.setContent('<p></p>');153154 range.setStart(editor.body.firstChild, 0).collapse(true).select();155 var html = {html: '<table style="width:992px"><tbody><tr><td style="border-color: rgb(247, 150, 70);width:198px" >hello1</td><td style="background-color: rgb(255, 0, 0); border-color: rgb(247, 150, 70);width:198px" ></td></tr><tr><td >hello2</td><td ></td></tr></tbody></table><p>hello2</p>'};156 editor.fireEvent('beforepaste', html);157 //**//*ç²è´´*//**//*158 stop();159 setTimeout(function () {160 var space = ua.browser.ie ? '' : '<br/>';161 var border = (ua.browser.ie && ua.browser.ie < 9) ? 'border-bottom-color: rgb(247,150,70); border-top-color: rgb(247,150,70); border-right-color: rgb(247,150,70); border-left-color: rgb(247,150,70)' : 'border-color: rgb(247, 150, 70)';162 var resultHtml = '<table width="992"><tbody><tr><td style="' + border + ';" width="198">hello1</td><td style="background-color: rgb(255, 0, 0); ' + border + ';" width="198">' + space + '</td></tr><tr><td>hello2</td><td>' + space + '</td></tr></tbody></table><p>hello2</p>';163 ua.checkSameHtml(html.html.toLowerCase(), resultHtml.toLowerCase(), 'ç²è´´çè¡¨æ ¼è§èæ ¼å¼');164 start();165 }, 50);166});167test('ä»å¤é¢ç²è´´è¡¨æ ¼å°è¡¨æ ¼-è¡¨æ ¼ä¸ä¸è½ç²å®æ´çè¡¨æ ¼', function () {168 var editor = te.obj[0];169 var range = te.obj[1];170 editor.setContent('');171 editor.execCommand('inserttable', {numCols: 3, numRows: 3});172 //**//*æå
¥è¡¨æ ¼*//**//*173 var tds = editor.body.getElementsByTagName('td');174 range.setStart(tds[0], 0).collapse(true).select();175 var html = {html: '<table><tbody><tr><td>hello1</td><td ></td></tr><tr><td >hello2</td><td ></td></tr></tbody></table><p>hello2</p>'};176 editor.fireEvent('beforepaste', html);177 //**//*ç²è´´*//**//*178 stop();179 setTimeout(function () {180 equal(html.html, '<p>hello2</p>', 'è¡¨æ ¼ä¸ä¸è½ç²å®æ´çè¡¨æ ¼');181 start();182 }, 50);183});184test(' trace 3729 ä»å¤é¢ç²è´´è¡¨æ ¼å°è¡¨æ ¼-å¨captionä¸ç²è´´,åªç²è´´ææ¬å
容', function () {185 var editor = te.obj[0];186 var range = te.obj[1];187 editor.setContent('');188 editor.execCommand('inserttable', {numCols: 3, numRows: 3});189 //**//*æå
¥è¡¨æ ¼*//**//*190 var tds = editor.body.getElementsByTagName('td');191 range.setStart(tds[0], 0).collapse(true).select();192 editor.execCommand('insertcaption');193 range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();194 var html = {html: '<table><tbody><tr><td>hello1</td><td ></td></tr></tbody></table>'};195 editor.fireEvent('beforepaste', html);196 //**//*ç²è´´*//**//*197 stop();198 setTimeout(function () {199 //todo ie9 ä½¿ç¨ div[browser.ie ? 'innerText' : 'textContent'] ä¼å¤ä¸ä¸ªæ¢è¡,ç¨textContent没æ trace 3729200 equal(html.html, 'hello1', 'å¨captionä¸ç²è´´,åªç²è´´ææ¬å
容');201 start();202 }, 50);203});204test('getText,åè¡¨æ ¼å
çææ¬', function () {205 var editor = te.obj[0];206 var range = te.obj[1];207 editor.setContent('<table><tbody><tr><td> hello1</td><td ></td></tr><tr><td >hello2</td><td ></td></tr></tbody></table>');208 stop();209 setTimeout(function () {210 var trs = editor.body.firstChild.getElementsByTagName('tr');211 range.setStart(trs[0].cells[0],0).collapse(true).select();212 var ut = editor.getUETable(editor.body.firstChild);213 var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[1].cells[0]);214 ut.setSelected(cellsRange);215 setTimeout(function () {216 ua.manualDeleteFillData(editor.body);217 equal(editor.selection.getText(), 'hello1hello2');218 start();219 }, 50);220 }, 50);221});222test('å¨ç¬¬ä¸ä¸ªåå
æ ¼éæåé¢å车,ä¸è¡¨æ ¼åé¢æ²¡æå
容', function () {223 var editor = te.obj[0];224 var range = te.obj[1];225 editor.setContent('<p></p>');226 range.setStart(editor.body.firstChild, 0).collapse(true).select();227 editor.execCommand('inserttable', {numCols: 3, numRows: 3});228229 var trs = editor.body.firstChild.getElementsByTagName('tr');230231 var ut = editor.getUETable(editor.body.firstChild);232 var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[1].cells[0]);233 ut.setSelected(cellsRange);234 range.setStart(trs[0].cells[0], 0).collapse(true).select();235 ua.keydown(editor.body, {'keyCode': 13});236 stop();237 setTimeout(function () {238 ua.manualDeleteFillData(editor.body);239 equal(editor.body.firstChild.innerHTML, ua.browser.ie ? ' ' : '<br>', 'è¡¨æ ¼åæå
¥ç©ºè¡');240 equal(editor.body.firstChild.tagName.toLowerCase(), 'p', 'è¡¨æ ¼åæå
¥ç©ºè¡');241 equal(editor.body.childNodes[1].tagName.toLowerCase(), 'table', 'è¡¨æ ¼å¨ç©ºè¡åé¢');242 start();243 }, 50);244});245test('delete äºä»¶', function () {246 var editor = te.obj[0];247 var range = te.obj[1];248 editor.setContent('<p></p>');249 range.setStart(editor.body.firstChild, 0).collapse(true).select();250 editor.execCommand('inserttable', {numCols: 3, numRows: 3});251 expect(4);252 editor.addListener('saveScene', function () {253 ok(true);254 });255 var trs = editor.body.firstChild.getElementsByTagName('tr');256 trs[0].cells[0].innerHTML = 'hello';257 trs[1].cells[0].innerHTML = 'hello';258 var ut = editor.getUETable(editor.body.firstChild);259 var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[1].cells[0]);260 ut.setSelected(cellsRange);261 range.setStart(trs[0].cells[0], 0).collapse(true).select();262 ua.keydown(editor.body, {'keyCode': 46});263 stop();264 setTimeout(function () {265 ua.manualDeleteFillData(editor.body);266 trs = editor.body.firstChild.getElementsByTagName('tr');267 equal(trs[0].cells[0].innerHTML, ua.browser.ie ? '' : '<br>', 'å
容');268 equal(trs[1].cells[0].innerHTML, ua.browser.ie ? '' : '<br>', 'å
容');269 start();270 }, 20);271});272//**//*trace 3047,3545*//**//*273test('trace 3047 ,3545 å
¨å±æå
¥è¡¨æ ¼', function () {274 if (ua.browser.gecko)return;//TODO 1.2.6275 if (ua.browser.ie && ua.browser.ie < 9)return;//TODO 1.2.6276 var div = document.body.appendChild(document.createElement('div'));277 $(div).css('width', '500px').css('height', '500px').css('border', '1px solid #ccc');278 var editor = te.obj[2];279 editor.render(div);280 stop();281 editor.ready(function () {282 editor.setContent('<p></p>');283 editor.ui.setFullScreen(!editor.ui.isFullScreen());284 editor.execCommand('inserttable');285 var width1 = editor.body.getElementsByTagName('td')[0].width;286 setTimeout(function () {287 editor.ui.setFullScreen(!editor.ui.isFullScreen());288 setTimeout(function () {289 var width2 = editor.body.getElementsByTagName('td')[0].width;290 ok((width1 - width2) > 10, '页é¢å®½åº¦èªéåº');291 div.parentNode.removeChild(div);292 start();293 }, 500);294 }, 500);295 });296});297298test('backspaceäºä»¶:å é¤caption', function () {299 if(ua.browser.ie&&ua.browser.ie>8)return ;//todo 1.3.0300301 var editor = te.obj[0];302 var range = te.obj[1];303 editor.setContent('<p></p>');304 range.setStart(editor.body.firstChild, 0).collapse(true).select();305 editor.execCommand('inserttable', {numCols: 3, numRows: 3});306 stop();307 setTimeout(function () {308 var trs = editor.body.firstChild.getElementsByTagName('tr');309 range.setStart(trs[0].cells[0], 0).collapse(true).select();310 editor.execCommand('insertcaption');311 ua.keydown(editor.body, {'keyCode': 8});312 setTimeout(function () {313 equal(editor.body.getElementsByTagName('caption').length, 0, 'å é¤caption');314 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');315 equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');316 start();317 }, 500);318 }, 50);319});320321test('backspaceäºä»¶:deleterow', function () {322 var editor = te.obj[0];323 var range = te.obj[1];324 editor.setContent('<p></p>');325 range.setStart(editor.body.firstChild, 0).collapse(true).select();326 editor.execCommand('inserttable', {numCols: 3, numRows: 3});327 stop();328 setTimeout(function () {329 var trs = editor.body.firstChild.getElementsByTagName('tr');330 var ut = editor.getUETable(editor.body.firstChild);331 var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[0].cells[2]);332 ut.setSelected(cellsRange);333 range.setStart(trs[0].cells[0], 0).collapse(true).select();334 ua.keydown(editor.body, {'keyCode': 8});335 setTimeout(function () {336 equal(editor.body.getElementsByTagName('tr').length, 2, 'å é¤æ´è¡');337 if(!ua.browser.ie||ua.browser.ie<9){//todo338 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');339 equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');340 }341 start();342 }, 100);343 }, 50);344});345346test('backspaceäºä»¶:deletecol', function () {347 var editor = te.obj[0];348 var range = te.obj[1];349 editor.setContent('<p></p>');350 range.setStart(editor.body.firstChild, 0).collapse(true).select();351 editor.execCommand('inserttable', {numCols: 3, numRows: 3});352 stop();353 setTimeout(function () {354 var trs = editor.body.firstChild.getElementsByTagName('tr');355 var ut = editor.getUETable(editor.body.firstChild);356 var cellsRange = ut.getCellsRange(trs[0].cells[0], trs[2].cells[0]);357 ut.setSelected(cellsRange);358 range.setStart(trs[0].cells[0], 0).collapse(true).select();359 setTimeout(function () {360 ua.keydown(trs[0].cells[0], {'keyCode': 8});361 setTimeout(function () {362 equal(editor.body.getElementsByTagName('tr')[0].getElementsByTagName('td').length, 2, 'å é¤æ´å');363 if(!ua.browser.ie||ua.browser.ie<9){//todo364 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');365 equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');366 }367 start();368 }, 100);369 }, 50);370 }, 100);371});372373//test('backspaceäºä»¶:delcells', function () {374// //TODO375//});376test('è¡¨æ ¼å称ä¸backspaceé®', function () {377 var editor = te.obj[0];378 var range = te.obj[1];379 editor.setContent('<p></p>');380 range.setStart(editor.body.firstChild, 0).collapse(true).select();381 editor.execCommand('inserttable', {numCols: 3, numRows: 3});382 stop();383 setTimeout(function () {384 var trs = editor.body.firstChild.getElementsByTagName('tr');385 range.setStart(trs[0].cells[0], 0).collapse(true).select();386 editor.execCommand('insertcaption');387 range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();388 ua.keydown(editor.body, {'keyCode': 8});389 setTimeout(function () {390 equal(editor.body.getElementsByTagName('caption').length, 0, 'å é¤caption');391 equal(editor.body.getElementsByTagName('table').length, 1, 'ä¸ä¼å¢å è¡¨æ ¼æ°é');392 equal(editor.body.getElementsByTagName('tr').length, 3, 'ä¸ä¼å¢å è¡¨æ ¼è¡æ°é');393 equal(editor.body.getElementsByTagName('tr')[0].cells.length, 3, 'ä¸ä¼å¢å è¡¨æ ¼åæ°é');394 if(!ua.browser.ie||ua.browser.ie<9){//todo395 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');396 equal(editor.selection.getRange().startContainer, editor.body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');397 }398 start();399 }, 100);400 }, 200);401});402test('trace 3097 æ é¢è¡ä¸backspaceé®', function () {403 var editor = te.obj[0];404 var range = te.obj[1];405 editor.setContent('<p></p>');406 range.setStart(editor.body.firstChild, 0).collapse(true).select();407 editor.execCommand('inserttable', {numCols: 3, numRows: 3});408 var trs = editor.body.firstChild.getElementsByTagName('tr');409 range.setStart(trs[0].cells[0], 0).collapse(true).select();410 editor.execCommand('insertcaption');411 range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();412 var x = range.cloneRange();413 editor.execCommand('inserttitle');414 range.setStart(editor.body.getElementsByTagName('th')[0], 0).collapse(true).select();415 ua.keydown(editor.body, {'keyCode': 8});416 stop();417 setTimeout(function () {418 editor = te.obj[0];419 equal(editor.body.getElementsByTagName('caption').length, 1, 'ä¸ä¼å é¤caption');420 equal(editor.body.getElementsByTagName('th').length, 3, 'ä¸ä¼è¯¯å é¤æ é¢è¡');421 equal(editor.body.getElementsByTagName('table').length, 1, 'ä¸ä¼å¢å è¡¨æ ¼æ°é');422 equal(editor.body.getElementsByTagName('tr').length, 4, 'ä¸ä¼å¢å è¡¨æ ¼è¡æ°é');423 equal(editor.body.getElementsByTagName('tr')[0].cells.length, 3, 'ä¸ä¼å¢å è¡¨æ ¼åæ°é');424 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');425 trs[0].cells[0].innerHTML = 'hello';426// equal(editor.selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('th')[0], 'æ£æ¥å
æ ');427 equal(trs[0].cells[0].innerHTML,'hello', 'æ£æ¥å
æ ');428 start();429 }, 50);430});431432test('ææ½', function () {433 if (ua.browser.ie && ua.browser.ie < 8) return;434 var editor = te.obj[0];435 var range = te.obj[1];436 editor.setContent('<p></p>');437 range.setStart(editor.body.firstChild, 0).collapse(true).select();438 editor.execCommand('inserttable');439 ua.manualDeleteFillData(editor.body);440 var tds = te.obj[0].body.getElementsByTagName('td');441 var width1 = tds[1].width;442 ua.mousemove(tds[1], {clientX: 199, clientY: 100});443 equal(editor.body.style.cursor, 'col-resize', 'æ£æ¥é¼ æ æ¾ç¤º');444 ua.mousedown(tds[1], {clientX: 199, clientY: 100});445 setTimeout(function () {446 ua.mousemove(tds[1], {clientX: 299, clientY: 100});447 ua.mouseup(tds[1], {clientX: 299, clientY: 100});448 var p = ua.getMousePosition;449 setTimeout(function () {450 var width2 = tds[1].width;451 ok(width2 - width1 > 50, 'ææ½ååå
æ ¼å®½åº¦æ¹å');452 start();453 }, 50);454 }, 400);455 stop();456});457test('ææ½_row-resizeé¼ æ æ¾ç¤º', function () {458 if (ua.browser.ie && ua.browser.ie < 8) return;459 var editor = te.obj[0];460 var range = te.obj[1];461 editor.setContent('<p></p>');462 range.setStart(editor.body.firstChild, 0).collapse(true).select();463 editor.execCommand('inserttable');464 ua.manualDeleteFillData(editor.body);465 var tds = te.obj[0].body.getElementsByTagName('td');466 var width1 = tds[1].width;467 ua.mousemove(tds[4], {clientX: 450, clientY: 39});468 equal(editor.body.style.cursor, 'row-resize', 'row-resizeé¼ æ æ¾ç¤º');469470 expect(3);471 setTimeout(function () {472 editor.addListener("tablemouseout", function (type, table, buttonOn) {473 same(table, editor.body.getElementsByTagName('table')[0], 'tablemouseoutäºä»¶,ä¼ å
¥çåæ°æ£ç¡®');474 });475 ua.mouseout(tds[1], {clientX: 299, clientY: 35});476 setTimeout(function () {477 equal(editor.body.style.cursor, 'text', 'ç¦ç¹è½¬ç§»,row-resizeä¸æ¾ç¤º');478 start();479 }, 50);480 }, 20);481 stop();482});483test('ææ½-æå³è¾¹çåå
æ ¼', function () {484 if (ua.browser.ie && ua.browser.ie < 8) return;485486 var editor = te.obj[0];487 var range = te.obj[1];488 editor.setContent('<p></p>');489 range.setStart(editor.body.firstChild, 0).collapse(true).select();490 editor.execCommand('inserttable');491 ua.manualDeleteFillData(editor.body);492 var tds = te.obj[0].body.getElementsByTagName('td');493 var width1 = tds[4].width;494 ua.mousemove(tds[4], {clientX: 492, clientY: 21});495 equal(editor.body.style.cursor, 'col-resize', 'æ£æ¥é¼ æ æ¾ç¤º');496497 ua.mousedown(tds[4], {clientX: 492, clientY: 21});498 setTimeout(function () {499 ua.mousemove(tds[4], {clientX: 481, clientY: 21});500 ua.mouseup(tds[4], {clientX: 481, clientY: 21});501 setTimeout(function () {502 var width2 = te.obj[0].body.getElementsByTagName('td')[4].width;503 ok(width1 != width2 , 'ææ½ååå
æ ¼å®½åº¦æ¹å');504 start();505 }, 50);506 }, 400);507 stop();508});509test('ææ½-æä¸è¾¹çåå
æ ¼', function () {510// if (ua.browser.ie ) return;//todo 1.3.0511512 var editor = te.obj[0];513 var range = te.obj[1];514 editor.setContent('<p></p>');515 range.setStart(editor.body.firstChild, 0).collapse(true).select();516 editor.execCommand('inserttable');517 var tds = te.obj[0].body.getElementsByTagName('td');518 var height1 = tds[20].height;519 ua.mousemove(tds[24], {clientX: 439, clientY: 512});520 ua.mousedown(tds[24], {clientX: 439, clientY: 512});521 equal(editor.body.style.cursor, 'row-resize', 'æ£æ¥é¼ æ æ¾ç¤º');522523 setTimeout(function () {524 ua.mousemove(tds[24], {clientX: 439, clientY: 562});525 ua.mouseup(tds[24], {clientX: 439, clientY: 562});526 setTimeout(function () {527 var height2 = te.obj[0].body.getElementsByTagName('td')[20].height;528 ok(height2 - height1 > 10, 'ææ½ååå
æ ¼å®½åº¦æ¹å');529 start();530 }, 50);531 }, 400);532 stop();533});534test('trace 3022 è¡¨æ ¼å称ä¸backspaceãctrl+zãenter', function () {535 var editor = te.obj[0];536 var range = te.obj[1];537 editor.setContent('<p></p>');538 range.setStart(editor.body.firstChild, 0).collapse(true).select();539 editor.execCommand('inserttable', {numCols: 3, numRows: 3});540// expect(9);541 editor.addListener('saveScene', function () {542 ok(true);543 });544 stop();545 setTimeout(function () {546 var trs = editor.body.firstChild.getElementsByTagName('tr');547 range.setStart(trs[0].cells[0], 0).collapse(true).select();548 editor.execCommand('insertcaption');549 ua.keydown(editor.body, {'keyCode': 8});550 setTimeout(function () {551552 range.setStart(trs[0].cells[0], 0).collapse(true).select();553 ua.keydown(editor.body, {'keyCode': 90, 'ctrlKey': true});554 setTimeout(function () {555 ua.keydown(editor.body, {'keyCode': 13});556 equal(te.obj[0].body.getElementsByTagName('caption').length, 1, 'æ¤éå é¤caption');557 equal(te.obj[0].body.getElementsByTagName('th').length, 0, 'ä¸ä¼è¯¯æå
¥æ é¢è¡');558 equal(te.obj[0].body.getElementsByTagName('table').length, 1, 'ä¸ä¼å¢å è¡¨æ ¼æ°é');559 equal(te.obj[0].body.getElementsByTagName('tr').length, 3, 'ä¸ä¼å¢å è¡¨æ ¼è¡æ°é');560 equal(te.obj[0].body.getElementsByTagName('tr')[0].cells.length, 3, 'ä¸ä¼å¢å è¡¨æ ¼åæ°é');561 equal(te.obj[0].selection.getRange().collapsed, true, 'æ£æ¥å
æ ');562563 if(!ua.browser.gecko && !ua.browser.webkit)//todo 1.3.6 ff åéåå
æ æ¾ä¸å¥½564 equal(te.obj[0].selection.getRange().startContainer.parentNode, te.obj[0].body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');565 start();566 }, 20);567 }, 20);568 }, 50);569});570571572573/*trace 3067*/574test('trace 3067 åå³å并--tabé®', function () {575 var editor = te.obj[0];576 var range = te.obj[1];577 editor.setContent('<p></p>');578 range.setStart(editor.body.firstChild, 0).collapse(true).select();579 editor.execCommand('inserttable', {numCols: 2, numRows: 2});580 ua.manualDeleteFillData(editor.body);581582 var tds = editor.body.getElementsByTagName('td');583 range.setStart(tds[0], 0).collapse(true).select();584 editor.execCommand('mergeright');585 range.setStart(tds[0], 0).collapse(true).select();586 range = editor.selection.getRange();587 var common = range.getCommonAncestor(true, true);588 equal(common.colSpan, 2, 'tabé®åå
æ ä½äºå并åçåå
æ ¼ä¸');589 ua.keydown(editor.body, {'keyCode': 9});590 setTimeout(function () {591 range = editor.selection.getRange();592 common = range.getCommonAncestor(true, true);593 equal(common.colSpan, 1, 'tabé®åå
æ è·³å°å并ååå
æ ¼çä¸ä¸ä¸ªåå
æ ¼ä¸');594 start();595 }, 20);596 stop();597});598599/*trace 3100*/600test('trace 3100 è¡¨æ ¼å称ä¸tabé®', function () {601 var editor = te.obj[0];602 var range = te.obj[1];603 editor.setContent('<p></p>');604 range.setStart(editor.body.firstChild, 0).collapse(true).select();605 editor.execCommand('inserttable', {numCols: 3, numRows: 3});606 var trs = editor.body.firstChild.getElementsByTagName('tr');607 range.setStart(trs[0].cells[0], 0).collapse(true).select();608 editor.execCommand('insertcaption');609 range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();610 ua.keydown(editor.body, {'keyCode': 9});611 stop();612 setTimeout(function () {613 editor = te.obj[0];614 equal(editor.body.getElementsByTagName('caption').length, 1, 'ä¸ä¼å é¤caption');615 equal(editor.body.getElementsByTagName('th').length, 0, 'ä¸ä¼è¯¯æå
¥æ é¢è¡');616 equal(editor.body.getElementsByTagName('table').length, 1, 'ä¸ä¼å¢å è¡¨æ ¼æ°é');617 equal(editor.body.getElementsByTagName('tr').length, 3, 'ä¸ä¼å¢å è¡¨æ ¼è¡æ°é');618 equal(editor.body.getElementsByTagName('tr')[0].cells.length, 3, 'ä¸ä¼å¢å è¡¨æ ¼åæ°é');619 equal(editor.selection.getRange().collapsed, true, 'æ£æ¥å
æ ');620 if (!ua.browser.ie) //ie8ä¸ä¼å¯¼è´å æ 溢åºï¼å¥è©çbugï¼ä»¥åä¸æº¢åºåæ£æ¥ie8621 equal(editor.selection.getRange().startContainer, te.obj[0].body.getElementsByTagName('td')[0], 'æ£æ¥å
æ ');622 start();623 }, 50);624});625626/*trace 3059*/627test('trace 3059 è¡¨æ ¼å³æµ®å¨', function () {628 if (ua.browser.ie)return;//TODO 1.2.6629 var editor = te.obj[0];630 var range = te.obj[1];631 editor.setContent('<p></p>');632 range.setStart(editor.body.firstChild, 0).collapse(true).select();633 editor.execCommand('inserttable');634 ua.manualDeleteFillData(editor.body);635 var tds = te.obj[0].body.getElementsByTagName('td');636 var oldWidth = tds[0].offsetWidth;637 ua.mousemove(tds[0], {clientX: 105, clientY: 20});638 ua.mousedown(tds[0], {clientX: 105, clientY: 20});639 ua.mouseup(tds[0], {clientX: 105, clientY: 20});640 setTimeout(function () {641642 ua.mousedown(tds[0], {clientX: 105, clientY: 20});643 ua.mouseup(tds[0], {clientX: 105, clientY: 20});644645 setTimeout(function () {646 tds = editor.body.firstChild.getElementsByTagName('td');647 ok(tds[0].offsetWidth < oldWidth, '第ä¸å宽度åå°');648 range.setStart(tds[0], 0).collapse(true).select();649 editor.execCommand('tablealignment', 'right');650 var table = te.obj[0].body.getElementsByTagName('table')[0];651 equal(table.align, 'right', 'è¡¨æ ¼å³æµ®å¨');652653 start();654655 }, 500);656657 }, 50);658659 stop();660661});662663test('trace 3378ï¼ææ½åtabï¼ä¸å½±åè¡¨æ ¼æ ·å¼', function () {664 if (ua.browser.ie && ua.browser.ie < 8) return;665 var editor = te.obj[0];666 var range = te.obj[1];667 editor.setContent('<p></p>');668 range.setStart(editor.body.firstChild, 0).collapse(true).select();669 editor.execCommand('inserttable');670 ua.manualDeleteFillData(editor.body);671 var tds = te.obj[0].body.getElementsByTagName('td');672 var width1 = tds[1].width;673 ua.mousemove(tds[1], {clientX: 199, clientY: 100});674 ua.mousedown(tds[1], {clientX: 199, clientY: 100});675 setTimeout(function () {676 ua.mousemove(tds[1], {clientX: 299, clientY: 100});677 ua.mouseup(tds[1], {clientX: 299, clientY: 100});678 var width2 = tds[1].width;679 ok(width2 - width1 > 50, 'ææ½ååå
æ ¼å®½åº¦æ¹å');680 range.setStart(tds[24], 0).collapse(true).select();681 ua.keydown(editor.body, {'keyCode': 9});682 setTimeout(function () {683 equal(tds[1].width, width2, 'tabé®ä¸å½±ååå
æ ¼å®½åº¦');684 start();685 }, 20);686 }, 400);687 stop();688});689690//è¶
æ¶ï¼ææ¶æ³¨æ691test('è¡¨æ ¼ç²è´´', function () {692 var div = document.body.appendChild(document.createElement('div'));693 var editor = te.obj[0];694 var range = te.obj[1];695 editor.setContent('');696 editor.execCommand('inserttable');697 /*æå
¥è¡¨æ ¼*/698 var tds = editor.body.getElementsByTagName('td');699 var ut = editor.getUETable(editor.body.firstChild);700 var cellsRange = ut.getCellsRange(tds[0], tds[24]);701 ut.setSelected(cellsRange);702 /*ç¡®å®éåº*/703 range.setStart(tds[0], 0).collapse(true).select();704 /*å®å
æ */705 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});706 /*ctrl+c*/707 var html = {html: editor.body.innerHTML};708 range.setStart(editor.body.lastChild, 0).collapse(true).select();709 equal(editor.body.getElementsByTagName('table').length, '1', '触åç²è´´äºä»¶åæ1个table');710 editor.fireEvent('beforepaste', html);711 /*ç²è´´*/712 editor.fireEvent("afterpaste");713 equal(editor.body.getElementsByTagName('table').length, '2', '触åç²è´´äºä»¶åæ2个table');714});715//716//test('trace 3104 ç²è´´åå并åå
æ ¼',function(){717// var div = document.body.appendChild(document.createElement('div'));718// var editor = te.obj[0];719// var range = te.obj[1];720// editor.setContent('');721// editor.execCommand('inserttable');722// var trs = editor.body.getElementsByTagName('tr');723// var ut = editor.getUETable(editor.body.firstChild);724// var cellsRange = ut.getCellsRange(trs[0].cells[0],trs[4].cells[0]);725// ut.setSelected(cellsRange);726// range.setStart( trs[0].cells[0], 0 ).collapse( true ).select();727// ua.keydown(editor.body,{'keyCode':67,'ctrlKey':true});728// ut.clearSelected();729// var html ={html:editor.body.innerHTML};730// range.setStart(editor.body.lastChild,0).collapse(true).select();731// editor.fireEvent('beforepaste',html);732// editor.fireEvent("afterpaste");733// var table = editor.body.getElementsByTagName('table');734// equal(table.length,'2','触åç²è´´äºä»¶åæ2个table');735// equal(table[1].firstChild.childNodes.length,'5','5è¡');736// equal(table[1].firstChild.firstChild.childNodes.length,'1','1å');737//738// var tds = editor.body.getElementsByTagName('td');739// ut = editor.getUETable(editor.body.firstChild.nextSibling);740// cellsRange = ut.getCellsRange(tds[25],tds[29]);741// ut.setSelected(cellsRange);742// range.setStart(tds[25], 0 ).collapse( true ).select();743// editor.execCommand('mergecells');744// table = editor.body.getElementsByTagName('table');745// equal(table[1].firstChild.childNodes.length,'1','1è¡');746// equal(table[1].firstChild.firstChild.childNodes.length,'1','1å');747//});748//749test('trace 3105 å¨è¡¨æ ¼å称ä¸ç²è´´', function () {750 var div = document.body.appendChild(document.createElement('div'));751 var editor = te.obj[0];752 var range = te.obj[1];753 editor.setContent('');754 editor.execCommand('inserttable', {numCols: 2, numRows: 2});755 range.setStart(editor.body.getElementsByTagName('td')[0], 0).collapse(true).select();756 editor.execCommand('insertcaption');757 var str = ua.getChildHTML(editor.body);758 var ut = editor.getUETable(editor.body.firstChild);759 var tds = editor.body.getElementsByTagName('td');760 var cellsRange = ut.getCellsRange(tds[0], tds[1]);761 ut.setSelected(cellsRange);762 range.setStart(tds[0], 0).collapse(true).select();763764 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});765 var html = {html: editor.body.innerHTML};766 range.setStart(editor.body.getElementsByTagName('caption')[0], 0).collapse(true).select();767 editor.fireEvent('beforepaste', html);768 editor.fireEvent("afterpaste");769 ut.clearSelected();770 equal(editor.body.getElementsByTagName('table').length, '1', '触åç²è´´äºä»¶åæ1个table');771 equal(ua.getChildHTML(editor.body), str, 'ç²è´´æ æ');772});773774test('trace 3106 ç²è´´æ é¢è¡', function () {775 var div = document.body.appendChild(document.createElement('div'));776 var editor = te.obj[0];777 var range = te.obj[1];778 editor.setContent('');779 editor.execCommand('inserttable');780 var tds = editor.body.getElementsByTagName('td');781 range.setStart(tds[0], 0).collapse(true).select();782 editor.execCommand('inserttitle');783 var ut = editor.getUETable(editor.body.firstChild);784 var ths = editor.body.getElementsByTagName('th');785 var cellsRange = ut.getCellsRange(ths[0], ths[4]);786 ut.setSelected(cellsRange);787 range.setStart(ths[0], 0).collapse(true).select();788789 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});790 var html = {html: editor.body.innerHTML};791 range.setStart(editor.body.lastChild, 0).collapse(true).select();792 editor.fireEvent('beforepaste', html);793 editor.fireEvent("afterpaste");794 equal(editor.body.getElementsByTagName('table').length, '2', '触åç²è´´äºä»¶åæ2个table');795 if (ua.browser.gecko) {796 //è¿ä¸ªæ¯è¾æ²¡æä¹797// equal(editor.body.firstChild.firstChild.firstChild.firstChild.tagName.toLowerCase(),'td','ä¸æ¯thï¼æ¯td');798 range.setStart(editor.body.firstChild.firstChild.firstChild.firstChild, 0).collapse(true).select();799 equal(editor.queryCommandState('inserttable'), -1, 'åºå½ä¸å¯ä»¥æå
¥è¡¨æ ¼');800 equal(editor.queryCommandState('mergeright'), 0, 'åºå½å¯ä»¥å³å并åå
æ ¼');801 }802 else {803// equal(editor.body.firstChild.nextSibling.firstChild.firstChild.firstChild.tagName.toLowerCase(),'td','ä¸æ¯thï¼æ¯td');804 range.setStart(editor.body.firstChild.nextSibling.firstChild.firstChild.firstChild, 0).collapse(true).select();805 equal(editor.queryCommandState('inserttable'), -1, 'åºå½ä¸å¯ä»¥æå
¥è¡¨æ ¼');806 equal(editor.queryCommandState('mergeright'), 0, 'åºå½å¯ä»¥å³å并åå
æ ¼');807 }808});809810test('trace 3114 å¨åå
æ ¼å
ç²è´´è¡', function () {811 var div = document.body.appendChild(document.createElement('div'));812 var editor = te.obj[0];813 var range = te.obj[1];814 editor.setContent('');815 editor.execCommand('inserttable');816 var tds = editor.body.getElementsByTagName('td');817818 var ut = editor.getUETable(editor.body.firstChild);819 var cellsRange = ut.getCellsRange(tds[0], tds[9]);820 ut.setSelected(cellsRange);821 range.setStart(tds[0], 0).collapse(true).select();822 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});823 var html = {html: editor.body.innerHTML};824 range.setStart(tds[0], 0).collapse(true).select();825 editor.fireEvent('beforepaste', html);826 editor.fireEvent("afterpaste");827 equal(editor.body.getElementsByTagName('table').length, '1', '触åç²è´´äºä»¶åæ1个table');828 stop();829 setTimeout(function () {830 editor.execCommand('source');831 setTimeout(function () {832 editor.execCommand('source');833 equal(editor.body.getElementsByTagName('tr').length, '7', '触åç²è´´äºä»¶åæ7个tr');834 start();835 }, 50);836 }, 50);837});838test('å¨åå
æ ¼ä¸ç²è´´_ç²å°æå', function () {839 var editor = te.obj[0];840 var range = te.obj[1];841 editor.setContent('');842 editor.execCommand('inserttable', {numCols: 3, numRows: 3});843 /*æå
¥è¡¨æ ¼*/844 var tds = editor.body.getElementsByTagName('td');845 var ut = editor.getUETable(editor.body.firstChild);846 var cellsRange = ut.getCellsRange(tds[0], tds[4]);847 ut.setSelected(cellsRange);848 /*ç¡®å®éåº*/849 range.setStart(tds[0], 0).collapse(true).select();850 /*å®å
æ */851 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});852 /*ctrl+c*/853 var html = {html: editor.body.innerHTML};854 range.setStart(tds[8], 0).collapse(true).select();855 equal(editor.body.getElementsByTagName('tr').length, 3, '触åç²è´´äºä»¶åæ3个tr');856 equal(editor.body.getElementsByTagName('td').length, 9, '触åç²è´´äºä»¶åæ9个td');857 editor.fireEvent('beforepaste', html);858 /*ç²è´´*/859 editor.fireEvent("afterpaste");860 equal(editor.body.getElementsByTagName('tr').length, 4, '触åç²è´´äºä»¶åæ4个tr');861 equal(editor.body.getElementsByTagName('td').length, 16, '触åç²è´´äºä»¶åæ12个td');862});863test('å¨åå
æ ¼ä¸ç²è´´_æ´å', function () {864 var editor = te.obj[0];865 var range = te.obj[1];866 editor.setContent('');867 editor.execCommand('inserttable', {numCols: 3, numRows: 3});868 /*æå
¥è¡¨æ ¼*/869 var tds = editor.body.getElementsByTagName('td');870 range.setStart(tds[0], 0).collapse(true).select();871 editor.execCommand('inserttitle');872 var ut = editor.getUETable(editor.body.firstChild);873 var cellsRange = ut.getCellsRange(tds[0], tds[6]);874 ut.setSelected(cellsRange);875 /*ç¡®å®éåº*/876 range.setStart(tds[0], 0).collapse(true).select();877 /*å®å
æ */878 ua.keydown(editor.body, {'keyCode': 67, 'ctrlKey': true});879 /*ctrl+c*/880 var html = {html: editor.body.innerHTML};881 range.setStart(tds[6], 0).collapse(true).select();882 equal(editor.body.getElementsByTagName('tr').length, 4, '触åç²è´´äºä»¶åæ4个tr');883 equal(editor.body.getElementsByTagName('th').length, 3, '触åç²è´´äºä»¶åæ3个th');884 equal(editor.body.getElementsByTagName('td').length, 9, '触åç²è´´äºä»¶åæ9个td');885 editor.fireEvent('beforepaste', html);886 /*ç²è´´*/887 editor.fireEvent("afterpaste");888 equal(editor.body.getElementsByTagName('tr').length, 4, '触åç²è´´äºä»¶åæ4个tr');889 equal(editor.body.getElementsByTagName('th').length, 4, '触åç²è´´äºä»¶åæ4个th');890 equal(editor.body.getElementsByTagName('td').length, 12, '触åç²è´´äºä»¶åæ12个td');891});892test('ç¹å»ä¸è¡çæ左边,éä¸ä¸è¡', function () {893 if (ua.browser.ie && ua.browser.ie < 9)return;//todo clickäºä»¶æ¨¡ææé®é¢894 var editor = te.obj[0];895 var range = te.obj[1];896 editor.setContent('');897 editor.execCommand('inserttable', {numCols: 2, numRows: 3});898 /*æå
¥è¡¨æ ¼*/899 setTimeout(function () {900 var tds = editor.body.getElementsByTagName('td');901 tds[0].innerHTML = 'hello1';902 tds[1].innerHTML = 'hello2';903 ua.mousemove(tds[0], {clientX: 8, clientY: 24});904 ua.click(tds[0], {clientX: 8, clientY: 24});905 setTimeout(function () {906 var space = ua.browser.ie ? '' : ' ';907 var quot = ua.browser.gecko ? '\"' : '';908 equal(editor.body.style.cursor, 'url(' + quot + editor.options.cursorpath + 'v.png' + quot + '),' + space + 'pointer');909// //me.body.style.cursor910 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;911 equal(selectedTds.length, 2, 'éä¸ä¸è¡');912 equal(selectedTds[0].className, 'selectTdClass', 'æ£æ¥æ ·å¼');913 equal(selectedTds[1].className, 'selectTdClass', 'æ£æ¥æ ·å¼');914 equal(selectedTds[0].innerHTML, 'hello1', 'æ£æ¥å
容');915 equal(selectedTds[1].innerHTML, 'hello2', 'æ£æ¥å
容');916 //todo trace 3571917// ua.click(tds[2],{clientX:12,clientY:24,shiftKey:true});918// equal(editor.getUETable(editor.body.firstChild).selectedTds.length,6,'');919 start();920 }, 50);921 }, 50);922 stop();923});924925test('ç¹å»ä¸è¡çæ左边,ä½æ¯æ¯è¡åªæä¸å,è¿æ¶éä¸åå
æ ¼ä¸çå
容', function () {926 if (ua.browser.ie && ua.browser.ie < 9)return;//todo clickäºä»¶æ¨¡ææé®é¢927 var editor = te.obj[0];928 editor.setContent('');929 editor.execCommand('inserttable', {numCols: 1, numRows: 1});930 /*æå
¥è¡¨æ ¼*/931 var tds = editor.body.getElementsByTagName('td');932 tds[0].innerHTML = 'hello';933 setTimeout(function () {934 window.scrollTo(0,0);//ä¿è¯ä½ç½®åç¡®935936 ua.click(tds[0], {clientX: 10, clientY: 23});937 setTimeout(function () {938 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;939 equal(selectedTds.length, 0, 'ä¸éä¸è¡');940 if (ua.browser.ie>8) {941 ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 0, 5, false, 'æ£æ¥éä¸çrange');942 } else {943 ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 1, false, 'æ£æ¥éä¸çrange');944 }945 start();946 }, 500);947 }, 500);948 stop();949});950test('ç¹å»ä¸åçæä¸è¾¹,ä½æ¯æ¯ååªæä¸è¡,è¿æ¶éä¸åå
æ ¼ä¸çå
容', function () {951 if (ua.browser.ie && ua.browser.ie < 9)return;//todo clickäºä»¶æ¨¡ææé®é¢952 var editor = te.obj[0];953 var range = te.obj[1];954 editor.setContent('');955 editor.execCommand('inserttable', {numCols: 1, numRows: 1});956 /*æå
¥è¡¨æ ¼*/957 stop();958 setTimeout(function () {959 var tds = editor.body.getElementsByTagName('td');960 tds[0].innerHTML = 'hello';961 window.scrollTo(0,0);//ä¿è¯ä½ç½®åç¡®962 ua.click(tds[0], {clientX: 81, clientY: 9,pageX: 81, pageY: 9});963 setTimeout(function () {964 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;965 equal(selectedTds.length, 0, 'ä¸éä¸å');966 if (ua.browser.ie>8) {967 ua.checkResult(editor.selection.getRange(), tds[0].firstChild, tds[0].firstChild, 0, 5, false, 'æ£æ¥éä¸çrange');968 } else {969 ua.checkResult(editor.selection.getRange(), tds[0], tds[0], 0, 1, false, 'æ£æ¥éä¸çrange');970 }971 start();972 },10);973 }, 50);974});975test('ç¹å»ä¸åçæä¸è¾¹,éä¸ä¸å', function () {976 if (ua.browser.ie && ua.browser.ie < 9)return;//todo clickäºä»¶æ¨¡ææé®é¢977 var editor = te.obj[0];978 var range = te.obj[1];979 editor.setContent('');980 editor.execCommand('inserttable', {numCols: 3, numRows: 3});981982 /*æå
¥è¡¨æ ¼*/983 stop();984 setTimeout(function () {985 var tds = editor.body.getElementsByTagName('td');986 tds[0].innerHTML = 'hello';987 window.scrollTo(0,0);988 ua.mousemove(tds[0], {clientX: 81, clientY: 9});989 var space = ua.browser.ie ? '' : ' ';990 var quot = ua.browser.gecko ? '\"' : '';991 equal(editor.body.style.cursor, 'url(' + quot + editor.options.cursorpath + 'h.png' + quot + '),' + space + 'pointer');992 ua.click(tds[0], {clientX: 81, clientY: 9});993 setTimeout(function () {994 var selectedTds = editor.getUETable(editor.body.firstChild).selectedTds;995 equal(selectedTds.length, 3, 'éä¸ä¸å');996 equal(selectedTds[0].innerHTML, 'hello', 'æ£æ¥å
容');997 equal(selectedTds[0].className, 'selectTdClass', 'æ£æ¥æ ·å¼');998 equal(selectedTds[1].className, 'selectTdClass', 'æ£æ¥æ ·å¼');999 equal(selectedTds[2].className, 'selectTdClass', 'æ£æ¥æ ·å¼');10001001 //todo trace 35711002// ua.click(tds[2],{clientX:370,clientY:9,shiftKey:true});1003// equal(editor.getUETable(editor.body.firstChild).selectedTds.length,9,'');1004 start();1005 }, 500);1006 }, 50);
...
convertcase.js
Source:convertcase.js
1module("plugins.convertcase");2test('éåéæ©', function () {3 stop();4 setTimeout(function () {5 var editor = te.obj[0];6 var range = te.obj[1];7 var body = editor.body;8 editor.setContent('<p>hello</p>');9 setTimeout(function () {10 range.setStart(body.firstChild, 1).collapse(true).select();11 editor.execCommand("touppercase");12 equal(editor.getContent(), "<p>hello</p>", "éåéæ©--up");13 start();14 }, 50);15 }, 100);16});17test('ééåéæ©----å符串å
¨é', function () {18 var editor = te.obj[0];19 var range = te.obj[1];20 var body = editor.body;21 editor.setContent('<p>hello1</p><p>hello2</p>');22 setTimeout(function () {23 range.setStart(body.firstChild, 0).setEnd(body.lastChild, 1).select();24 editor.execCommand("touppercase");25 equal(editor.getContent(), "<p>HELLO1</p><p>HELLO2</p>", "ééå--å符串å
¨é--up");26 editor.execCommand("touppercase");27 equal(editor.getContent(), "<p>HELLO1</p><p>HELLO2</p>", "ééå--两次up");28 editor.execCommand("tolowercase");29 equal(editor.getContent(), "<p>hello1</p><p>hello2</p>", "ééå--å符串å
¨é--low");30 editor.execCommand("tolowercase");31 equal(editor.getContent(), "<p>hello1</p><p>hello2</p>", "ééå---两次low");32 start();33 }, 50);34 stop();35});36test('ééåéæ©----åå符串', function () {37 var editor = te.obj[0];38 var range = te.obj[1];39 var body = editor.body;40 editor.setContent('<p>hello1</p><p>hello2</p>');41 setTimeout(function () {42 range.setStart(body.firstChild.firstChild, 2).setEnd(body.lastChild.firstChild, 2).select();43 editor.execCommand("touppercase");44 equal(editor.getContent(), "<p>heLLO1</p><p>HEllo2</p>", "ééå--åå符串--up");45 editor.execCommand("tolowercase");46 equal(editor.getContent(), "<p>hello1</p><p>hello2</p>", "ééå--åå符串--low");47 start();48 }, 50);49 stop();50});51test('ééåéæ©----å符串å
æ¬å¤§åè·å°å', function () {52 var editor = te.obj[0];53 var range = te.obj[1];54 var body = editor.body;55 var text = "<p>HEllo1</p><p>heLLo2</p>";56 editor.setContent(text);57 setTimeout(function () {58 range.setStart(body.firstChild.firstChild, 0).setEnd(body.lastChild.firstChild, 6).select();59 editor.execCommand("touppercase");60 equal(editor.getContent(), "<p>HELLO1</p><p>HELLO2</p>", "ééå--å
å«å¤§å°å--up");61 editor.setContent(text);62 setTimeout(function () {63 range.setStart(body.firstChild.firstChild, 0).setEnd(body.lastChild.firstChild, 6).select();64 editor.execCommand("tolowercase");65 equal(editor.getContent(), "<p>hello1</p><p>hello2</p>", "ééå--å
å«å¤§å°å--low");66 start();67 }, 50);68 }, 50);69 stop();70});71test('ééåéæ©----å符串å
æ¬æ¢è¡è·ç©ºæ ¼', function () {72 if (ua.browser.ie == 9)return;//TODO 1.2.673 if (ua.browser.ie == 8)return;//TODO 1.2.6 PUBLICGE-340274 var editor = te.obj[0];75 var range = te.obj[1];76 var body = editor.body;77 editor.setContent('<p>HEllo1<br/> heLLO2</p>');78 setTimeout(function () {79 range.setStart(body.firstChild.firstChild, 0).setEnd(body.firstChild.lastChild, 6).select();80 editor.execCommand("touppercase");81 equal(editor.getContent(), "<p>HELLO1<br/> HELLO2</p>", "ééå--å
å«å¤§å°å--up");82 editor.execCommand("tolowercase");83 equal(editor.getContent(), "<p>hello1<br/> hello2</p>", "ééå--å
å«å¤§å°å--low");84 start();85 }, 50);86 stop();87});88test('æ ç¾table', function () {89 //å个åå
æ ¼ï¼å¤ä¸ªåå
æ ¼ï¼ä¸¤ä¸ªè¡¨æ ¼90 var editor = te.obj[0];91 var range = te.obj[1];92 var body = editor.body;93 var text = "<table><tr><td>hello1</td><td>hello2</td></tr><tr><td>hello3</td><td>hello4</td></tr></table>";94 editor.setContent(text);95 stop();96 setTimeout(function () {97 var tds = body.firstChild.getElementsByTagName('td');98 range.selectNode(tds[1]).select();99 editor.execCommand("touppercase");100 equal(tds[1].innerHTML, "HELLO2", "table--up");101 editor.execCommand("tolowercase");102 equal(tds[1].innerHTML, "hello2", "table--low");103 range.setStart(tds[1], 0).setEnd(tds[2], 1).select();104 editor.execCommand("touppercase");105 equal(tds[1].innerHTML, "HELLO2", "table--åå
æ ¼2--up");106 equal(tds[2].innerHTML, "HELLO3", "table--åå
æ ¼3--up");107 editor.execCommand("tolowercase");108 equal(tds[1].innerHTML, "hello2", "table--åå
æ ¼2--low");109 equal(tds[2].innerHTML, "hello3", "table--åå
æ ¼3--low");110 range.setStart(tds[0], 0).setEnd(tds[3], 1).select();111 editor.execCommand("touppercase");112 equal(tds[0].innerHTML, "HELLO1", "table--åå
æ ¼1--up");113 equal(tds[1].innerHTML, "HELLO2", "table--åå
æ ¼2--up");114 equal(tds[2].innerHTML, "HELLO3", "table--åå
æ ¼3--up");115 equal(tds[3].innerHTML, "HELLO4", "table--åå
æ ¼4--up");116 editor.execCommand("tolowercase");117 equal(tds[0].innerHTML, "hello1", "table--åå
æ ¼1--low");118 equal(tds[1].innerHTML, "hello2", "table--åå
æ ¼2--low");119 equal(tds[2].innerHTML, "hello3", "table--åå
æ ¼3--low");120 equal(tds[3].innerHTML, "hello4", "table--åå
æ ¼4--low");121 start();122 }, 50);123});124test('æ ç¾h1', function () {125 var editor = te.obj[0];126 var range = te.obj[1];127 var body = editor.body;128 editor.setContent('<h1>hello1</h1><h1>hello2</h1>');129 range.setStart(body.firstChild.firstChild, 2).setEnd(body.lastChild.firstChild, 2).select();130 editor.execCommand("touppercase");131 equal(editor.getContent(), "<h1>heLLO1</h1><h1>HEllo2</h1>", "h1--up");132 editor.execCommand("tolowercase");133 equal(editor.getContent(), "<h1>hello1</h1><h1>hello2</h1>", "h1--low");134});135test('h1&table', function () {136 var editor = te.obj[0];137 var range = te.obj[1];138 var body = editor.body;139 var text = "<h1>hello</h1><table><tbody><tr><td>hello1</td><td>hello2</td></tr><tr><td>hello3</td><td>hello4</td></tr></tbody></table>";140 editor.setContent(text);141 stop();142 setTimeout(function () {143 range.setStart(body.firstChild.firstChild, 0).setEnd(body.lastChild.firstChild.lastChild.lastChild.firstChild, 6).select();144 var tds = body.lastChild.getElementsByTagName('td');145 editor.execCommand("touppercase");146 ok(body.firstChild.tagName == "h1" || body.firstChild.tagName == "H1", "h1æ ç¾");147 equal(body.firstChild.innerHTML, "HELLO", "h1--up");148 equal(tds[0].innerHTML, "HELLO1", "table--åå
æ ¼1--up");149 equal(tds[1].innerHTML, "HELLO2", "table--åå
æ ¼2--up");150 equal(tds[2].innerHTML, "HELLO3", "table--åå
æ ¼3--up");151 equal(tds[3].innerHTML, "HELLO4", "table--åå
æ ¼4--up");152 editor.execCommand("tolowercase");153 ok(body.firstChild.tagName == "h1" || body.firstChild.tagName == "H1", "h1æ ç¾");154 equal(body.firstChild.innerHTML, "hello", "h1--low");155 equal(tds[0].innerHTML, "hello1", "table--åå
æ ¼1--low");156 equal(tds[1].innerHTML, "hello2", "table--åå
æ ¼2--low");157 equal(tds[2].innerHTML, "hello3", "table--åå
æ ¼3--low");158 equal(tds[3].innerHTML, "hello4", "table--åå
æ ¼4--low");159 start();160 }, 50);161});162test('ä¸ä¸ªç»å', function () {163 var editor = te.obj[0];164 var range = te.obj[1];165 var body = editor.body;166 var text = "<p>hello</p><table><tbody><tr><td>hello1</td><td>hello2</td></tr><tr><td>hello3</td><td>hello4</td></tr></tbody></table><h1>hello</h1>";167 editor.setContent(text);168 var tds = body.firstChild.nextSibling.getElementsByTagName('td');169 range.setStart(body.firstChild.firstChild, 2).setEnd(body.lastChild.firstChild, 2).select();170 editor.execCommand("touppercase");171 ok(body.firstChild.tagName == "p" || body.firstChild.tagName == "P", "pæ ç¾");172 equal(body.firstChild.innerHTML, "heLLO", "p--up");173 equal(tds[0].innerHTML, "HELLO1", "table--åå
æ ¼1--up");174 equal(tds[1].innerHTML, "HELLO2", "table--åå
æ ¼2--up");175 equal(tds[2].innerHTML, "HELLO3", "table--åå
æ ¼3--up");176 equal(tds[3].innerHTML, "HELLO4", "table--åå
æ ¼4--up");177 ok(body.lastChild.tagName == "h1" || body.lastChild.tagName == "H1", "h1æ ç¾");178 equal(body.lastChild.innerHTML, "HEllo", "h1--up");179 editor.execCommand("tolowercase");180 ok(body.firstChild.tagName == "p" || body.firstChild.tagName == "P", "pæ ç¾");181 equal(body.firstChild.innerHTML, "hello", "p--low");182 equal(tds[0].innerHTML, "hello1", "table--åå
æ ¼1--low");183 equal(tds[1].innerHTML, "hello2", "table--åå
æ ¼2--low");184 equal(tds[2].innerHTML, "hello3", "table--åå
æ ¼3--low");185 equal(tds[3].innerHTML, "hello4", "table--åå
æ ¼4--low");186 ok(body.lastChild.tagName == "h1" || body.lastChild.tagName == "H1", "h1æ ç¾");187 equal(body.lastChild.innerHTML, "hello", "h1--low");...
source.js
Source:source.js
1const source = `<header class="tds-header-main">2<div class="tds-header-main--container">3 <div class="tds-container">4 <h1 class="tds-header-main--logo_container">5 <a href="https://www.tesla.com/" class="tds-header-main--logo">6 <svg class="tds-icon tds-icon-wordmark--inverted"></svg>7 </a>8 </h1>9 <nav class="tds-header-nav--primary">10 <ol class="tds-header-nav--list">11 <li class="tds-header-nav--list_item">12 <a href="https://www.tesla.com/models" class="tds-header-nav--list_link">Model S</a>13 </li>14 <li class="tds-header-nav--list_item">15 <a href="https://www.tesla.com/model3" class="tds-header-nav--list_link">Model 3</a>16 </li>17 <li class="tds-header-nav--list_item">18 <a href="https://www.tesla.com/modelx" class="tds-header-nav--list_link">Model X</a>19 </li>20 <li class="tds-header-nav--list_item">21 <a href="https://www.tesla.com/modely" class="tds-header-nav--list_link">Model Y</a>22 </li>23 <li class="tds-header-nav--list_item">24 <a href="https://www.tesla.com/solarroof" class="tds-header-nav--list_link">Solar Roof</a>25 </li>26 <li class="tds-header-nav--list_item">27 <a href="https://www.tesla.com/solarpanels" class="tds-header-nav--list_link">Solar Panels</a>28 </li>29 <li class="tds-header-nav--list_item tds-header-nav--list_item_last">30 <ol class="tds-header-nav--list tds-header-nav--primary_right">31 <li class="tds-header-nav--list_item">32 <a href="https://shop.tesla.com" class="tds-header-nav--list_link">Shop</a>33 </li>34 <li class="tds-header-nav--list_item">35 <a href="https://www.tesla.com/teslaaccount"36 class="tds-header-nav--list_link tds-link_for-login tds-header-nav--auth_link">Sign37 In</a>38 </li>39 </ol>40 </li>41 </ol>42 </nav>43 </div>44</div>45</header>46<div id="main" class="layout-main clearfix">47<main id="content" class="column main-content">48 <section class="pannable-carousel">49 <div class="pannable-carousel--default">50 <div class="asset-container">51 <picture class="hero-image hero-asset">52 <img src="https://www.tesla.com/ns_videos/homepage/main_hero_homepage_desktop.jpg"53 class="image tds-asset-fallback transition--intro-width"54 style="--transformX-pannable-carousel:-741.25px; transition: transform 450ms ease 0s;">55 </picture>56 </div>57 <div58 class="product-content--container tds-animate_large--to_reveal product-content--reveal tds-animate_large--revealed">59 <div class="product-content titles">60 <div class="heading-container animate--slide_and_fade item1-content product--is_active">61 <h1>Model 3</h1>62 </div>63 </div>64 <div>65 <div class="button-group tds-btn_group--stacked">66 <a class="tds-btn tds-o-btn tds-btn--white"67 href="https://www.tesla.com/model3/design">Custom68 Order</a>69 <a class="tds-btn tds-o-btn tds-btn--outline tds-btn--white"70 href="https://www.tesla.com/inventory/new/m3">Existing Inventory</a>71 </div>72 </div>73 <div class="product-content links">74 <div class="product--is_active">75 <a class="links-top_link" href="https://www.tesla.com/findus/store">Visit a Store</a>76 </div>77 </div>78 <button79 class="tds-icon--bounce tds-icon tds-icon-arrow--down tds-icon-arrow_down--reveal tds-icon-arrow_down--inverted"></button>80 </div>81 </div>82 </section>83 <section class="hero hero--default hero--with-disclaimer">84 <picture class="hero-image hero-asset lozad" data-loaded="true">85 <img src="https://www.tesla.com/ns_videos/homepage/homepage_energy_hero_desktop.jpg">86 </picture>87 <div class="hero-regions--wrapper">88 <div class="hero-regions">89 <div class="hero-region--center hero-region--with-callouts">90 <div class="hero-region--center-top">91 <header>92 <h1 class=" header--white">93 <span class="header-lower">Power Everything</span>94 <span class="header-upper s2">Solar and Powerwall</span>95 </h1>96 </header>97 <section class="cmp-button-group">98 <div class="button-group cmp-btn_group--center">99 <div class="header-button tds-o-btn_group--item tds-btn_group--item">100 <a class="tds-btn tds-o-btn tds-btn--outline tds-btn--white button--desktop-only"101 href="https://www.tesla.com/energy/design">Order Solar Panels</a>102 </div>103 <div class="header-button tds-o-btn_group--item tds-btn_group--item">104 <a class="tds-btn tds-o-btn tds-btn--outline tds-btn--white button--desktop-only"105 href="https://www.tesla.com/solarroof/design">Order Solar Roof</a>106 </div>107 </div>108 </section>109 <a href="https://www.tesla.com/energy"110 style="border-bottom: 1px solid white; color: white; font-size: 12px;"111 class="button--desktop-only">Learn More</a>112 </div>113 </div>114 </div>115 <button116 class="tds-icon--bounce tds-icon tds-icon-arrow--down hero-arrow_down hero-arrow_down--white"></button>117 </div>118 </section>119 <section class="hero hero--default hero--with-disclaimer">120 <video class="hero-video hero-asset" muted=""121 src="https://www.tesla.com/ns_videos/accessories-hero-desktop.mp4" autoplay=""></video>122 <div class="hero-regions--wrapper">123 <div class="hero-regions">124 <div class="hero-region--center hero-region--with-callouts">125 <div class="hero-region--center-top">126 <header>127 <h1 class="header--white">Tesla Accessories</h1>128 </header>129 <a class="tds-btn tds-o-btn tds-btn--white button--desktop-only"130 href="https://www.tesla.com/shop">Shop131 Now</a>132 </div>133 </div>134 </div>135 <button136 class="tds-icon--bounce tds-icon tds-icon-arrow--down hero-arrow_down hero-arrow_down--white"></button>137 </div>138 </section>139 <section class="hero hero--default hero--with-disclaimer">140 <picture class="hero-image hero-asset lozad">141 <source srcset="https://live.staticflickr.com/65535/49586321421_10a496069d_h.jpg">142 <div class="hero-regions--wrapper">143 <div class="hero-regions">144 <div class="hero-region--center hero-region--with-callouts">145 <div class="hero-region--center-top">146 <header>147 <h1 class="header--white">148 <span>Model Y</span>149 </h1>150 </header>151 <a class="tds-btn tds-o-btn tds-btn--white"152 href="https://www.tesla.com/modely/design">Order Now</a>153 </div>154 </div>155 </div>156 </div>157 </picture>158 </section>159</div>160<ol class="tds-footer-meta tds-footer--centered">161<li class="tds-footer-list_item">162 <a href="https://www.tesla.com/about" class="tds-footer-list_link">Tesla © 2020</a>163</li>164<li class="tds-footer-list_item">165 <a href="https://www.tesla.com/about/legal" class="tds-footer-list_link">Privacy & Legal</a>166</li>167<li class="tds-footer-list_item">168 <a href="https://www.tesla.com/contact" class="tds-footer-list_link">Contact</a>169</li>170<li class="tds-footer-list_item">171 <a href="https://www.tesla.com/careers" class="tds-footer-list_link">Careers</a>172</li>173<li class="tds-footer-list_item">174 <a href="https://www.tesla.com/updates" class="tds-footer-list_link">Get Newsletter</a>175</li>176<li class="tds-footer-list_item">177 <a href="https://forums.tesla.com/" class="tds-footer-list_link">Forums</a>178</li>179<li class="tds-footer-list_item">180 <a href="https://www.tesla.com/findus/list" class="tds-footer-list_link">Locations</a>181</li>182</ol>...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test Results: ' + data.data.jsonUrl);5});6var wpt = require('webpagetest');7var wpt = new WebPageTest('www.webpagetest.org');8 if (err) return console.error(err);9 console.log('Test Results: ' + data.data.jsonUrl);10});11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org');13 if (err) return console.error(err);14 console.log('Test Results: ' + data.data.jsonUrl);15});16var wpt = require('webpagetest');17var wpt = new WebPageTest('www.webpagetest.org');18 if (err) return console.error(err);19 console.log('Test Results: ' + data.data.jsonUrl);20});21var wpt = require('webpagetest');22var wpt = new WebPageTest('www.webpagetest.org');23 if (err) return console.error(err);24 console.log('Test Results: ' + data.data.jsonUrl);25});26var wpt = require('webpagetest');
Using AI Code Generation
1var wpt = require('webpagetest');2var test = new wpt('www.webpagetest.org');3}, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var test = new wpt('www.webpagetest.org');9}, function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var test = new wpt('www.webpagetest.org');15}, function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var test = new wpt('www.webpagetest.org');21}, function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25var wpt = require('webpagetest');26var test = new wpt('www.webpagetest.org');
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest('www.webpagetest.org', options.key);5 if (err) return console.error(err);6 console.log('Test submitted to WebPageTest for %s', data.data.summary);7 wpt.getTestResults(data.data.testId, function(err, data) {8 if (err) return console.error(err);9 console.log('Test Results for %s: %j', data.data.summary, data.data);10 });11});12{ [Error: Error: getaddrinfo ENOTFOUND www.webpagetest.org www.webpagetest.org:80]13 port: 80 }14{15}16{17}
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.error(err);5 } else {6 console.log('Test submitted. You can view the status at ' + data.data.userUrl);7 }8});9var wpt = require('webpagetest');10var wpt = new WebPageTest('www.webpagetest.org');11 if (err) {12 console.error(err);13 } else {14 console.log('Test submitted. You can view the status at ' + data.data.userUrl);15 }16});17var wpt = require('webpagetest');18var wpt = new WebPageTest('www.webpagetest.org');19 if (err) {20 console.error(err);21 } else {22 console.log('Test submitted. You can view the status at ' + data.data.userUrl);23 }24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27 if (err) {28 console.error(err);29 } else {30 console.log('Test submitted. You can view the status at ' + data.data.userUrl);31 }32});33var wpt = require('webpagetest');
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org', 'A.8b8f7f0d1a1f4c0f0e9a8a8d2e4e0a4e');3 if (err) return console.log('Error: ' + err);4 console.log('Test status: ' + data.statusText);5 console.log('Test ID: ' + data.data.testId);6 console.log('Test URL: ' + data.data.summary);7});8var wpt = require('webpagetest');9var wpt = new WebPageTest('www.webpagetest.org', 'A.8b8f7f0d1a1f4c0f0e9a8a8d2e4e0a4e');10 if (err) return console.log('Error: ' + err);11 console.log('Test status: ' + data.statusText);12 console.log('Test ID: ' + data.data.testId);13 console.log('Test URL: ' + data.data.summary);14});15var wpt = require('webpagetest');16var wpt = new WebPageTest('www.webpagetest.org', 'A.8b8f7f0d1a1f4c0f0e9a8a8d2e4e0a4e');17 if (err) return console.log('Error: ' + err);18 console.log('Test status: ' + data.statusText);19 console.log('Test ID: ' + data.data.testId);20 console.log('Test URL: ' + data.data.summary);21});22var wpt = require('webpagetest
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!!