|
1 |
| - |
2 | 1 | /** @format */
|
3 | 2 |
|
4 | 3 | /**
|
@@ -45,32 +44,32 @@ describe( 'RootComponent', () => {
|
45 | 44 | it( 'Code block is a TextInput', () => {
|
46 | 45 | const app = renderer.create( <RootComponent /> );
|
47 | 46 |
|
48 |
| - app.root.findAllByType( BlockListBlock ) |
49 |
| - .forEach( ( blockHolder ) => { |
50 |
| - if ( 'core/code' === blockHolder.props.name ) { |
51 |
| - // TODO: hardcoded indices are ugly and error prone. Can we do better here? |
52 |
| - const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]; |
53 |
| - const contentComponent = blockHolderContainer.children[ 0 ]; |
54 |
| - const inputComponent = |
55 |
| - contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ] |
56 |
| - .children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]; |
| 47 | + app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => { |
| 48 | + if ( 'core/code' === blockHolder.props.name ) { |
| 49 | + // TODO: hardcoded indices are ugly and error prone. Can we do better here? |
| 50 | + const blockHolderContainer = |
| 51 | + blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]; |
| 52 | + const contentComponent = blockHolderContainer.children[ 0 ]; |
| 53 | + const inputComponent = |
| 54 | + contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ] |
| 55 | + .children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ] |
| 56 | + .children[ 0 ]; |
57 | 57 |
|
58 |
| - expect( inputComponent.type ).toBe( 'TextInput' ); |
59 |
| - } |
60 |
| - } ); |
| 58 | + expect( inputComponent.type ).toBe( 'TextInput' ); |
| 59 | + } |
| 60 | + } ); |
61 | 61 |
|
62 | 62 | app.unmount();
|
63 | 63 | } );
|
64 | 64 |
|
65 | 65 | it( 'Heading block test', () => {
|
66 | 66 | const app = renderer.create( <RootComponent /> );
|
67 |
| - app.root.findAllByType( BlockListBlock ) |
68 |
| - .forEach( ( blockHolder ) => { |
69 |
| - if ( 'core/heading' === blockHolder.props.name ) { |
70 |
| - const aztec = blockHolder.findByType( 'RCTAztecView' ); |
71 |
| - expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' ); |
72 |
| - } |
73 |
| - } ); |
| 67 | + app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => { |
| 68 | + if ( 'core/heading' === blockHolder.props.name ) { |
| 69 | + const aztec = blockHolder.findByType( 'RCTAztecView' ); |
| 70 | + expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' ); |
| 71 | + } |
| 72 | + } ); |
74 | 73 | app.unmount();
|
75 | 74 | } );
|
76 | 75 | } );
|
0 commit comments