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

Use the LoadingMask component from WooCommerce Blocks for PRB loading status in the Cart and Checkout Blocks #2248

Merged
merged 3 commits into from
Dec 29, 2021

Conversation

reykjalin
Copy link
Contributor

@reykjalin reykjalin commented Dec 18, 2021

Changes proposed in this Pull Request:

Instead of relying on CSS classes that may change in the future to trigger the loading state on the Payment Request Buttons in the Cart and Checkout Blocks, we instead use the <LoadableMask /> component exposed in woocommerce/woocommerce-blocks#5135 and released in WooCommerce Blocks v6.4.0.

  • Wrap all PRB components in <LoadableMask /> to trigger the loading state.

To stick to our general L-2 support policy this PR should not be merged until WooCommerce Blocks 6.6.0 is released.

Testing instructions

Note: You'll need to be using WooCommerce Blocks version 6.4.0 or newer for this to work.

Note: Both tests require you to use the Cart and Checkout blocks instead of the Shortcode-based checkout pages.

Note: Both tests require you to make sure Payment Request Buttons are displayed on the Cart and Checkout pages.

Testing the Cart Block

  1. Add any item(s) to your cart.
  2. Go to the Cart page.
  3. Wait for the Payment Request Button (PRB) to load.
  4. Change the amount of any of the items in your cart.
  5. Make sure the PRB is greyed out and disabled, and the Payment Request modal isn't opened if you click it.
  6. After the PRB is reenabled click the PRB to open the payment request modal.
  7. Cancel the Payment Request.
  8. Change the amount of any of the items in your cart again.
  9. Make sure the PRB is again greyed out and disabled, and the Payment Request modal isn't opened if you click it.
  10. After the PRB is reenabled click the PRB to open the payment request modal.
  11. Make sure you can complete a payment successfully this time.

Testing the Checkout Block

  1. Add any item(s) to your cart.
  2. Go to the Checkout page.
  3. Wait for the Payment Request Button (PRB) to load.
  4. Change the state in your address.
    • You could also change any other settings that will cause WooCommerce to reevaluate the shipping costs.
  5. Make sure the PRB is greyed out and disabled, and the Payment Request modal isn't opened if you click it.
  6. After the PRB is reenabled click the PRB to open the payment request modal.
  7. Cancel the Payment Request.
  8. Change the state in your address again.
  9. Make sure the PRB is again greyed out and disabled, and the Payment Request modal isn't opened if you click it.
  10. After the PRB is reenabled click the PRB to open the payment request modal.
  11. Make sure you can complete a payment successfully this time.

I decided not to add automated JS tests for this change since we'd essentially be testing the <LoadableMask /> component, and the WooCommerce Blocks plugin is already taking care of that.


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@reykjalin reykjalin added pr: needs review category: refactor component: blocks Cart and checkout blocks type: technical debt This issue/PR represents/solves the technical debt of the project. status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. labels Dec 18, 2021
@reykjalin
Copy link
Contributor Author

I'm marking this PR as blocked until WooCommerce Blocks v6.6.0 is released so we can stick to our L-2 support policy.

@reykjalin
Copy link
Contributor Author

Version 6.6.0 of the Blocks plugin has been released so I'm going to remove the blocked tag 🙌

@reykjalin reykjalin removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Dec 27, 2021
Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

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

Code looks good, and tests well 🚢

@reykjalin reykjalin merged commit 4f47751 into develop Dec 29, 2021
@reykjalin reykjalin deleted the add/loadable-mask-component branch December 29, 2021 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: blocks Cart and checkout blocks pr: ready to merge type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants