()
| 1406 | |
| 1407 | describe( 'semaphores', () => { |
| 1408 | const testSemaphoreForWatchdog = () => { |
| 1409 | it( 'should assign properly `data` property to editor even if it is still mounting', async () => { |
| 1410 | const deferInitialization = createDefer(); |
| 1411 | |
| 1412 | class SlowEditor extends MockEditor { |
| 1413 | constructor( element, config ) { |
| 1414 | super( element, config ); |
| 1415 | |
| 1416 | let value = config.initialData || ''; |
| 1417 | |
| 1418 | this.data = { |
| 1419 | get() { |
| 1420 | return value; |
| 1421 | }, |
| 1422 | |
| 1423 | set( newValue ) { |
| 1424 | value = newValue; |
| 1425 | } |
| 1426 | }; |
| 1427 | } |
| 1428 | |
| 1429 | public static async create( ...args: ConstructorParameters<typeof SlowEditor> ) { |
| 1430 | await deferInitialization.promise; |
| 1431 | |
| 1432 | return new SlowEditor( ...args ); |
| 1433 | } |
| 1434 | } |
| 1435 | |
| 1436 | const MockSlowEditor = SlowEditor as any; |
| 1437 | let editor: any = null; |
| 1438 | |
| 1439 | const component = render( |
| 1440 | <CKEditor |
| 1441 | editor={MockSlowEditor} |
| 1442 | config={{ |
| 1443 | initialData: '1' |
| 1444 | }} |
| 1445 | onReady={ resolvedEditor => { |
| 1446 | editor = resolvedEditor; |
| 1447 | } } |
| 1448 | /> |
| 1449 | ); |
| 1450 | |
| 1451 | await timeout( 100 ); |
| 1452 | |
| 1453 | component.rerender( |
| 1454 | <CKEditor |
| 1455 | data='Hello World' |
| 1456 | editor={MockSlowEditor} |
| 1457 | config={{ |
| 1458 | initialData: '1' |
| 1459 | }} |
| 1460 | onReady={ resolvedEditor => { |
| 1461 | editor = resolvedEditor; |
| 1462 | } } |
| 1463 | /> |
| 1464 | ); |
| 1465 |
nothing calls this directly
no test coverage detected
searching dependent graphs…