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

Allow dragging CTA button within the CTA block #2824

Merged
merged 51 commits into from
Aug 13, 2019

Conversation

miina
Copy link
Contributor

@miina miina commented Jul 17, 2019

Closes #2781.
Closes #2899.

Left todo:

  • Look into why sometimes top and left attribute are assigned to CTA block. (Needs testing).
  • Adjust CTA block styling to match the borders exactly to make the drop logic more precise.
  • Remove alignment options.
  • Maybe don't display the link when dragging.
  • Make the adjustments to save and FE view, too (see how to do that without breaking existing blocks).
  • See if can make more DRY.
  • Tests (e2e).
  • Update the logic once Require double click (or just two clicks) for editing. #2863 gets merged.

@googlebot googlebot added the cla: yes Signed the Google CLA label Jul 17, 2019
@miina miina mentioned this pull request Jul 18, 2019
22 tasks
Copy link
Collaborator

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment about bumping the story template version, but otherwise this looks & works good.

@kienstra
Copy link
Contributor

kienstra commented Aug 8, 2019

Code And Dragging Look Good
Question About Deprecation

Hi @miina,
This looks good. Dragging of the CTA block works well, that's a nice feature:

dr-cta

Are CTA blocks created with the develop branch supposed to be free of validation errors when switching to this branch? It looks like there's a deprecated.js file for that.

I saw validation errors with these steps:

  1. Checkout and build the develop branch
  2. Create an AMP story
  3. Add a CTA block, and enter text, like 'Click here'
  4. Checkout and build this PR's branch, 2781-dragging_cta_button
  5. Reload the page
  6. Expected: validation errors shouldn't appear for CTA blocks (I think)
  7. Actual: there were validation errors, like below.

cta-block

There are even more when selecting a background color, though the screenshot above doesn't show those.

@miina
Copy link
Contributor Author

miina commented Aug 8, 2019

I saw validation errors with these steps:

Thanks a lot for testing this, correct -- there shouldn't be validation errors, tested it before but not recently.

Looking into this.

@miina
Copy link
Contributor Author

miina commented Aug 8, 2019

Looks like #2906 caused a regression, should be fixed now.

@swissspidy
Copy link
Collaborator

Failing test on Travis:

 waiting for selector ".wp-block .block-editor-warning__message" failed: timeout 30000ms exceeded
      54 | 
      55 | 		const errorSelector = '.wp-block .block-editor-warning__message';
    > 56 | 		await page.waitForSelector( errorSelector );
         | 		           ^
      57 | 		const element = await page.$( errorSelector );
      58 | 		const text = await ( await element.getProperty( 'textContent' ) ).jsonValue();
      59 | 		expect( text ).toStrictEqual( 'Call to Action: This block can not be used on the first page.' );
      at new WaitTask (../../node_modules/puppeteer/lib/FrameManager.js:840:28)
      at Frame._waitForSelectorOrXPath (../../node_modules/puppeteer/lib/FrameManager.js:731:12)
      at Frame.waitForSelector (../../node_modules/puppeteer/lib/FrameManager.js:690:17)
      at Page.waitForSelector (../../node_modules/puppeteer/lib/Page.js:1008:29)
      at Object.waitForSelector (specs/stories-editor/cta.test.js:56:14)

@miina
Copy link
Contributor Author

miina commented Aug 8, 2019

The test passed now.

@miina
Copy link
Contributor Author

miina commented Aug 13, 2019

@swissspidy Any objections to merging this to develop? Or should we wait for creating a separate release branch first?

@swissspidy
Copy link
Collaborator

No objections really. Will merge once the tests pass. Just haven't gotten around to do it so far.

@swissspidy swissspidy merged commit d0eee81 into develop Aug 13, 2019
@swissspidy swissspidy deleted the 2781-dragging_cta_button branch August 13, 2019 18:17
@westonruter westonruter added this to the v1.2.1 milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
5 participants