Skip to content

Commit

Permalink
Fix movers e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 24, 2020
1 parent ead309d commit b1f3a9d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function useShowMoversGestures( { ref, debounceTimeout = 500 } ) {
const registerRef = useRef( false );

const isFocusedWithin = () => {
return ref && ref.current.contains( document.activeElement );
return ref?.current && ref.current.contains( document.activeElement );
};

useEffect( () => {
Expand Down
9 changes: 9 additions & 0 deletions packages/e2e-test-utils/src/click-block-toolbar-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ export async function clickBlockToolbarButton( buttonAriaLabel ) {
await page.mouse.move( 0, 0 );
await page.mouse.move( 10, 10 );
}

// Hover the block switcher to show the movers
const switcher = await page.$(
'.block-editor-block-toolbar .block-editor-block-toolbar__block-switcher-wrapper'
);
if ( switcher ) {
await switcher.hover();
}

await page.waitForSelector( BUTTON_SELECTOR );
await page.click( BUTTON_SELECTOR );
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/disable-animations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Enqueue CSS stylesheet disabling animations.
*/
function enqueue_disable_animations_stylesheet() {
$custom_css = '* { animation-duration: 0ms !important; }';
$custom_css = '* { animation-duration: 0ms !important; transition-duration: 0s !important; }';
wp_add_inline_style( 'wp-components', $custom_css );
}

Expand Down
4 changes: 4 additions & 0 deletions packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ describe( 'cpt locking', () => {
await page.click(
'.block-editor-rich-text__editable.wp-block-paragraph'
);
// Hover the block switcher to show the movers
await page.hover(
'.block-editor-block-toolbar .block-editor-block-toolbar__block-switcher-wrapper'
);
expect( await page.$( 'button[aria-label="Move up"]' ) ).not.toBeNull();
await page.click( 'button[aria-label="Move up"]' );
await page.type(
Expand Down

0 comments on commit b1f3a9d

Please sign in to comment.