Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt the block switcher styles to the new Popover component #23232

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


// We double the max-width for it to fit both the preview & content but we keep the min width the same for the border to work.
.components-popover.block-editor-block-switcher__popover .components-popover__content {
.components-popover.block-editor-block-switcher__popover .components-popover__content > div {
min-width: 300px;
max-width: calc(340px * 2);
display: flex;
Expand All @@ -81,9 +81,7 @@
.components-menu-group + .components-menu-group {
border-color: $light-gray-secondary;
}
}

.block-editor-block-switcher__popover .components-popover__content {
.block-editor-block-switcher__container {
min-width: 300px;
max-width: 340px;
Expand All @@ -103,7 +101,8 @@

.block-editor-block-switcher__preview {
border-left: $border-width solid $light-gray-500;
box-shadow: $shadow-popover;
margin-top: -$grid-unit-15;
margin-bottom: -$grid-unit-15;
background: $white;
width: 300px;
height: auto;
Expand Down
12 changes: 7 additions & 5 deletions packages/e2e-test-utils/src/transform-block-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ export async function transformBlockTo( name ) {
const switcherToggle = await page.waitForSelector(
'.block-editor-block-switcher__toggle'
);
await switcherToggle.evaluate( ( element ) => element.scrollIntoView() );
await page.waitForSelector( '.block-editor-block-switcher__toggle', {
visible: true,
} );
await switcherToggle.click();

// Find the block button option within the switcher popover.
const insertButton = (
await page.$x(
`//*[contains(@class, "block-editor-block-switcher__popover")]//button[.='${ name }']`
)
)[ 0 ];
const xpath = `//*[contains(@class, "block-editor-block-switcher__popover")]//button[.='${ name }']`;
const insertButton = ( await page.$x( xpath ) )[ 0 ];

// Clicks may fail if the button is out of view. Assure it is before click.
await insertButton.evaluate( ( element ) => element.scrollIntoView() );
await page.waitForXPath( xpath, { visible: true } );
await insertButton.click();

// Wait for the transformed block to appear.
Expand Down