|
3 | 3 | * Released under MIT see LICENSE.txt in the project root for license information. |
4 | 4 | * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net |
5 | 5 | */ |
| 6 | + |
6 | 7 | describe('Source code test', function () { |
7 | 8 | describe('Init', function () { |
8 | 9 | it('After init container must has source editor container', function (done) { |
@@ -443,23 +444,29 @@ describe('Source code test', function () { |
443 | 444 | sourceEditor: 'ace', |
444 | 445 | beautifyHTML: false, |
445 | 446 | events: { |
446 | | - sourceEditorReady: function (jodit) { |
| 447 | + afterInit: function (jodit) { |
447 | 448 | try { |
448 | 449 | jodit.s.focus(); |
449 | 450 | jodit.value = |
450 | 451 | '<p>test <span>test|</span> test</p>'; |
| 452 | + |
| 453 | + jodit.e.on('sourceEditorReady', async () => { |
| 454 | + try { |
| 455 | + expect(jodit.value).equals( |
| 456 | + '<p>test <span>testloop</span> test</p>' |
| 457 | + ); |
| 458 | + mockPromise(); |
| 459 | + |
| 460 | + done(); |
| 461 | + } catch (e) { |
| 462 | + done(e); |
| 463 | + } |
| 464 | + }); |
451 | 465 | setCursorToChar(jodit); |
452 | 466 | jodit.setMode(Jodit.MODE_SOURCE); |
453 | | - |
454 | 467 | jodit.s.insertHTML('loop'); |
455 | | - |
456 | | - expect(jodit.value).equals( |
457 | | - '<p>test <span>testloop</span> test</p>' |
458 | | - ); |
459 | | - mockPromise(); |
460 | | - |
461 | | - done(); |
462 | 468 | } catch (e) { |
| 469 | + console.error(e); |
463 | 470 | done(e); |
464 | 471 | } |
465 | 472 | } |
@@ -514,16 +521,19 @@ describe('Source code test', function () { |
514 | 521 | await editor.async.requestIdlePromise(); |
515 | 522 | editor.setMode(Jodit.MODE_SOURCE); |
516 | 523 | await editor.async.requestIdlePromise(); |
517 | | - |
518 | | - expect(sortAttributes(editor.value)).equals( |
| 524 | + expect( |
| 525 | + sortAttributes(editor.value).replace(/\n/g, '') |
| 526 | + ).equals( |
519 | 527 | '<p>some text<script async="" id="cr-embed-c8ea384249b100dd506fab87" src="https://post.crowdriff.com/js/crowdriff.js" type="text/javascript"></script></p>' |
520 | 528 | ); |
521 | 529 |
|
522 | 530 | await editor.async.requestIdlePromise(); |
523 | 531 | editor.setMode(Jodit.MODE_WYSIWYG); |
524 | 532 | await editor.async.requestIdlePromise(); |
525 | 533 |
|
526 | | - expect(sortAttributes(editor.value)).equals( |
| 534 | + expect( |
| 535 | + sortAttributes(editor.value).replace(/\n/g, '') |
| 536 | + ).equals( |
527 | 537 | '<p>some text<script async="" id="cr-embed-c8ea384249b100dd506fab87" src="https://post.crowdriff.com/js/crowdriff.js" type="text/javascript"></script></p>' |
528 | 538 | ); |
529 | 539 | }); |
|
0 commit comments