+
);
},
};
+
diff --git a/packages/block-library/src/columns/style.scss b/packages/block-library/src/columns/style.scss
index 00322b0afe799..e377480792af0 100644
--- a/packages/block-library/src/columns/style.scss
+++ b/packages/block-library/src/columns/style.scss
@@ -11,7 +11,6 @@
.wp-block-column {
flex-grow: 1;
- margin-bottom: 1em;
// Responsiveness: Show at most one columns on mobile.
flex-basis: 100%;
@@ -44,3 +43,45 @@
}
}
}
+
+// Specificity overide to ensure margin is applied
+// and preserved on last child to ensure that when columns
+// are aligned to bottom they are are flush with each other
+.wp-block-column,
+.entry-content > .wp-block-columns .wp-block-column:last-child {
+ margin-bottom: 1em;
+}
+
+/**
+ * All Columns Alignment
+ */
+.wp-block-columns {
+ &.are-vertically-aligned-top {
+ align-items: flex-start;
+ }
+
+ &.are-vertically-aligned-center {
+ align-items: center;
+ }
+
+ &.are-vertically-aligned-bottom {
+ align-items: flex-end;
+ }
+}
+
+/**
+ * Individual Column Alignment
+ */
+.wp-block-column {
+ &.is-vertically-aligned-top {
+ align-self: flex-start;
+ }
+
+ &.is-vertically-aligned-center {
+ align-self: center;
+ }
+
+ &.is-vertically-aligned-bottom {
+ align-self: flex-end;
+ }
+}
diff --git a/packages/block-library/src/columns/utils.js b/packages/block-library/src/columns/utils.js
new file mode 100644
index 0000000000000..e7e3f90df70fd
--- /dev/null
+++ b/packages/block-library/src/columns/utils.js
@@ -0,0 +1,16 @@
+/**
+ * External dependencies
+ */
+import memoize from 'memize';
+import { times } from 'lodash';
+
+/**
+ * Returns the layouts configuration for a given number of columns.
+ *
+ * @param {number} columns Number of columns.
+ *
+ * @return {Object[]} Columns layout configuration.
+ */
+export const getColumnsTemplate = memoize( ( columns ) => {
+ return times( columns, () => [ 'core/column' ] );
+} );
diff --git a/packages/e2e-tests/specs/block-hierarchy-navigation.test.js b/packages/e2e-tests/specs/block-hierarchy-navigation.test.js
index 200e5a234f06b..eb23d8fba8c26 100644
--- a/packages/e2e-tests/specs/block-hierarchy-navigation.test.js
+++ b/packages/e2e-tests/specs/block-hierarchy-navigation.test.js
@@ -44,7 +44,7 @@ describe( 'Navigating the block hierarchy', () => {
await lastColumnsBlockMenuItem.click();
// Insert text in the last column block.
- await pressKeyTimes( 'Tab', 2 ); // Navigate to the appender.
+ await pressKeyTimes( 'Tab', 5 ); // Navigate to the appender.
await page.keyboard.type( 'Third column' );
expect( await getEditedPostContent() ).toMatchSnapshot();
@@ -76,17 +76,19 @@ describe( 'Navigating the block hierarchy', () => {
await page.keyboard.press( 'Enter' );
// Insert text in the last column block
- await pressKeyTimes( 'Tab', 2 ); // Navigate to the appender.
+ await pressKeyTimes( 'Tab', 5 ); // Navigate to the appender.
await page.keyboard.type( 'Third column' );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
it( 'should appear and function even without nested blocks', async () => {
+ const textString = 'You say goodbye';
+
await insertBlock( 'Paragraph' );
// Add content so there is a block in the hierachy.
- await page.keyboard.type( 'You say goodbye' );
+ await page.keyboard.type( textString );
// Create an image block too.
await page.keyboard.press( 'Enter' );
@@ -96,8 +98,11 @@ describe( 'Navigating the block hierarchy', () => {
await openBlockNavigator();
await page.keyboard.press( 'Space' );
- // Replace its content.
- await pressKeyWithModifier( 'primary', 'A' );
+ // Replace its content
+ // note Cmd/Ctrl + A doesn't work on Mac with Pupetter right now
+ // https://github.com/GoogleChrome/puppeteer/issues/1313
+ await pressKeyTimes( 'ArrowRight', textString.length );
+ await pressKeyTimes( 'Backspace', textString.length );
await page.keyboard.type( 'and I say hello' );
expect( await getEditedPostContent() ).toMatchSnapshot();