-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix/keyboard-shortcut-multi-block-unselect #3436
fix/keyboard-shortcut-multi-block-unselect #3436
Conversation
@vladanost I'd love if you can include the test you wrote, so I can try it locally and see why it fails. By the way there's a built-in environment and cypress setup you can use to avoid having to setup it yourself https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md#local-environment and https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md#end-to-end-testing-integration-tests |
@youknowriad Thanks. I have pushed the test but I already see that CI failed. |
|
||
|
||
// Multiselect via keyboard | ||
cy.get('body').type( '{ctrl}a' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is failing locally, because on MacOS the shortcut is {meta}a
. A simple way to fix this is to type both (and explain with a comment). But I wonder if there's a nicer way to fix it.
👍 Nice test. The travis CI error is unrelated to the test, it's just an You can run |
Codecov Report
@@ Coverage Diff @@
## master #3436 +/- ##
==========================================
+ Coverage 33.8% 34.01% +0.21%
==========================================
Files 249 252 +3
Lines 6713 6703 -10
Branches 1207 1217 +10
==========================================
+ Hits 2269 2280 +11
+ Misses 3754 3730 -24
- Partials 690 693 +3
Continue to review full report at Codecov.
|
@youknowriad I added both modifiers. I see that Cypress will include OS utility methods cypress-io/cypress#824 Maybe that will be useful in some cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix and awesome job on the test. Thanks
const lastBlockSelector = '.editor-visual-editor__block-edit:last [contenteditable="true"]:first'; | ||
const firstBlockContainerSelector = '.editor-visual-editor__block:first'; | ||
const lastBlockContainerSelector = '.editor-visual-editor__block:last'; | ||
const multiSelectedCssClass = 'is-multi-selected'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised before on other PRs. We should consolidate these selectors in shared variables or use data-test attributes
@youknowriad Thanks. |
Description
This PR is referencing this issue #3430
Added Escape key to keyboard shortcuts so multi-block unselect works via keyboard as well.
How Has This Been Tested?
Current JavaScript unit tests and e2e test are passing.
Additional info
This is probably for separate issue but since it's related I put the info here.
I have created a Cypress test for multi-block selection (not included here) but I have a problem there.
I’m using Docker Cypress image so this can be related to my setup.
This is the problem:
There seems to be no way to add another test.
Here tests are ordered 001-hello-gutenberg.js, 002-adding-blocks.js. I added another 003-multi-block-selection.js and in this order it is failing. If I name it so it is run first or second, it passes and the one after it fails.
The same happens with 002-adding-blocks.js, if I put it first for example, 001-hello-gutenberg.js fails. This happens even with only 2 original tests reordered (probably that’s why they are numbered to begin with). This is the error message I am getting when they are reordered:
Changing 'pageLoadTimeout' does not make any difference.
I have not included 003-multi-block-selection.js so original tests pass.
I’m not sure how to proceed.