Skip to content

Commit 838dae8

Browse files
committed
implement tests for Bootstrap 5 content with Bootstrap 4
1 parent 1def646 commit 838dae8

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

e2e-tests/row/row-block-backwards-compat.spec.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ import {
1010
import rowContent100 from './row-block-content/row-1.0.0';
1111
import rowContent110 from './row-block-content/row-1.1.0';
1212
import rowContent140 from './row-block-content/row-1.4.0';
13+
import rowContentBootstrap5 from './row-block-content/row-bootstrap5';
1314
import {
1415
testVersion100RowFeatures,
1516
testVersion110RowFeatures,
1617
testVersion100ColumnFeatures,
1718
testVersion110ColumnFeatures,
1819
testVersion140ColumnFeatures,
1920
} from './feature-tests';
20-
import { ensureSidebarOpened } from '../helper';
21+
import {
22+
ensureSidebarOpened,
23+
getInputValueByLabel,
24+
openSidebarPanelWithTitle,
25+
} from '../helper';
26+
import { selectColumnBlock } from '../column/column-helper';
2127

2228
describe( 'row block backwards compatibility', () => {
2329
beforeEach( async () => {
@@ -100,4 +106,30 @@ describe( 'row block backwards compatibility', () => {
100106
await testVersion140ColumnFeatures();
101107
} );
102108
/* eslint-enable jest/expect-expect */
109+
110+
it( 'Bootstrap 4 works with Bootstrap 5 settings', async () => {
111+
await setPostContent( rowContentBootstrap5 );
112+
await ensureSidebarOpened();
113+
114+
// Select 1. Column of 1. Row
115+
await selectColumnBlock( 0, 0 );
116+
117+
// Check if row block could be inserted without error
118+
expect(
119+
await page.$(
120+
'.block-editor-block-list__block[data-type="wp-bootstrap-blocks/row"]'
121+
)
122+
).not.toBeNull();
123+
expect(
124+
await page.$$(
125+
'.block-editor-block-list__block[data-type="wp-bootstrap-blocks/column"]'
126+
)
127+
).toHaveLength( 2 );
128+
129+
// Check if Bootstrap 4 values are set in inspector controls
130+
await openSidebarPanelWithTitle( 'Column size' );
131+
expect( await getInputValueByLabel( 'Md Column count' ) ).toMatch(
132+
'8'
133+
);
134+
} );
103135
} );
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default `
2+
<!-- wp:wp-bootstrap-blocks/row {"horizontalGutters":"gx-3","verticalGutters":"gy-5"} -->
3+
<!-- wp:wp-bootstrap-blocks/column {"sizeXxl":2,"sizeMd":8} /-->
4+
5+
<!-- wp:wp-bootstrap-blocks/column {"sizeMd":7,"equalWidthXxl":true} /-->
6+
<!-- /wp:wp-bootstrap-blocks/row -->
7+
`;

0 commit comments

Comments
 (0)