Skip to content

Commit a3885ed

Browse files
committed
set default bootstrap version to 5
1 parent 26a67e9 commit a3885ed

22 files changed

Lines changed: 260 additions & 314 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The version can be selected in the plugin settings (Settings > Bootstrap Blocks)
7070
* Bootstrap 4 (default): `define( 'WP_BOOTSTRAP_BLOCKS_BOOTSTRAP_VERSION', '4' );`
7171
* Bootstrap 5: `define( 'WP_BOOTSTRAP_BLOCKS_BOOTSTRAP_VERSION', '5' );`
7272

73-
Possible values right now are `'4'` or `'5'`. By default Bootstrap version **4** is selected.
73+
Possible values right now are `'4'` or `'5'`. By default Bootstrap version **5** is selected.
7474

7575
## CSS Grid
7676

cypress/e2e/column/column-block.cy.js

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,32 +150,46 @@ describe( 'Column Block', () => {
150150
cy.postContentMatchesSnapshot();
151151
} );
152152

153-
it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
153+
// Bootstrap 5 specific options
154+
155+
it( 'Should display xxl breakpoint options', () => {
154156
cy.insertRowBlock();
155157
cy.ensureSidebarOpened();
156158

157159
// Select first column block
158160
cy.selectColumnBlock();
159161
cy.openSidebarPanelWithTitle( 'Column size' );
160162

161-
// Xl column count option should exist
162-
cy.xpath(
163-
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xl Column count")]'
164-
).should( 'exist' );
165-
166-
// Xxl column count option should not exist
163+
// Xxl column count option should exist
167164
cy.xpath(
168165
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xxl Column count")]'
169-
).should( 'not.exist' );
170-
171-
// Xl equal-width option should exist
172-
cy.xpath(
173-
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xl equal-width")]'
174166
).should( 'exist' );
175167

176-
// Xxl equal-width option should not exist
168+
// Xxl equal-width option should exist
177169
cy.xpath(
178170
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xxl equal-width")]'
179-
).should( 'not.exist' );
171+
).should( 'exist' );
172+
} );
173+
174+
it( 'Should be possible to select column size for xxl breakpoint', () => {
175+
cy.insertRowBlock();
176+
cy.ensureSidebarOpened();
177+
178+
// Select first column block
179+
cy.selectColumnBlock();
180+
cy.openSidebarPanelWithTitle( 'Column size' );
181+
182+
// Change column count
183+
cy.get(
184+
'input.components-input-control__input[aria-label="Xxl Column count"]'
185+
).type( '2' );
186+
cy.get( '[data-type="wp-bootstrap-blocks/column"]' )
187+
.first()
188+
.should( 'have.attr', 'data-size-xxl', '2' );
189+
190+
// Enable column equal-width
191+
cy.clickElementByText( 'label', 'Xxl equal-width' );
192+
193+
cy.postContentMatchesSnapshot();
180194
} );
181195
} );
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/// <reference types="Cypress" />
2+
3+
describe( 'Column Block Bootstrap 4', () => {
4+
before( () => {
5+
cy.loginUser();
6+
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
7+
} );
8+
9+
after( () => {
10+
cy.loginUser();
11+
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
12+
} );
13+
14+
beforeEach( () => {
15+
cy.loginUser();
16+
cy.createNewPost();
17+
} );
18+
19+
it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
20+
cy.insertRowBlock();
21+
cy.ensureSidebarOpened();
22+
23+
// Select first column block
24+
cy.selectColumnBlock();
25+
cy.openSidebarPanelWithTitle( 'Column size' );
26+
27+
// Xl column count option should exist
28+
cy.xpath(
29+
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xl Column count")]'
30+
).should( 'exist' );
31+
32+
// Xxl column count option should not exist
33+
cy.xpath(
34+
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xxl Column count")]'
35+
).should( 'not.exist' );
36+
37+
// Xl equal-width option should exist
38+
cy.xpath(
39+
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xl equal-width")]'
40+
).should( 'exist' );
41+
42+
// Xxl equal-width option should not exist
43+
cy.xpath(
44+
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xxl equal-width")]'
45+
).should( 'not.exist' );
46+
} );
47+
} );

cypress/e2e/column/column-bootstrap-v5.cy.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

cypress/e2e/column/column-filters-bootstrap-v5.cy.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

cypress/e2e/column/column-filters.cy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ describe( 'Column Block Filters', () => {
8888
'Align content bottom'
8989
);
9090

91+
// Xxl Columm size value should be set
92+
cy.openSidebarPanelWithTitle( 'Column size' );
93+
cy.getInputByLabel( 'Xxl Column count' ).should( 'have.value', '5' );
94+
9195
// Check if attributes are set correctly
9296
cy.postContentMatchesSnapshot();
9397
} );

cypress/e2e/container/container-block.cy.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,20 @@ describe( 'Container Block', () => {
4747
cy.postContentMatchesSnapshot();
4848
} );
4949

50-
it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
50+
// Bootstrap 5 specific options
51+
52+
it( 'Should display xxl breakpoint', () => {
5153
cy.insertContainerBlock();
5254
cy.selectContainerBlock();
5355
cy.ensureSidebarOpened();
5456

5557
cy.xpath(
5658
`//label[contains(@class,"components-input-control__label")][contains(text(),"Fluid Breakpoint")]/parent::div/following-sibling::div/select[contains(@class,"components-select-control__input")]/option`
57-
).should( 'have.length', 5 );
59+
).should( 'have.length', 6 );
5860

59-
// xxl option should not exist
61+
// xxl option should exist
6062
cy.xpath(
6163
`//label[contains(@class,"components-input-control__label")][contains(text(),"Fluid Breakpoint")]/parent::div/following-sibling::div/select[contains(@class,"components-select-control__input")]/option[@value='xxl']`
62-
).should( 'not.exist' );
64+
).should( 'have.length', 1 );
6365
} );
6466
} );
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
/// <reference types="Cypress" />
22

3-
describe( 'Container Block Bootstrap 5', () => {
3+
describe( 'Container Block Bootstrap 4', () => {
44
before( () => {
55
cy.loginUser();
6-
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v5' );
6+
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
77
} );
88

99
after( () => {
1010
cy.loginUser();
11-
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v5' );
11+
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
1212
} );
1313

1414
beforeEach( () => {
1515
cy.loginUser();
1616
cy.createNewPost();
1717
} );
1818

19-
it( 'Should display xxl breakpoint', () => {
19+
it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
2020
cy.insertContainerBlock();
2121
cy.selectContainerBlock();
2222
cy.ensureSidebarOpened();
2323

2424
cy.xpath(
2525
`//label[contains(@class,"components-input-control__label")][contains(text(),"Fluid Breakpoint")]/parent::div/following-sibling::div/select[contains(@class,"components-select-control__input")]/option`
26-
).should( 'have.length', 6 );
26+
).should( 'have.length', 5 );
2727

28-
// xxl option should exist
28+
// xxl option should not exist
2929
cy.xpath(
3030
`//label[contains(@class,"components-input-control__label")][contains(text(),"Fluid Breakpoint")]/parent::div/following-sibling::div/select[contains(@class,"components-select-control__input")]/option[@value='xxl']`
31-
).should( 'have.length', 1 );
31+
).should( 'not.exist' );
3232
} );
3333
} );

cypress/e2e/row/row-block-backwards-compat.cy.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import {
1616
context( 'Row Block Backwards Compatibility', () => {
1717
beforeEach( () => {
1818
cy.loginUser();
19-
cy.createNewPost();
2019
} );
2120

2221
it( 'v1.0.0 row block content should be compatible', () => {
22+
cy.createNewPost();
2323
cy.setPostContent( rowContent100 );
2424

2525
cy.ensureSidebarOpened();
@@ -38,13 +38,15 @@ context( 'Row Block Backwards Compatibility', () => {
3838
} );
3939

4040
it( 'v1.0.0 column block content should be compatible', () => {
41+
cy.createNewPost();
4142
cy.setPostContent( rowContent100 );
4243
cy.ensureSidebarOpened();
4344

4445
testVersion100ColumnFeatures();
4546
} );
4647

4748
it( 'v1.1.0 row block content should be compatible', () => {
49+
cy.createNewPost();
4850
cy.setPostContent( rowContent110 );
4951
cy.ensureSidebarOpened();
5052

@@ -64,6 +66,7 @@ context( 'Row Block Backwards Compatibility', () => {
6466
} );
6567

6668
it( 'v1.1.0 column block content should be compatible', () => {
69+
cy.createNewPost();
6770
cy.setPostContent( rowContent110 );
6871
cy.ensureSidebarOpened();
6972

@@ -73,6 +76,7 @@ context( 'Row Block Backwards Compatibility', () => {
7376
} );
7477

7578
it( 'v1.4.0 column block content should be compatible', () => {
79+
cy.createNewPost();
7680
cy.setPostContent( rowContent140 );
7781
cy.ensureSidebarOpened();
7882

@@ -84,6 +88,8 @@ context( 'Row Block Backwards Compatibility', () => {
8488
} );
8589

8690
it( 'Bootstrap 4 works with Bootstrap 5 settings', () => {
91+
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
92+
cy.createNewPost();
8793
cy.setPostContent( rowContentBootstrap5 );
8894
cy.ensureSidebarOpened();
8995

@@ -101,9 +107,11 @@ context( 'Row Block Backwards Compatibility', () => {
101107
// Check if Bootstrap 4 values are set in inspector controls
102108
cy.openSidebarPanelWithTitle( 'Column size' );
103109
cy.getInputByLabel( 'Md Column count' ).should( 'have.value', '8' );
110+
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
104111
} );
105112

106113
it( 'v3.2.0 column block content with center content option should be migrated to content vertical alignment', () => {
114+
cy.createNewPost();
107115
cy.setPostContent( rowContent320CenterContent );
108116
cy.ensureSidebarOpened();
109117

0 commit comments

Comments
 (0)