Skip to content

Commit

Permalink
Merge pull request #106 from liip/feat/modernize
Browse files Browse the repository at this point in the history
feat(): Modernize all the things
  • Loading branch information
tschortsch committed Nov 11, 2022
2 parents e4437f3 + 9771800 commit 1846253
Show file tree
Hide file tree
Showing 51 changed files with 4,491 additions and 5,226 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The version can be selected in the plugin settings (Settings > Bootstrap Blocks)
* Bootstrap 4 (default): `define( 'WP_BOOTSTRAP_BLOCKS_BOOTSTRAP_VERSION', '4' );`
* Bootstrap 5: `define( 'WP_BOOTSTRAP_BLOCKS_BOOTSTRAP_VERSION', '5' );`

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

## CSS Grid

Expand Down
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '6010ac73ad30738b341d');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '9b6fd2a0b07ab4882cb6');
4 changes: 2 additions & 2 deletions build/index.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

42 changes: 28 additions & 14 deletions cypress/e2e/column/column-block.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,46 @@ describe( 'Column Block', () => {
cy.postContentMatchesSnapshot();
} );

it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
// Bootstrap 5 specific options

it( 'Should display xxl breakpoint options', () => {
cy.insertRowBlock();
cy.ensureSidebarOpened();

// Select first column block
cy.selectColumnBlock();
cy.openSidebarPanelWithTitle( 'Column size' );

// Xl column count option should exist
cy.xpath(
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xl Column count")]'
).should( 'exist' );

// Xxl column count option should not exist
// Xxl column count option should exist
cy.xpath(
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xxl Column count")]'
).should( 'not.exist' );

// Xl equal-width option should exist
cy.xpath(
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xl equal-width")]'
).should( 'exist' );

// Xxl equal-width option should not exist
// Xxl equal-width option should exist
cy.xpath(
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xxl equal-width")]'
).should( 'not.exist' );
).should( 'exist' );
} );

it( 'Should be possible to select column size for xxl breakpoint', () => {
cy.insertRowBlock();
cy.ensureSidebarOpened();

// Select first column block
cy.selectColumnBlock();
cy.openSidebarPanelWithTitle( 'Column size' );

// Change column count
cy.get(
'input.components-input-control__input[aria-label="Xxl Column count"]'
).type( '2' );
cy.get( '[data-type="wp-bootstrap-blocks/column"]' )
.first()
.should( 'have.attr', 'data-size-xxl', '2' );

// Enable column equal-width
cy.clickElementByText( 'label', 'Xxl equal-width' );

cy.postContentMatchesSnapshot();
} );
} );
47 changes: 47 additions & 0 deletions cypress/e2e/column/column-bootstrap-v4.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/// <reference types="Cypress" />

describe( 'Column Block Bootstrap 4', () => {
before( () => {
cy.loginUser();
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
} );

after( () => {
cy.loginUser();
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
} );

beforeEach( () => {
cy.loginUser();
cy.createNewPost();
} );

it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
cy.insertRowBlock();
cy.ensureSidebarOpened();

// Select first column block
cy.selectColumnBlock();
cy.openSidebarPanelWithTitle( 'Column size' );

// Xl column count option should exist
cy.xpath(
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xl Column count")]'
).should( 'exist' );

// Xxl column count option should not exist
cy.xpath(
'//label[contains(@class,"components-base-control__label")][contains(text(),"Xxl Column count")]'
).should( 'not.exist' );

// Xl equal-width option should exist
cy.xpath(
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xl equal-width")]'
).should( 'exist' );

// Xxl equal-width option should not exist
cy.xpath(
'//label[contains(@class,"components-checkbox-control__label")][contains(text(),"Xxl equal-width")]'
).should( 'not.exist' );
} );
} );
59 changes: 0 additions & 59 deletions cypress/e2e/column/column-bootstrap-v5.cy.js

This file was deleted.

33 changes: 0 additions & 33 deletions cypress/e2e/column/column-filters-bootstrap-v5.cy.js

This file was deleted.

4 changes: 4 additions & 0 deletions cypress/e2e/column/column-filters.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ describe( 'Column Block Filters', () => {
'Align content bottom'
);

// Xxl Columm size value should be set
cy.openSidebarPanelWithTitle( 'Column size' );
cy.getInputByLabel( 'Xxl Column count' ).should( 'have.value', '5' );

// Check if attributes are set correctly
cy.postContentMatchesSnapshot();
} );
Expand Down
10 changes: 6 additions & 4 deletions cypress/e2e/container/container-block.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ describe( 'Container Block', () => {
cy.postContentMatchesSnapshot();
} );

it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
// Bootstrap 5 specific options

it( 'Should display xxl breakpoint', () => {
cy.insertContainerBlock();
cy.selectContainerBlock();
cy.ensureSidebarOpened();

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

// xxl option should not exist
// xxl option should exist
cy.xpath(
`//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']`
).should( 'not.exist' );
).should( 'have.length', 1 );
} );
} );
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
/// <reference types="Cypress" />

describe( 'Container Block Bootstrap 5', () => {
describe( 'Container Block Bootstrap 4', () => {
before( () => {
cy.loginUser();
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v5' );
cy.activatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
} );

after( () => {
cy.loginUser();
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v5' );
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-bootstrap-v4' );
} );

beforeEach( () => {
cy.loginUser();
cy.createNewPost();
} );

it( 'Should display xxl breakpoint', () => {
it( 'Should not display xxl breakpoint options if run with Bootstrap 4', () => {
cy.insertContainerBlock();
cy.selectContainerBlock();
cy.ensureSidebarOpened();

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

// xxl option should exist
// xxl option should not exist
cy.xpath(
`//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']`
).should( 'have.length', 1 );
).should( 'not.exist' );
} );
} );
10 changes: 9 additions & 1 deletion cypress/e2e/row/row-block-backwards-compat.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
context( 'Row Block Backwards Compatibility', () => {
beforeEach( () => {
cy.loginUser();
cy.createNewPost();
} );

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

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

it( 'v1.0.0 column block content should be compatible', () => {
cy.createNewPost();
cy.setPostContent( rowContent100 );
cy.ensureSidebarOpened();

testVersion100ColumnFeatures();
} );

it( 'v1.1.0 row block content should be compatible', () => {
cy.createNewPost();
cy.setPostContent( rowContent110 );
cy.ensureSidebarOpened();

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

it( 'v1.1.0 column block content should be compatible', () => {
cy.createNewPost();
cy.setPostContent( rowContent110 );
cy.ensureSidebarOpened();

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

it( 'v1.4.0 column block content should be compatible', () => {
cy.createNewPost();
cy.setPostContent( rowContent140 );
cy.ensureSidebarOpened();

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

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

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

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

Expand Down
Loading

0 comments on commit 1846253

Please sign in to comment.