Skip to content

Commit 6172e8e

Browse files
authored
Merge pull request #115 from liip/feat/wp-61
feat(): WordPress 6.1 / Button styling
2 parents 747bf2a + 45a456d commit 6172e8e

22 files changed

+131
-37
lines changed

.github/workflows/lint-test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
strategy:
3838
matrix:
39-
wp: [ '5.7', '5.8', '5.9', '6.0' ]
39+
wp: [ '5.7', '5.8', '5.9', '6.0', '6.1' ]
4040

4141
steps:
4242
- uses: actions/checkout@v3

.wp-env.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"core": "WordPress/WordPress#6.0.1",
2+
"core": "WordPress/WordPress#6.1",
33
"plugins": [ "." ],
44
"themes": [
55
"./test-themes/bootstrap"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Modify default attributes of the button block.
477477
* `_blank`: Target attribute is set to `_blank`
478478
* `rel` (`string`) Default rel attribute of the link (Default: `''`)
479479
* `text` (`string`) Default text of the button (Default: `''`)
480-
* `style` (`string`) Default style of the button (Default: `''`)
480+
* `style` (`string`) Default style of the button (Default: `'primary'`)
481481
* `alignment` (`string`) Default alignment of the button (Default: `''`)
482482

483483
#### Usage
@@ -562,7 +562,7 @@ Modify available button styles.
562562

563563
```javascript
564564
function myButtonStyleOptions( styleOptions ) {
565-
styleOptions.push( { label: 'My Option', value: 'my-option' } );
565+
styleOptions.push( { label: 'My Option', value: 'my-option', color: '#FF0000' } );
566566
return styleOptions;
567567
}
568568
wp.hooks.addFilter(

build/index.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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' => '0a2b1fb09f220caef635');
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' => '7cf780b987df063ad572');

build/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

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

50+
it( 'Style should be visible in UI', () => {
51+
cy.insertButtonBlock();
52+
53+
// Check default button style
54+
cy.get( '.wp-block-wp-bootstrap-blocks-button' ).should(
55+
'have.attr',
56+
'style',
57+
'background-color: rgb(0, 123, 255);'
58+
);
59+
60+
cy.selectButtonBlock();
61+
cy.ensureSidebarOpened();
62+
63+
cy.getSelectByLabel( 'Style' ).select( 'secondary' );
64+
65+
// Style should be visible in UI
66+
cy.get( '.wp-block-wp-bootstrap-blocks-button' ).should(
67+
'have.attr',
68+
'style',
69+
'background-color: rgb(108, 117, 125);'
70+
);
71+
72+
// Editor content should match snapshot
73+
cy.postContentMatchesSnapshot();
74+
} );
75+
76+
it( 'Should add data attributes', () => {
77+
cy.insertButtonBlock();
78+
79+
cy.get(
80+
'.block-editor-block-list__block[data-type="wp-bootstrap-blocks/button"][data-style="primary"]'
81+
).should( 'exist' );
82+
83+
cy.selectButtonBlock();
84+
cy.ensureSidebarOpened();
85+
86+
cy.getSelectByLabel( 'Style' ).select( 'secondary' );
87+
88+
cy.get(
89+
'.block-editor-block-list__block[data-type="wp-bootstrap-blocks/button"][data-style="secondary"]'
90+
).should( 'exist' );
91+
92+
// Editor content should match snapshot
93+
cy.postContentMatchesSnapshot();
94+
} );
95+
5096
it( 'Should be possible to change alignment', () => {
5197
cy.insertButtonBlock();
5298
cy.selectButtonBlock();

languages/wp-bootstrap-blocks-de_CH.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the same license as the Bootstrap Blocks plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 4.2.1\n"
5+
"Project-Id-Version: Bootstrap Blocks 4.3.0\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
77
"blocks\n"
88
"POT-Creation-Date: 2022-05-12T07:38:53+00:00\n"

languages/wp-bootstrap-blocks-de_DE.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the same license as the Bootstrap Blocks plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 4.2.1\n"
5+
"Project-Id-Version: Bootstrap Blocks 4.3.0\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-"
77
"blocks\n"
88
"POT-Creation-Date: 2022-05-12T07:38:53+00:00\n"

languages/wp-bootstrap-blocks.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is distributed under the GPL2+.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Bootstrap Blocks 4.2.1\n"
5+
"Project-Id-Version: Bootstrap Blocks 4.3.0\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-bootstrap-blocks\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <[email protected]>\n"

0 commit comments

Comments
 (0)