Skip to content

Commit f273ee9

Browse files
authored
Merge pull request #107 from liip/feat/reflect-gutter-options-in-editor
feat(): Reflect gutter options in editor
2 parents 646ac65 + d6b0ba4 commit f273ee9

28 files changed

Lines changed: 333 additions & 190 deletions

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' => '0eaff1ea1cf672b436eda066b043570f');
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' => '2a125809b525a250b9ebef8d56322b37');

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/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare namespace Cypress {
44
interface Chainable<Subject> {
55

6+
getByCy(cyKey: string): Chainable<Element>;
67
postContentMatchesSnapshot(): Chainable<void>
78
insertRowBlock(): Chainable<void>
89
selectRowBlock( index?: number ): Chainable<void>

cypress/integration/row/row-filters-bootstrap-v5.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ describe( 'Row Block Filters Bootstrap 5', () => {
2727
cy.clickElementByText( 'label', 'No Gutters' );
2828

2929
// Additional horizontal gutters option should be available
30-
cy.selectOptionIsAvailable( 'Horizontal Gutters', 'gx-4' );
30+
cy.selectOptionIsAvailable( 'Horizontal Gutters', 'gx-10' );
3131

3232
// Horizontal Gutters option should be applied
33-
cy.getSelectByLabel( 'Horizontal Gutters' ).select( 'gx-4' );
33+
cy.getSelectByLabel( 'Horizontal Gutters' ).select( 'gx-10' );
3434

3535
cy.postContentMatchesSnapshot();
3636
} );
@@ -44,10 +44,10 @@ describe( 'Row Block Filters Bootstrap 5', () => {
4444
cy.clickElementByText( 'label', 'No Gutters' );
4545

4646
// Additional vertical gutters option should be available
47-
cy.selectOptionIsAvailable( 'Vertical Gutters', 'gy-4' );
47+
cy.selectOptionIsAvailable( 'Vertical Gutters', 'gy-10' );
4848

4949
// Vertical Gutters option should be applied
50-
cy.getSelectByLabel( 'Vertical Gutters' ).select( 'gy-4' );
50+
cy.getSelectByLabel( 'Vertical Gutters' ).select( 'gy-10' );
5151

5252
cy.postContentMatchesSnapshot();
5353
} );

cypress/integration/row/row-filters-css-grid.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ describe( 'Row Block Filters CSS grid', () => {
2727
cy.clickElementByText( 'label', 'No Gutters' );
2828

2929
// Additional gutters option should be available
30-
cy.selectOptionIsAvailable( 'Gutters', '1.5rem' );
30+
cy.selectOptionIsAvailable( 'Gutters', '10rem' );
3131

3232
// Gutters option should be applied
33-
cy.getSelectByLabel( 'Gutters' ).select( '1.5rem' );
33+
cy.getSelectByLabel( 'Gutters' ).select( '10rem' );
3434

3535
cy.postContentMatchesSnapshot();
3636
} );
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/// <reference types="Cypress" />
2+
3+
describe( 'Settings page', () => {
4+
beforeEach( () => {
5+
cy.loginUser();
6+
} );
7+
8+
it( 'Default values should be selected', () => {
9+
cy.visitAdminPage(
10+
'options-general.php?page=wp-bootstrap-blocks_settings'
11+
);
12+
13+
cy.get(
14+
'#wp-bootstrap-blocks_bootstrap_version option:selected'
15+
).should( 'have.value', '4' );
16+
17+
cy.get( '#wp-bootstrap-blocks_enable_css_grid' )
18+
.should( 'not.be.checked' )
19+
.and( 'be.disabled' );
20+
} );
21+
22+
it( 'Should respect constants', () => {
23+
cy.activatePlugin( 'wp-bootstrap-blocks-test-css-grid' );
24+
cy.visitAdminPage(
25+
'options-general.php?page=wp-bootstrap-blocks_settings'
26+
);
27+
28+
cy.get( '#wp-bootstrap-blocks_bootstrap_version' ).should(
29+
'be.disabled'
30+
);
31+
cy.get(
32+
'#wp-bootstrap-blocks_bootstrap_version option:selected'
33+
).should( 'have.value', '5' );
34+
35+
cy.get( '#wp-bootstrap-blocks_enable_css_grid' )
36+
.should( 'be.checked' )
37+
.and( 'be.disabled' );
38+
39+
cy.deactivatePlugin( 'wp-bootstrap-blocks-test-css-grid' );
40+
} );
41+
} );
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Cypress.Commands.add( 'getByCy', ( cyKey ) =>
2+
cy.get( `[data-cy="${ cyKey }"]` )
3+
);

cypress/support/commands/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './get-by-cy';
12
import './insert-row-block';
23
import './select-row-block';
34
import './row-template-is-selected';

e2e-test-plugins/row-filters/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
return [
3939
...horizontalGuttersOptions,
4040
{
41-
label: 'Medium',
42-
value: 'gx-4',
41+
label: 'Huge',
42+
value: 'gx-10',
4343
},
4444
];
4545
}
@@ -54,8 +54,8 @@
5454
return [
5555
...verticalGuttersOptions,
5656
{
57-
label: 'Medium',
58-
value: 'gy-4',
57+
label: 'Huge',
58+
value: 'gy-10',
5959
},
6060
];
6161
}
@@ -70,8 +70,8 @@
7070
return [
7171
...cssGridGuttersOptions,
7272
{
73-
label: 'Medium',
74-
value: '1.5rem',
73+
label: 'Huge',
74+
value: '10rem',
7575
},
7676
];
7777
}

0 commit comments

Comments
 (0)