Best JavaScript code snippet using root
EnterKey.js
Source:EnterKey.js
...30});31test('Enter at end of H1', function() {32 editor.setContent('<h1>abc</h1>');33 Utils.setSelection('h1', 3);34 Utils.pressEnter();35 equal(editor.getContent(), '<h1>abc</h1><p>\u00a0</p>');36 equal(editor.selection.getRng(true).startContainer.nodeName, 'P');37});38test('Enter in midde of H1', function() {39 editor.setContent('<h1>abcd</h1>');40 Utils.setSelection('h1', 2);41 Utils.pressEnter();42 equal(editor.getContent(), '<h1>ab</h1><h1>cd</h1>');43 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'H1');44});45test('Enter before text after EM', function() {46 editor.setContent('<p><em>a</em>b</p>');47 editor.selection.setCursorLocation(editor.getBody().firstChild, 1);48 Utils.pressEnter();49 equal(editor.getContent(), '<p><em>a</em></p><p>b</p>');50 var rng = editor.selection.getRng(true);51 equal(rng.startContainer.nodeValue, 'b');52});53test('Enter before first IMG in P', function() {54 editor.setContent('<p><img alt="" src="about:blank" /></p>');55 editor.selection.setCursorLocation(editor.getBody().firstChild, 0);56 Utils.pressEnter();57 equal(editor.getContent(), '<p>\u00a0</p><p><img src="about:blank" alt="" /></p>');58});59test('Enter before first wrapped IMG in P', function() {60 editor.setContent('<p><b><img alt="" src="about:blank" /></b></p>');61 editor.selection.setCursorLocation(editor.getBody().firstChild.firstChild, 0);62 Utils.pressEnter();63 equal(editor.getBody().firstChild.innerHTML, (tinymce.isIE && tinymce.Env.ie < 11) ? '' : '<br data-mce-bogus="1">');64 equal(editor.getContent(), '<p>\u00a0</p><p><b><img src=\"about:blank\" alt=\"\" /></b></p>');65});66test('Enter before last IMG in P with text', function() {67 editor.setContent('<p>abc<img alt="" src="about:blank" /></p>');68 editor.selection.setCursorLocation(editor.getBody().firstChild, 1);69 Utils.pressEnter();70 equal(editor.getContent(), '<p>abc</p><p><img src="about:blank" alt="" /></p>');71 var rng = editor.selection.getRng(true);72 equal(rng.startContainer.nodeName, 'P');73 equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG');74});75test('Enter before last IMG in P with IMG sibling', function() {76 editor.setContent('<p><img src="about:blank" alt="" /><img src="about:blank" alt="" /></p>');77 editor.selection.setCursorLocation(editor.getBody().firstChild, 1);78 Utils.pressEnter();79 equal(editor.getContent(), '<p><img src="about:blank" alt="" /></p><p><img src="about:blank" alt="" /></p>');80 var rng = editor.selection.getRng(true);81 equal(rng.startContainer.nodeName, 'P');82 equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG');83});84test('Enter after last IMG in P', function() {85 editor.setContent('<p>abc<img alt="" src="about:blank" /></p>');86 editor.selection.setCursorLocation(editor.getBody().firstChild, 2);87 Utils.pressEnter();88 equal(editor.getContent(), '<p>abc<img src="about:blank" alt="" /></p><p>\u00a0</p>');89});90test('Enter before last INPUT in P with text', function() {91 editor.setContent('<p>abc<input type="text" /></p>');92 editor.selection.setCursorLocation(editor.getBody().firstChild, 1);93 Utils.pressEnter();94 equal(editor.getContent(), '<p>abc</p><p><input type="text" /></p>');95 var rng = editor.selection.getRng(true);96 equal(rng.startContainer.nodeName, 'P');97 equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT');98});99test('Enter before last INPUT in P with IMG sibling', function() {100 editor.setContent('<p><input type="text" /><input type="text" /></p>');101 editor.selection.setCursorLocation(editor.getBody().firstChild, 1);102 Utils.pressEnter();103 equal(editor.getContent(), '<p><input type="text" /></p><p><input type="text" /></p>');104 var rng = editor.selection.getRng(true);105 equal(rng.startContainer.nodeName, 'P');106 equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT');107});108test('Enter after last INPUT in P', function() {109 editor.setContent('<p>abc<input type="text" /></p>');110 editor.selection.setCursorLocation(editor.getBody().firstChild, 2);111 Utils.pressEnter();112 equal(editor.getContent(), '<p>abc<input type="text" /></p><p>\u00a0</p>');113});114test('Enter at end of P', function() {115 editor.setContent('<p>abc</p>');116 Utils.setSelection('p', 3);117 Utils.pressEnter();118 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>');119 equal(editor.selection.getRng(true).startContainer.nodeName, 'P');120});121test('Enter at end of EM inside P', function() {122 editor.setContent('<p><em>abc</em></p>');123 Utils.setSelection('em', 3);124 Utils.pressEnter();125 equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>| /g, ''), '<p><em>abc</em></p><p><em></em></p>');126 equal(editor.selection.getRng(true).startContainer.nodeName, 'EM');127});128test('Enter at middle of EM inside P', function() {129 editor.setContent('<p><em>abcd</em></p>');130 Utils.setSelection('em', 2);131 Utils.pressEnter();132 equal(editor.getContent(), '<p><em>ab</em></p><p><em>cd</em></p>');133 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'EM');134});135test('Enter at beginning EM inside P', function() {136 editor.setContent('<p><em>abc</em></p>');137 Utils.setSelection('em', 0);138 Utils.pressEnter();139 equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>| /g, ''), '<p><em></em></p><p><em>abc</em></p>');140 equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');141});142test('Enter at end of STRONG in EM inside P', function() {143 editor.setContent('<p><em><strong>abc</strong></em></p>');144 Utils.setSelection('strong', 3);145 Utils.pressEnter();146 equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>| /g, ''), '<p><em><strong>abc</strong></em></p><p><em><strong></strong></em></p>');147 equal(editor.selection.getRng(true).startContainer.nodeName, 'STRONG');148});149test('Enter at middle of STRONG in EM inside P', function() {150 editor.setContent('<p><em><strong>abcd</strong></em></p>');151 Utils.setSelection('strong', 2);152 Utils.pressEnter();153 equal(editor.getContent(), '<p><em><strong>ab</strong></em></p><p><em><strong>cd</strong></em></p>');154 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'STRONG');155});156test('Enter at beginning STRONG in EM inside P', function() {157 editor.setContent('<p><em><strong>abc</strong></em></p>');158 Utils.setSelection('strong', 0);159 Utils.pressEnter();160 equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>| /g, ''), '<p><em><strong></strong></em></p><p><em><strong>abc</strong></em></p>');161 equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');162});163test('Enter at beginning of P', function() {164 editor.setContent('<p>abc</p>');165 Utils.setSelection('p', 0);166 Utils.pressEnter();167 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>');168 equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');169});170test('Enter at middle of P with style, id and class attributes', function() {171 editor.setContent('<p id="a" class="b" style="color:#000">abcd</p>');172 Utils.setSelection('p', 2);173 Utils.pressEnter();174 equal(editor.getContent(), '<p id="a" class="b" style="color: #000;">ab</p><p class="b" style="color: #000;">cd</p>');175 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'P');176});177test('Enter at a range between H1 and P', function() {178 editor.setContent('<h1>abcd</h1><p>efgh</p>');179 Utils.setSelection('h1', 2, 'p', 2);180 Utils.pressEnter();181 equal(editor.getContent(), '<h1>abgh</h1>');182 equal(editor.selection.getNode().nodeName, 'H1');183});184test('Enter at end of H1 in HGROUP', function() {185 editor.setContent('<hgroup><h1>abc</h1></hgroup>');186 Utils.setSelection('h1', 3);187 Utils.pressEnter();188 equal(editor.getContent(), '<hgroup><h1>abc</h1><h1>\u00a0</h1></hgroup>');189 equal(editor.selection.getRng(true).startContainer.nodeName, 'H1');190});191test('Enter inside empty TD', function() {192 editor.getBody().innerHTML = '<table><tr><td></td></tr></table>';193 Utils.setSelection('td', 0);194 Utils.pressEnter();195 equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>| /g, ''), '<table><tbody><tr><td><p></p><p></p></td></tr></tbody></table>');196 equal(editor.selection.getNode().nodeName, 'P');197});198test('Shift+Enter inside STRONG inside TD with BR', function() {199 editor.getBody().innerHTML = '<table><tr><td>d <strong>e</strong><br></td></tr></table>';200 Utils.setSelection('strong', 1);201 Utils.pressEnter({shiftKey: true});202 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<table><tbody><tr><td>d <strong>e<br></strong><br></td></tr></tbody></table>');203 equal(editor.selection.getNode().nodeName, 'STRONG');204});205test('Enter inside middle of text node in body', function() {206 editor.getBody().innerHTML = 'abcd';207 Utils.setSelection('body', 2);208 Utils.pressEnter();209 equal(editor.getContent(), '<p>ab</p><p>cd</p>');210 equal(editor.selection.getNode().nodeName, 'P');211});212test('Enter inside at beginning of text node in body', function() {213 editor.getBody().innerHTML = 'abcd';214 Utils.setSelection('body', 0);215 Utils.pressEnter();216 equal(editor.getContent(), '<p>\u00a0</p><p>abcd</p>');217 equal(editor.selection.getNode().nodeName, 'P');218});219test('Enter inside at end of text node in body', function() {220 editor.getBody().innerHTML = 'abcd';221 Utils.setSelection('body', 4);222 Utils.pressEnter();223 equal(editor.getContent(), '<p>abcd</p><p>\u00a0</p>');224 equal(editor.selection.getNode().nodeName, 'P');225});226test('Enter inside empty body', function() {227 editor.getBody().innerHTML = '';228 Utils.setSelection('body', 0);229 Utils.pressEnter();230 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p>');231 equal(editor.selection.getNode().nodeName, 'P');232});233test('Enter inside empty li in beginning of ol', function() {234 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';235 Utils.setSelection('li', 0);236 Utils.pressEnter();237 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>');238 equal(editor.selection.getNode().nodeName, 'P');239});240test('Enter inside empty li at the end of ol', function() {241 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';242 Utils.setSelection('li:last', 0);243 Utils.pressEnter();244 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>');245 equal(editor.selection.getNode().nodeName, 'P');246});247test('Shift+Enter inside empty li in the middle of ol', function() {248 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>';249 Utils.setSelection('li:nth-child(2)', 0);250 Utils.pressEnter({shiftKey: true});251 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');252 equal(editor.selection.getNode().nodeName, 'P');253});254test('Shift+Enter inside empty li in beginning of ol', function() {255 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';256 Utils.setSelection('li', 0);257 Utils.pressEnter({shiftKey: true});258 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>');259 equal(editor.selection.getNode().nodeName, 'P');260});261test('Shift+Enter inside empty li at the end of ol', function() {262 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';263 Utils.setSelection('li:last', 0);264 Utils.pressEnter({shiftKey: true});265 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>');266 equal(editor.selection.getNode().nodeName, 'P');267});268test('Enter inside empty li in the middle of ol with forced_root_block: false', function() {269 editor.settings.forced_root_block = false;270 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>';271 Utils.setSelection('li:nth-child(2)', 0);272 Utils.pressEnter();273 equal(editor.getContent(), '<ol><li>a</li></ol><br /><ol><li>b</li></ol>');274 equal(editor.selection.getNode().nodeName, 'BODY');275});276test('Enter inside empty li in beginning of ol with forced_root_block: false', function() {277 editor.settings.forced_root_block = false;278 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';279 Utils.setSelection('li', 0);280 Utils.pressEnter();281 equal(editor.getContent(), '<br /><ol><li>a</li></ol>');282 equal(editor.selection.getNode().nodeName, 'BODY');283});284test('Enter inside empty li at the end of ol with forced_root_block: false', function() {285 editor.settings.forced_root_block = false;286 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';287 Utils.setSelection('li:last', 0);288 Utils.pressEnter();289 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<ol><li>a</li></ol><br>');290 equal(editor.selection.getNode().nodeName, 'BODY');291});292test('Enter inside empty li in the middle of ol', function() {293 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>';294 Utils.setSelection('li:nth-child(2)', 0);295 Utils.pressEnter();296 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');297 equal(editor.selection.getNode().nodeName, 'P');298});299// Nested lists in LI elements300test('Enter inside empty LI in beginning of OL in LI', function() {301 editor.getBody().innerHTML = Utils.trimBrsOnIE(302 '<ol>' +303 '<li>a' +304 '<ol>' +305 '<li><br></li>' +306 '<li>a</li>' +307 '</ol>' +308 '</li>' +309 '</ol>'310 );311 Utils.setSelection('li li', 0);312 editor.focus();313 Utils.pressEnter();314 equal(editor.getContent(),315 '<ol>' +316 '<li>a</li>' +317 '<li>' +318 '<ol>' +319 '<li>a</li>' +320 '</ol>' +321 '</li>' +322 '</ol>'323 );324 equal(editor.selection.getNode().nodeName, 'LI');325});326test('Enter inside empty LI in middle of OL in LI', function() {327 editor.getBody().innerHTML = Utils.trimBrsOnIE(328 '<ol>' +329 '<li>a' +330 '<ol>' +331 '<li>a</li>' +332 '<li><br></li>' +333 '<li>b</li>' +334 '</ol>' +335 '</li>' +336 '</ol>'337 );338 Utils.setSelection('li li:nth-child(2)', 0);339 editor.focus();340 Utils.pressEnter();341 equal(editor.getContent(),342 '<ol>' +343 '<li>a' +344 '<ol>' +345 '<li>a</li>' +346 '</ol>' +347 '</li>' +348 '<li>\u00a0' +349 '<ol>' +350 '<li>b</li>' +351 '</ol>' +352 '</li>' +353 '</ol>'354 );355 // Ignore on IE 7, 8 this is a known bug not worth fixing356 if (!tinymce.Env.ie || tinymce.Env.ie > 8) {357 equal(editor.selection.getNode().nodeName, 'LI');358 }359});360test('Enter inside empty LI in end of OL in LI', function() {361 editor.getBody().innerHTML = Utils.trimBrsOnIE(362 '<ol>' +363 '<li>a' +364 '<ol>' +365 '<li>a</li>' +366 '<li><br></li>' +367 '</ol>' +368 '</li>' +369 '</ol>'370 );371 Utils.setSelection('li li:last', 0);372 editor.focus();373 Utils.pressEnter();374 equal(editor.getContent(),375 '<ol>' +376 '<li>a' +377 '<ol>' +378 '<li>a</li>' +379 '</ol>' +380 '</li>' +381 '<li></li>' +382 '</ol>'383 );384 equal(editor.selection.getNode().nodeName, 'LI');385});386// Nested lists in OL elements387// Ignore on IE 7, 8 this is a known bug not worth fixing388if (!tinymce.Env.ie || tinymce.Env.ie > 8) {389 test('Enter before nested list', function() {390 editor.getBody().innerHTML = Utils.trimBrsOnIE(391 '<ol>' +392 '<li>a' +393 '<ul>' +394 '<li>b</li>' +395 '<li>c</li>' +396 '</ul>' +397 '</li>' +398 '</ol>'399 );400 Utils.setSelection('ol > li', 1);401 editor.focus();402 Utils.pressEnter();403 equal(editor.getContent(),404 '<ol>' +405 '<li>a</li>' +406 '<li>\u00a0' +407 '<ul>' +408 '<li>b</li>' +409 '<li>c</li>' +410 '</ul>' +411 '</li>' +412 '</ol>'413 );414 equal(editor.selection.getNode().nodeName, 'LI');415 });416}417test('Enter inside empty LI in beginning of OL in OL', function() {418 editor.getBody().innerHTML = Utils.trimBrsOnIE(419 '<ol>' +420 '<li>a</li>' +421 '<ol>' +422 '<li><br></li>' +423 '<li>a</li>' +424 '</ol>' +425 '</ol>'426 );427 Utils.setSelection('ol ol li', 0);428 editor.focus();429 Utils.pressEnter();430 equal(editor.getContent(),431 '<ol>' +432 '<li>a</li>' +433 '<li></li>' +434 '<ol>' +435 '<li>a</li>' +436 '</ol>' +437 '</ol>'438 );439 equal(editor.selection.getNode().nodeName, 'LI');440});441test('Enter inside empty LI in middle of OL in OL', function() {442 editor.getBody().innerHTML = Utils.trimBrsOnIE(443 '<ol>' +444 '<li>a</li>' +445 '<ol>' +446 '<li>a</li>' +447 '<li><br></li>' +448 '<li>b</li>' +449 '</ol>' +450 '</ol>'451 );452 Utils.setSelection('ol ol li:nth-child(2)', 0);453 editor.focus();454 Utils.pressEnter();455 equal(editor.getContent(),456 '<ol>' +457 '<li>a</li>' +458 '<ol>' +459 '<li>a</li>' +460 '</ol>' +461 '<li></li>' +462 '<ol>' +463 '<li>b</li>' +464 '</ol>' +465 '</ol>'466 );467 equal(editor.selection.getNode().nodeName, 'LI');468});469test('Enter inside empty LI in end of OL in OL', function() {470 editor.getBody().innerHTML = Utils.trimBrsOnIE(471 '<ol>' +472 '<li>a</li>' +473 '<ol>' +474 '<li>a</li>' +475 '<li><br></li>' +476 '</ol>' +477 '</ol>'478 );479 Utils.setSelection('ol ol li:last', 0);480 editor.focus();481 Utils.pressEnter();482 equal(editor.getContent(),483 '<ol>' +484 '<li>a</li>' +485 '<ol>' +486 '<li>a</li>' +487 '</ol>' +488 '<li></li>' +489 '</ol>'490 );491 equal(editor.selection.getNode().nodeName, 'LI');492});493test('Enter at beginning of first DT inside DL', function() {494 editor.getBody().innerHTML = '<dl><dt>a</dt></dl>';495 Utils.setSelection('dt', 0);496 Utils.pressEnter();497 equal(editor.getContent(), '<dl><dt>\u00a0</dt><dt>a</dt></dl>');498 equal(editor.selection.getNode().nodeName, 'DT');499});500test('Enter at beginning of first DD inside DL', function() {501 editor.getBody().innerHTML = '<dl><dd>a</dd></dl>';502 Utils.setSelection('dd', 0);503 Utils.pressEnter();504 equal(editor.getContent(), '<dl><dd>\u00a0</dd><dd>a</dd></dl>');505 equal(editor.selection.getNode().nodeName, 'DD');506});507test('Enter at beginning of middle DT inside DL', function() {508 editor.getBody().innerHTML = '<dl><dt>a</dt><dt>b</dt><dt>c</dt></dl>';509 Utils.setSelection('dt:nth-child(2)', 0);510 Utils.pressEnter();511 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt><dt>b</dt><dt>c</dt></dl>');512 equal(editor.selection.getNode().nodeName, 'DT');513});514test('Enter at beginning of middle DD inside DL', function() {515 editor.getBody().innerHTML = '<dl><dd>a</dd><dd>b</dd><dd>c</dd></dl>';516 Utils.setSelection('dd:nth-child(2)', 0);517 Utils.pressEnter();518 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd><dd>b</dd><dd>c</dd></dl>');519 equal(editor.selection.getNode().nodeName, 'DD');520});521test('Enter at end of last DT inside DL', function() {522 editor.getBody().innerHTML = '<dl><dt>a</dt></dl>';523 Utils.setSelection('dt', 1);524 Utils.pressEnter();525 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt></dl>');526 equal(editor.selection.getNode().nodeName, 'DT');527});528test('Enter at end of last DD inside DL', function() {529 editor.getBody().innerHTML = '<dl><dd>a</dd></dl>';530 Utils.setSelection('dd', 1);531 Utils.pressEnter();532 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd></dl>');533 equal(editor.selection.getNode().nodeName, 'DD');534});535test('Enter at end of last empty DT inside DL', function() {536 editor.getBody().innerHTML = '<dl><dt>a</dt><dt></dt></dl>';537 Utils.setSelection('dt:nth-child(2)', 0);538 Utils.pressEnter();539 equal(editor.getContent(), '<dl><dt>a</dt></dl><p>\u00a0</p>');540 equal(editor.selection.getNode().nodeName, 'P');541});542test('Enter at end of last empty DD inside DL', function() {543 editor.getBody().innerHTML = '<dl><dd>a</dd><dd></dd></dl>';544 Utils.setSelection('dd:nth-child(2)', 0);545 Utils.pressEnter();546 equal(editor.getContent(), '<dl><dd>a</dd></dl><p>\u00a0</p>');547 equal(editor.selection.getNode().nodeName, 'P');548});549test('Enter at beginning of P inside LI', function() {550 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';551 Utils.setSelection('p', 0);552 Utils.pressEnter();553 equal(editor.getContent(), '<ol><li></li><li><p>abcd</p></li></ol>');554 equal(editor.selection.getNode().nodeName, 'P');555});556test('Enter inside middle of P inside LI', function() {557 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';558 Utils.setSelection('p', 2);559 Utils.pressEnter();560 equal(editor.getContent(), '<ol><li><p>ab</p></li><li><p>cd</p></li></ol>');561 // Ignore on IE 7, 8 this is a known bug not worth fixing562 if (!tinymce.Env.ie || tinymce.Env.ie > 8) {563 equal(editor.selection.getNode().nodeName, 'P');564 }565});566test('Enter at end of P inside LI', function() {567 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';568 Utils.setSelection('p', 4);569 Utils.pressEnter();570 equal(editor.getContent(), '<ol><li><p>abcd</p></li><li></li></ol>');571 equal(editor.selection.getNode().nodeName, 'LI');572});573test('Shift+Enter at beginning of P inside LI', function() {574 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';575 Utils.setSelection('p', 0);576 Utils.pressEnter({shiftKey: true});577 equal(editor.getContent(), '<ol><li><p><br />abcd</p></li></ol>');578 equal(editor.selection.getNode().nodeName, 'P');579});580test('Shift+Enter inside middle of P inside LI', function() {581 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';582 Utils.setSelection('p', 2);583 Utils.pressEnter({shiftKey: true});584 equal(editor.getContent(), '<ol><li><p>ab<br />cd</p></li></ol>');585 equal(editor.selection.getNode().nodeName, 'P');586});587test('Shift+Enter at end of P inside LI', function() {588 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';589 Utils.setSelection('p', 4);590 Utils.pressEnter({shiftKey: true});591 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li><p>abcd</p></li></ol>' : '<ol><li><p>abcd<br /><br /></p></li></ol>');592 equal(editor.selection.getNode().nodeName, 'P');593});594test('Ctrl+Enter at beginning of P inside LI', function() {595 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';596 Utils.setSelection('p', 0);597 Utils.pressEnter({ctrlKey: true});598 equal(editor.getContent(), '<ol><li><p>\u00a0</p><p>abcd</p></li></ol>');599 equal(editor.selection.getNode().nodeName, 'P');600});601test('Ctrl+Enter inside middle of P inside LI', function() {602 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';603 Utils.setSelection('p', 2);604 Utils.pressEnter({ctrlKey: true});605 equal(editor.getContent(), '<ol><li><p>ab</p><p>cd</p></li></ol>');606 equal(editor.selection.getNode().nodeName, 'P');607});608test('Ctrl+Enter at end of P inside LI', function() {609 editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';610 Utils.setSelection('p', 4);611 Utils.pressEnter({ctrlKey: true});612 equal(editor.getContent(), '<ol><li><p>abcd</p><p>\u00a0</p></li></ol>');613 equal(editor.selection.getNode().nodeName, 'P');614});615test('Enter in the middle of text in P with forced_root_block set to false', function() {616 editor.settings.forced_root_block = false;617 editor.getBody().innerHTML = '<p>abc</p>';618 Utils.setSelection('p', 2);619 Utils.pressEnter();620 equal(editor.getContent(), '<p>ab<br />c</p>');621});622test('Enter at the end of text in P with forced_root_block set to false', function() {623 editor.settings.forced_root_block = false;624 editor.getBody().innerHTML = '<p>abc</p>';625 Utils.setSelection('p', 3);626 Utils.pressEnter();627 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abc<br></p>' : '<p>abc<br><br></p>');628});629test('Enter at the middle of text in BODY with forced_root_block set to false', function() {630 editor.settings.forced_root_block = false;631 editor.getBody().innerHTML = 'abcd';632 Utils.setSelection('body', 2);633 editor.focus();634 Utils.pressEnter();635 equal(Utils.cleanHtml(editor.getBody().innerHTML), 'ab<br>cd');636});637test('Enter at the beginning of text in BODY with forced_root_block set to false', function() {638 editor.settings.forced_root_block = false;639 editor.getBody().innerHTML = 'abcd';640 Utils.setSelection('body', 0);641 editor.focus();642 Utils.pressEnter();643 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<br>abcd');644});645test('Enter at the end of text in BODY with forced_root_block set to false', function() {646 editor.settings.forced_root_block = false;647 editor.getBody().innerHTML = 'abcd';648 Utils.setSelection('body', 4);649 editor.focus();650 Utils.pressEnter();651 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? 'abcd<br>' : 'abcd<br><br>');652});653test('Enter in empty P at the end of a blockquote and end_container_on_empty_block: true', function() {654 editor.settings.end_container_on_empty_block = true;655 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p></blockquote>' : '<blockquote><p>abc</p><p><br></p></blockquote>';656 Utils.setSelection('p:last', 0);657 Utils.pressEnter();658 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p>');659});660test('Enter in empty P at the beginning of a blockquote and end_container_on_empty_block: true', function() {661 editor.settings.end_container_on_empty_block = true;662 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p></p><p>abc</p></blockquote>' : '<blockquote><p><br></p><p>abc</p></blockquote>';663 Utils.setSelection('p', 0);664 Utils.pressEnter();665 equal(editor.getContent(), '<p>\u00a0</p><blockquote><p>abc</p></blockquote>');666});667test('Enter in empty P at in the middle of a blockquote and end_container_on_empty_block: true', function() {668 editor.settings.end_container_on_empty_block = true;669 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p><p>123</p></blockquote>' : '<blockquote><p>abc</p><p><br></p><p>123</p></blockquote>';670 Utils.setSelection('p:nth-child(2)', 0);671 Utils.pressEnter();672 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p><blockquote><p>123</p></blockquote>');673});674test('Enter inside empty P with empty P siblings', function() {675 // Tests that a workaround for an IE bug is working correctly676 editor.getBody().innerHTML = '<p></p><p></p><p>X</p>';677 Utils.setSelection('p', 0);678 Utils.pressEnter();679 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p><p>\u00a0</p><p>X</p>');680});681test('Enter at end of H1 with forced_root_block_attrs', function() {682 editor.settings.forced_root_block_attrs = {"class": "class1"};683 editor.getBody().innerHTML = '<h1>a</h1>';684 Utils.setSelection('h1', 1);685 Utils.pressEnter();686 equal(editor.getContent(), '<h1>a</h1><p class="class1">\u00a0</p>');687});688test('Shift+Enter at beginning of P', function() {689 editor.getBody().innerHTML = '<p>abc</p>';690 Utils.setSelection('p', 0);691 Utils.pressEnter({shiftKey: true});692 equal(editor.getContent(), '<p><br />abc</p>');693});694test('Shift+Enter in the middle of P', function() {695 editor.getBody().innerHTML = '<p>abcd</p>';696 Utils.setSelection('p', 2);697 Utils.pressEnter({shiftKey: true});698 equal(editor.getContent(), '<p>ab<br />cd</p>');699});700test('Shift+Enter at the end of P', function() {701 editor.getBody().innerHTML = '<p>abcd</p>';702 Utils.setSelection('p', 4);703 Utils.pressEnter({shiftKey: true});704 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abcd</p>' : '<p>abcd<br /><br /></p>');705});706test('Shift+Enter in the middle of B with a BR after it', function() {707 editor.getBody().innerHTML = '<p><b>abcd</b><br></p>';708 Utils.setSelection('b', 2);709 Utils.pressEnter({shiftKey: true});710 equal(editor.getContent(), '<p><b>ab<br />cd</b></p>');711});712test('Shift+Enter at the end of B with a BR after it', function() {713 editor.getBody().innerHTML = '<p><b>abcd</b><br></p>';714 Utils.setSelection('b', 4);715 Utils.pressEnter({shiftKey: true});716 equal(editor.getContent(), '<p><b>abcd<br /></b></p>');717});718test('Enter in beginning of PRE', function() {719 editor.getBody().innerHTML = '<pre>abc</pre>';720 Utils.setSelection('pre', 0);721 Utils.pressEnter();722 equal(editor.getContent(), '<pre><br />abc</pre>');723});724test('Enter in the middle of PRE', function() {725 editor.getBody().innerHTML = '<pre>abcd</pre>';726 Utils.setSelection('pre', 2);727 Utils.pressEnter();728 equal(editor.getContent(), '<pre>ab<br />cd</pre>');729});730test('Enter at the end of PRE', function() {731 editor.getBody().innerHTML = '<pre>abcd</pre>';732 Utils.setSelection('pre', 4);733 Utils.pressEnter();734 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<pre>abcd</pre>' : '<pre>abcd<br /><br /></pre>');735});736test('Enter in beginning of PRE and br_in_pre: false', function() {737 editor.settings.br_in_pre = false;738 editor.getBody().innerHTML = '<pre>abc</pre>';739 Utils.setSelection('pre', 0);740 Utils.pressEnter();741 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>');742});743test('Enter in the middle of PRE and br_in_pre: false', function() {744 editor.settings.br_in_pre = false;745 editor.getBody().innerHTML = '<pre>abcd</pre>';746 Utils.setSelection('pre', 2);747 Utils.pressEnter();748 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>');749});750test('Enter at the end of PRE and br_in_pre: false', function() {751 editor.settings.br_in_pre = false;752 editor.getBody().innerHTML = '<pre>abcd</pre>';753 Utils.setSelection('pre', 4);754 Utils.pressEnter();755 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>');756});757test('Shift+Enter in beginning of PRE', function() {758 editor.getBody().innerHTML = '<pre>abc</pre>';759 Utils.setSelection('pre', 0);760 Utils.pressEnter({shiftKey: true});761 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>');762});763test('Shift+Enter in the middle of PRE', function() {764 editor.getBody().innerHTML = '<pre>abcd</pre>';765 Utils.setSelection('pre', 2);766 Utils.pressEnter({shiftKey: true});767 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>');768});769test('Shift+Enter at the end of PRE', function() {770 editor.getBody().innerHTML = '<pre>abcd</pre>';771 Utils.setSelection('pre', 4);772 Utils.pressEnter({shiftKey: true});773 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>');774});775test('Shift+Enter in beginning of P with forced_root_block set to false', function() {776 editor.settings.forced_root_block = false;777 editor.getBody().innerHTML = '<p>abc</p>';778 Utils.setSelection('p', 0);779 Utils.pressEnter({shiftKey: true});780 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>');781});782test('Shift+Enter in middle of P with forced_root_block set to false', function() {783 editor.settings.forced_root_block = false;784 editor.getBody().innerHTML = '<p>abcd</p>';785 Utils.setSelection('p', 2);786 Utils.pressEnter({shiftKey: true});787 equal(editor.getContent(), '<p>ab</p><p>cd</p>');788});789test('Shift+Enter at the end of P with forced_root_block set to false', function() {790 editor.settings.forced_root_block = false;791 editor.getBody().innerHTML = '<p>abc</p>';792 Utils.setSelection('p', 3);793 Utils.pressEnter({shiftKey: true});794 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>');795});796test('Shift+Enter in body with forced_root_block set to false', function() {797 editor.settings.forced_root_block = false;798 editor.getBody().innerHTML = 'abcd';799 var rng = editor.dom.createRng();800 rng.setStart(editor.getBody().firstChild, 2);801 rng.setEnd(editor.getBody().firstChild, 2);802 editor.selection.setRng(rng);803 Utils.pressEnter({shiftKey: true});804 equal(editor.getContent(), '<p>ab</p><p>cd</p>');805});806test('Enter at the end of DIV layer', function() {807 editor.settings.br_in_pre = false;808 editor.setContent('<div style="position: absolute; top: 1px; left: 2px;">abcd</div>');809 Utils.setSelection('div', 4);810 Utils.pressEnter();811 equal(editor.getContent(), '<div style="position: absolute; top: 1px; left: 2px;"><p>abcd</p><p>\u00a0</p></div>');812});813test('Enter in div inside contentEditable:false div', function() {814 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div>abcd</div></div>';815 Utils.setSelection('div div', 2);816 Utils.pressEnter();817 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div>abcd</div></div>');818});819test('Enter in div with contentEditable:true inside contentEditable:false div', function() {820 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true">abcd</div></div>';821 Utils.setSelection('div div', 2);822 Utils.pressEnter();823 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><p>ab</p><p>cd</p></div></div>');824});825test('Enter in span with contentEditable:true inside contentEditable:false div', function() {826 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';827 Utils.setSelection('span', 2);828 Utils.pressEnter();829 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>');830});831test('Shift+Enter in span with contentEditable:true inside contentEditable:false div', function() {832 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';833 Utils.setSelection('span', 2);834 Utils.pressEnter({shiftKey: true});835 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">ab<br>cd</span></div>');836});837test('Enter in span with contentEditable:true inside contentEditable:false div and forced_root_block: false', function() {838 editor.settings.forced_root_block = false;839 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';840 Utils.setSelection('span', 2);841 Utils.pressEnter();842 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">ab<br>cd</span></div>');843});844test('Enter in em within contentEditable:true div inside contentEditable:false div', function() {845 editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><em>abcd</em></div></div>';846 Utils.setSelection('em', 2);847 Utils.pressEnter();848 equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><p><em>ab</em></p><p><em>cd</em></p></div></div>');849});850test('Enter at end of text in a span inside a P and keep_styles: false', function() {851 editor.settings.keep_styles = false;852 editor.getBody().innerHTML = '<p><em><span style="font-size: 13px;">X</span></em></p>';853 Utils.setSelection('span', 1);854 Utils.pressEnter();855 equal(editor.getContent(), '<p><em><span style="font-size: 13px;">X</span></em></p><p>\u00a0</p>');856});857test('Shift+enter in LI when forced_root_block: false', function() {858 editor.settings.forced_root_block = false;859 editor.getBody().innerHTML = '<ul><li>text</li></ul>';860 Utils.setSelection('li', 2);861 Utils.pressEnter({shiftKey: true});862 equal(editor.getContent(), '<ul><li>te<br />xt</li></ul>');863});864test('Enter when forced_root_block: false and force_p_newlines: true', function() {865 editor.settings.forced_root_block = false;866 editor.settings.force_p_newlines = true;867 editor.getBody().innerHTML = 'text';868 Utils.setSelection('body', 2);869 Utils.pressEnter();870 equal(editor.getContent(), '<p>te</p><p>xt</p>');871});872test('Enter at end of br line', function() {873 editor.settings.forced_root_block = false;874 editor.settings.force_p_newlines = true;875 editor.getBody().innerHTML = '<p>a<br>b</p>';876 Utils.setSelection('p', 1);877 Utils.pressEnter();878 equal(editor.getContent(), '<p>a</p><p><br />b</p>');879 var rng = editor.selection.getRng(true);880 equal(rng.startContainer.nodeName, 'P');881 equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'BR');882});883// Ignore on IE 7, 8 this is a known bug not worth fixing884if (!tinymce.Env.ie || tinymce.Env.ie > 8) {885 test('Enter before BR between DIVs', function() {886 editor.getBody().innerHTML = '<div>a<span>b</span>c</div><br /><div>d</div>';887 var rng = editor.dom.createRng();888 rng.setStartBefore(editor.dom.select('br')[0]);889 rng.setEndBefore(editor.dom.select('br')[0]);890 editor.selection.setRng(rng);891 Utils.pressEnter();892 equal(editor.getContent(), '<div>a<span>b</span>c</div><p>\u00a0</p><p>\u00a0</p><div>d</div>');893 });894}895// Only test these on modern browsers896if (window.getSelection) {897 test('Enter behind table element', function() {898 var rng = editor.dom.createRng();899 editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table>';900 rng.setStartAfter(editor.getBody().lastChild);901 rng.setEndAfter(editor.getBody().lastChild);902 editor.selection.setRng(rng);903 Utils.pressEnter();904 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p>');905 });906 test('Enter before table element', function() {907 var rng = editor.dom.createRng();908 editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table>';909 rng.setStartBefore(editor.getBody().lastChild);910 rng.setEndBefore(editor.getBody().lastChild);911 editor.selection.setRng(rng);912 Utils.pressEnter();913 equal(editor.getContent(), '<p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');914 });915 test('Enter behind table followed by a p', function() {916 var rng = editor.dom.createRng();917 editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table><p>x</p>';918 rng.setStartAfter(editor.getBody().firstChild);919 rng.setEndAfter(editor.getBody().firstChild);920 editor.selection.setRng(rng);921 Utils.pressEnter();922 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p><p>x</p>');923 });924 test('Enter before table element preceded by a p', function() {925 var rng = editor.dom.createRng();926 editor.getBody().innerHTML = '<p>x</p><table><tbody><td>x</td></tbody></table>';927 rng.setStartBefore(editor.getBody().lastChild);928 rng.setStartBefore(editor.getBody().lastChild);929 editor.selection.setRng(rng);930 Utils.pressEnter();931 equal(editor.getContent(), '<p>x</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');932 });933 test('Enter twice before table element', function(){934 var rng = editor.dom.createRng();935 editor.getBody().innerHTML = '<table><tbody><tr><td>x</td></tr></tbody></table>';936 rng.setStartBefore(editor.getBody().lastChild);937 rng.setEndBefore(editor.getBody().lastChild);938 editor.selection.setRng(rng);939 Utils.pressEnter();940 Utils.pressEnter();941 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');942 });943 test('Enter after span with space', function() {944 editor.setContent('<p><b>abc </b></p>');945 Utils.setSelection('b', 3);946 Utils.pressEnter();947 equal(editor.getContent(), '<p><b>abc</b></p><p>\u00a0</p>');948 var rng = editor.selection.getRng(true);949 equal(rng.startContainer.nodeName, 'B');950 notEqual(rng.startContainer.data, ' ');951 });...
Using AI Code Generation
1var rootview = ui("$");2var dojs = sm("dojs");3dojs.style.css(ui("do_Button_1"), "dynamicButton");4dojs.style.css(ui("do_Button_2"), "dynamicButton");5dojs.style.css(ui("do_Button_3"), "dynamicButton");6dojs.style.css(ui("do_Button_4"), "dynamicButton");7dojs.style.css(ui("do_Button_5"), "dynamicButton");8dojs.style.css(ui("do_Button_6"), "dynamicButton");9dojs.style.css(ui("do_Button_7"), "dynamicButton");10dojs.style.css(ui("do_Button_8"), "dynamicButton");11dojs.style.css(ui("do_Button_9"), "dynamicButton");12dojs.style.css(ui("do_Button_0"), "dynamicButton");13dojs.style.css(ui("do_Button_dot"), "dynamicButton");14dojs.style.css(ui("do_Button_clear"), "dynamicButton");15dojs.style.css(ui("do_Button_back"), "dynamicButton");16dojs.style.css(ui("do_Button_plus"), "dynamicButton");17dojs.style.css(ui("do_Button_minus"), "dynamicButton");18dojs.style.css(ui("do_Button_multiply"), "dynamicButton");19dojs.style.css(ui("do_Button_divide"), "dynamicButton");20dojs.style.css(ui("do_Button_equal"), "dynamicButton");21dojs.style.css(ui("do_Button_1"), "dynamicButton");22dojs.style.css(ui("do_Button_left"), "dynamicButton");23dojs.style.css(ui("do_Button_right"), "dynamicButton");24dojs.style.css(ui("do_Button_sin"), "dynamicButton");25dojs.style.css(ui("do_Button_cos"), "dynamicButton");26dojs.style.css(ui("do_Button_tan"), "dynamicButton");27dojs.style.css(ui("do_Button_ln"), "dynamicButton");28dojs.style.css(ui("do_Button_log"), "dynamicButton");29dojs.style.css(ui("do_Button_pi"), "dynamicButton");30dojs.style.css(ui("do_Button_e"), "dynamicButton");31dojs.style.css(ui("do_Button_factorial"), "dynamicButton");32dojs.style.css(ui("do_Button_power"), "dynamicButton");33dojs.style.css(ui("do_Button_square"), "dynamicButton");34dojs.style.css(ui("do_Button_cuberoot"), "dynamicButton");35dojs.style.css(ui("do_Button_square_root"), "dynamicButton");
Using AI Code Generation
1this.root.pressEnter();2this.root.child.pressEnter();3this.root.pressEnter();4this.root.child.pressEnter();5this.root.pressEnter();6this.root.child.pressEnter();7this.root.pressEnter();8this.root.child.pressEnter();9this.root.pressEnter();10this.root.child.pressEnter();11this.root.pressEnter();12this.root.child.pressEnter();13this.root.pressEnter();14this.root.child.pressEnter();15this.root.pressEnter();16this.root.child.pressEnter();17this.root.pressEnter();18this.root.child.pressEnter();19this.root.pressEnter();20this.root.child.pressEnter();21this.root.pressEnter();22this.root.child.pressEnter();23this.root.pressEnter();24this.root.child.pressEnter();25this.root.pressEnter();26this.root.child.pressEnter();
Using AI Code Generation
1var rootClass = require('./rootClass');2rootClass.pressEnter();3var rootClass = {4 pressEnter: function(){5 console.log('Enter pressed');6 }7}8module.exports = rootClass;
Using AI Code Generation
1this.pressEnter();2this.pressEnter();3this.pressEnter();4this.pressEnter();5this.pressEnter();6this.pressEnter();7this.pressEnter();8this.pressEnter();9this.pressEnter();10this.pressEnter();
Using AI Code Generation
1this.$root.pressEnter();2export default {3 methods: {4 pressEnter() {5 console.log('press enter')6 }7 }8}9How can I use the method pressEnter() in the root component in the child component?10methods: {11 pressEnter() {12 console.log('press enter')13 }14}15methods: {16 pressEnter() {17 console.log('press enter')18 }19}20methods: {21 pressEnter() {22 console.log('press enter')23 }24}25methods: {26 pressEnter() {27 console.log('press enter')28 }29}30methods: {31 pressEnter() {32 console.log('press enter')33 }34}35methods: {36 pressEnter() {37 console.log('press enter')38 }39}40methods: {41 pressEnter() {42 console.log('press enter')43 }44}45methods: {46 pressEnter() {47 console.log('press enter')48 }49}
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!!