-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add move to top bottom when long pressing block movers (#27554)
* WC: Added move to top and bottom functionality via long pressing BlockMover buttons and clicking the button on the BottomSheet Picker. * WIP: Unit tests. * WC: WIP unit tests for add move to top and bottom * WC: Moving UI tests to gutenberg with other UI tests instead of keeping at gutenberg-mobile. Adding more convenience functions to EditorPage. * WIP: Unit tests. * WC: Adding icon and title to picker for move to top/bottom. * WC: Cleaning up code. * WC: Fixing merge issue where import was changed to const. * WC: Changing all imports to requires as per jest bug. * WC: Removing before/afterAll blocks from UI tests. * WC: Removing e2e tests to issue-1191-add-move-to-top-bottom-ui-tests branch. * WC: Updating imports to fall in line with other files. Co-authored-by: Wendy Chen <[email protected]>
- Loading branch information
Showing
3 changed files
with
176 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/block-editor/src/components/block-mover/test/__snapshots__/index.native.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Block Mover Picker should match snapshot 1`] = ` | ||
<Fragment> | ||
<ForwardRef(ToolbarButton) | ||
extraProps={ | ||
Object { | ||
"hint": "Double tap to move the block up", | ||
} | ||
} | ||
icon={ | ||
<SVG | ||
viewBox="-2 -2 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<Path | ||
d="M11 18H9V6l-4 4-2-1 7-7 7 7-2 1-4-4v12z" | ||
/> | ||
</SVG> | ||
} | ||
onLongPress={[Function]} | ||
title="Move block up from row NaN to row NaN" | ||
/> | ||
<ForwardRef(ToolbarButton) | ||
extraProps={ | ||
Object { | ||
"hint": "Double tap to move the block down", | ||
} | ||
} | ||
icon={ | ||
<SVG | ||
viewBox="-2 -2 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<Path | ||
d="M9 2h2v12l4-4 2 1-7 7-7-7 2-1 4 4V2z" | ||
/> | ||
</SVG> | ||
} | ||
onLongPress={[Function]} | ||
title="Move block down from row NaN to row NaN" | ||
/> | ||
<Picker | ||
hideCancelButton={true} | ||
leftAlign={true} | ||
onChange={[Function]} | ||
options={Array []} | ||
title="Move block position" | ||
/> | ||
</Fragment> | ||
`; |
51 changes: 51 additions & 0 deletions
51
packages/block-editor/src/components/block-mover/test/index.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { BlockMover } from '../index'; | ||
|
||
describe( 'Block Mover Picker', () => { | ||
it( 'renders without crashing', () => { | ||
const wrapper = shallow( <BlockMover />, { | ||
context: { | ||
isFirst: false, | ||
isLast: true, | ||
isLocked: false, | ||
numberOfBlocks: 2, | ||
firstIndex: 1, | ||
|
||
onMoveDown: jest.fn(), | ||
onMoveUp: jest.fn(), | ||
onLongPress: jest.fn(), | ||
|
||
rootClientId: '', | ||
isStackedHorizontally: true, | ||
}, | ||
} ); | ||
expect( wrapper ).toBeTruthy(); | ||
} ); | ||
|
||
it( 'should match snapshot', () => { | ||
const wrapper = shallow( <BlockMover />, { | ||
context: { | ||
isFirst: false, | ||
isLast: true, | ||
isLocked: false, | ||
numberOfBlocks: 2, | ||
firstIndex: 1, | ||
|
||
onMoveDown: jest.fn(), | ||
onMoveUp: jest.fn(), | ||
onLongPress: jest.fn(), | ||
|
||
rootClientId: '', | ||
isStackedHorizontally: true, | ||
}, | ||
} ); | ||
expect( wrapper ).toMatchSnapshot(); | ||
} ); | ||
} ); |