* Update wrapping on mobile view
* Update styling for images and size.
* remove e2e-pw changes
* Remove font style.
* Remove custom styling from images.
* Update Interactivity API JS files
* Disable TS checks in the Interactivity API for now
* Add new SSR files
* Replace wp_ prefixes with wc_ ones
* Replace wp- prefix with wc-
* Replace guternberg_ prefix with woocommerce_
* Remove file comments from Gutenberg
* Rename files with `wp` prefix
* Fix code to load Interactivity API php files
* Remove TODO comments
* Replace @wordpress with @woocommerce
* Update Webpack configuration
* Fix directive prefix
* Remove interactivity folder from tsconfig exclude
* Add client-side navigation meta tag code
* Remove unneeded blocks.php file
* Fix store tag id
* Register Interactivity API runtime script
* Fix Interactivity API runtime registering
* Remove all files related to directive processing in PHP
* Move json_encode to Store's render method
* WIP
* WIP
* WIP
* WIP
* Preserve previous context
* Ignore Minicart block on client-side navigation
* Refresh page on store updatRefresh page on store updatee
* Refactor logic
* Add console error when a path is missing
* fix PHP lint error
* WIP store
* use store approach
* update jest configuration
* restore Mini Cart changes
* move cart store subscription to interactivity package
* move interactivity flag
* format HTML
* move addToCartText to the context
* Load product-query stylesheet when rendering the Products block
* update sideEffects array
* fix catch
* rename moreThanOneItem to isThereMoreThanOneItem
* improve how scripts are enqueued
* update default value for the filter woocommerce_blocks_enable_interactivity_api
* Update assets/js/atomic/blocks/product-elements/button/block.json
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update assets/js/interactivity/cart/cart-store.ts
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* fix block.json
* remove updateStore function
* restore interactivity api changes
* import cart store
* show notice when there is an error
* add logic to dequeue script on classic themes and block themes
* imrpove logic about notice
* Interactivity API: add `afterLoad` callbacks to `store()` function (https://github.com/woocommerce/woocommerce-blocks/pull/10338)
* show notice when there is an error
* Add initial implementation for store callbacks
* Run `afterLoad` callbacks after `init`
* Move cart state subscription to Product button
* Remove cart-store from Interactivity API internals
* Change callbacks with options and save only afterLoad callbacks
* ProductButton: Add animation (https://github.com/woocommerce/woocommerce-blocks/pull/10351)
* implement animation
* improve logic
* refactor logic
* refactor code
* address feedback about code style
* add support for woocommerce_add_to_cart_quantity
* Fix animation flickering
* Introduce wp-effect, reduce the amount of numberOfItem variables to 2 and consolidate animation status
* add support for added class
* Remove unnecessary selector
* Don't fetch cart if it was already fetched
* remove added class
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
---------
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
* update deepsignal
* remove added class
* update deepsignal
* Interactivity API and Product Button: Add E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/10036)
* Add FrontendUtils class
* fix conflicts
* use locator
* restore click usage
* Product Button: Add E2E test
* fix util
* fix E2E tests
* remove comment
* Add E2E test to ensure that woocommerce_product_add_to_cart_text works
* update sideEffects array
* add zip and unzip as package
* fix wp-env configuration
* fix E2E test
* add report
* try now
* try now
* try now
* fix E2E test
* E2E: Add documentation for testing actions and filters. Fixeswoocommerce/woocommerce-blocks#10135 (https://github.com/woocommerce/woocommerce-blocks/pull/10206)
* update description
* fix label
* rename files
* make requestUtils private
* remove page.goto
* use toHaveCount
* use productsToDisplay variable
* fix E2E tests
* rename class utils
---------
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
---------
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
* Add local state to address-form
* Update test with valid postcode and required fields
* Push changes refactoring
* Avoid loops due to retrying same data
* Callbacks to prevent rerenders
* Move validation functions
* Filter incoming values to only those included as fields to prevent errors
* Keep track of country changes to prevent excessive updates of addressFormFields.
* Use helpers in test
* Fill company
* Revert local state in address form
* Update address form to remove validation handling for postcode (country clears the field).
* Revert "Update test with valid postcode and required fields"
This reverts commit 718a6006df24f6e957297ad4d1ef9d6f690793bd.
* Clear postcode when country changes if invalid
* Revalidate fields when country changes
* Comment for pick
* Revert unneccessary test change
* Revery moving of functions to reduce diff size
* Increase push timeout in tests
* Revert test changes
* Move e2e to e2e-jest
* Move e2e-pw to e2e
* Update e2e usage + scripts
* Missed some directory renames
* Update gitignore
* Remove test results as its in gitignore
* Add eslint playwright plugin configuration
* replace networkidle with commit
* address Unnecessary await expression. This method does not return a Promise error
* address 'Unexpected usage of not.toBeVisible(). Use toBeHidden() instead' error
* address 'Unexpected use of the .skip() annotation.' error
* address 'toHaveCount' must be awaited or returned' error
* address ''page' is defined but never used '
* address ''toBeVisible' must be awaited or returned'
* address 'Unexpected use of element handles'
* address 'Unnecessary await expression. This method does not return a Promise'
* address 'Test has no assertions'
* address 'Unexpected use of page.waitForTimeout()'
* address 'Avoid having conditionals in tests'
* Add cartCheckout project
* Add navigation utils
* Add global block inserter utils to EditorUtils class
* Add initial Cart block tests
* Add slug to block data type
* Get block editor selector when navigating in editor
* add test for inner block filtering
* Update navigation util to use block name instead of title
* Add view switcher test
* Update block name/title
* Run only cart/checkout tests in cartCheckout project
* Remove old comment
* Update selector to use locator instead
* Revert selector type change
* Fix TS issues
* Remove unnecessary admin state
* Update tests to use editorUtils and fix TS issue with selector
* Replace string concatenation with template
* Rename cart test to contain block_theme suffix
* Change page to editor.page and use canvas where necessary
* Rename directory to cart-checkout
* Wait for editor response before continuing
* Remove cartcheckout playwright project
* Remove typecast and switch to .toNotBeHidden
* Remove double comment
* Force click the empty cart button
* Wait for empty cart button for longer
* Isolate test to run in CI
* Dispatch click event instead of simulating click
* Remove timeouts
* Revert "Isolate test to run in CI"
This reverts commit 28af5a50700476639d0a4f12fca9800a4a5aed91.
* Empty commit for release pull request
* classicBlock: add defensive type handling (https://github.com/woocommerce/woocommerce-blocks/pull/10475)
* Update check for active cart template and migration routine (https://github.com/woocommerce/woocommerce-blocks/pull/10462)
* Update cart/checkout endpoints
* Remove updating option on every page load
* Check placeholder page vs current page
* Check placeholder page vs current page
* Switch from Rest to PHP for migrating templates
* Existing page used for migration must contain post-content to be suitable
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Version bumping & documentation for release 10.8.1
The primary changes include:
1. **Version Bumping**: Updated the version from 10.8.0 to 10.8.1 in several files including `composer.json`, `package-lock.json`, `package.json`, `readme.txt`, `src/Package.php`, and `woocommerce-gutenberg-products-block.php`.
2. **Documentation**:
- Added a new testing notes file for release 10.8.1 (`docs/internal-developers/testing/releases/1081.md`). This file provides testing procedures for two bug fixes introduced in this release.
3. **Changelog**: Updated the `readme.txt` to include the bug fixes in the 10.8.1 changelog section.
This release focuses on enhancing stability and user experience by addressing critical bugs.
* Update readme file
* Add zip file for testing
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
* Propose changes for the Release Testing process.
* Update spacing
* Update wording for the experimental flag check.
* Reintroduce the 'Do not include in the Testing Notes' check.
* Update the release and patch release instructions.
* remove whitespace
* Update cart/checkout endpoints
* Remove updating option on every page load
* Check placeholder page vs current page
* Check placeholder page vs current page
* Switch from Rest to PHP for migrating templates
* Existing page used for migration must contain post-content to be suitable
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* WIP Product Gallery: Add the Thumbnails block
* Product Gallery Thumbnails: Add block settings
* Add template for the Product Gallery block
* Add template for the Product Gallery block. Add the rest of the files.
* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.
* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.
* Product Gallery Thumbnails: Move the static template ouside of the component
* Make sure the context is set before accesing the array values
* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc
* Product Gallery Thumbnails: Fix TS error
* Product Gallery Thumbnails: Remove unused stylesheet
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.
* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically
* E2E: Add tests for the Product Gallery Thumbnails block
* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down
* Product Gallery Thumbnails: Add failure handling
* Product Gallery Thumbnails: Fix the eslint dependency error
* Product Gallery Thumbnails: Add inner blocks to the sideEffects array
* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file
* Product Gallery Thumbnails: Update the utils file
* Product Gallery Thumbnails: Update the utils file. Fix comment indentation
* Product Gallery Thumbnails: Fix failing tests
* Revert unrelated package.json changes
* Product Gallery Thumbnails: Further package.json reverts
* Product Gallery Thumbnails: Rename the test screenshots
* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set
* Product Gallery: Rename clientId to productGalleryClientId
* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies
* Product Gallery Thumbnails: Combine all useEffect code together
* Product Gallery Thumbnails: Add a ThumbnailsPosition enum
* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Add missing dependency
* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block
* Product Gallery Thumbnails: Fix E2E tests
* Product Gallery Thumbnails: Remove unused function from frontend utils
* Product Gallery Thumbnails: Remove unused screenshots and config amendment
* Product Gallery Thumbnails: Add check for the order of block on the frontend
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Revert back to ts-ignore
* Revert "Product Gallery: Add crop, zoom and full-screen settings"
This reverts commit 840654197619e2611029b81990493387ae0b543d.
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery: Remove the redundant React Fragment
* Product Gallery E2E: Simplify and combine the tests
* Enable Compatibility Layer for Product Collection
* Add another condition to recognise shop item
* Enable multiple blocks to be assigned to single hook in Compatibility Layer
* Move core/null block name assignment before the hooks assignment which is based on the block name
* Make array operations safer
* Unify hooks interface between templates
* Fix typo
* Update comment describing set_hook_data to reflect new interface
* Add function to generate a hash for script data cache busting
* Store the script data hash if cache is not disabled
* Change transient key if accessed via https
* Update hardcoded transient key to use class variable
* Add generated hash to transient script data value
* Add check to ensure JSON is valid before proceeding
* Move JSON error check to other conditional
* Change formatting on long if
* Ensure hash is checked to invalidate cache
* Update router to hydrate only interactive regions
* Rename link directive to navigation-link
* Add navigation directives to Query and Pagination blocks
* Enable the Interactivity API by default
* Remove client-side navigation meta tag
* Cache initial regions
* Move data-wc-interactive from query to query-pagination
* Add woo prefix to navigation id
* Add keys and move wc-interactive back to the query block
* Reuse root fragments for each interactive region
* Fix navigation-id retrieval
* WIP Product Gallery: Add the Thumbnails block
* Product Gallery Thumbnails: Add block settings
* Add template for the Product Gallery block
* Add template for the Product Gallery block. Add the rest of the files.
* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.
* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.
* Product Gallery Thumbnails: Move the static template ouside of the component
* Make sure the context is set before accesing the array values
* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc
* Product Gallery Thumbnails: Fix TS error
* Product Gallery Thumbnails: Remove unused stylesheet
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.
* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically
* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down
* Product Gallery Thumbnails: Fix the eslint dependency error
* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file
* Product Gallery Thumbnails: Update the utils file
* Product Gallery Thumbnails: Update the utils file. Fix comment indentation
* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set
* Product Gallery: Rename clientId to productGalleryClientId
* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies
* Product Gallery Thumbnails: Combine all useEffect code together
* Product Gallery Thumbnails: Add a ThumbnailsPosition enum
* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Add missing dependency
* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Revert back to ts-ignore
* Revert "Product Gallery: Add crop, zoom and full-screen settings"
This reverts commit 840654197619e2611029b81990493387ae0b543d.
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery: Remove the redundant React Fragment
* WIP Product Gallery: Add the Thumbnails block
* Product Gallery Thumbnails: Add block settings
* Add template for the Product Gallery block
* Add template for the Product Gallery block. Add the rest of the files.
* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.
* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.
* Product Gallery Thumbnails: Move the static template ouside of the component
* Make sure the context is set before accesing the array values
* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc
* Product Gallery Thumbnails: Fix TS error
* Product Gallery Thumbnails: Remove unused stylesheet
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.
* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically
* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down
* Product Gallery Thumbnails: Fix the eslint dependency error
* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file
* Product Gallery Thumbnails: Update the utils file
* Product Gallery Thumbnails: Update the utils file. Fix comment indentation
* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set
* Product Gallery: Rename clientId to productGalleryClientId
* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies
* Product Gallery Thumbnails: Combine all useEffect code together
* Product Gallery Thumbnails: Add a ThumbnailsPosition enum
* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Add missing dependency
* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Revert back to ts-ignore
* Revert "Product Gallery: Add crop, zoom and full-screen settings"
This reverts commit 840654197619e2611029b81990493387ae0b543d.
* WIP Product Gallery: Add the Thumbnails block
* Product Gallery Thumbnails: Add block settings
* Add template for the Product Gallery block
* Add template for the Product Gallery block. Add the rest of the files.
* Product Gallery Thumbnails: Add context settings sharing between the Product Gallery and Thumbnails block.
* Product Gallery Thumbnails: Add UI functionality and frontend functionality. Add settings for the Thumbnails in both places - Product Gallery and the Thumbnails block.
* Product Gallery Thumbnails: Move the static template ouside of the component
* Make sure the context is set before accesing the array values
* Product Gallery Thumbnails: Move the setGroupAttributes() function outside of the component
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Update the Features Flags and Experimental Interfaces doc
* Product Gallery Thumbnails: Fix TS error
* Product Gallery Thumbnails: Remove unused stylesheet
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Remove unused context and fix the thumbnails bottom position styling on the frontend.
* Product Gallery Thumbnails: Allow the user to move the horizontal thumbnails above the large image and don't overwrite that automatically
* Product Gallery Thumbnails: Add code comments and remove the incorrect conditional check when moving thumbnails up and down
* Product Gallery Thumbnails: Fix the eslint dependency error
* Product Gallery Thumbnails: Refactor Product Gallery edit code and move the logic to a utils file
* Product Gallery Thumbnails: Update the utils file
* Product Gallery Thumbnails: Update the utils file. Fix comment indentation
* Product Gallery Thumbnails: Fix undefined variable html when only 1 product image is set
* Product Gallery: Rename clientId to productGalleryClientId
* Product Gallery Thumbnails: Combine the useEffect code having the same dependencies
* Product Gallery Thumbnails: Combine all useEffect code together
* Product Gallery Thumbnails: Add a ThumbnailsPosition enum
* Product Gallery Thumbnails: Update the thumbnailsPosition to an enum
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Fix TS errors
* Product Gallery Thumbnails: Add missing dependency
* Product Gallery Thumbnails: Uppercase the enum and fix the thumbnails position bug when initially adding the Product Gallery block
* Product Gallery: Add crop, zoom and full-screen settings
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Replace ts-ignore with ts-expect-error
* Product Gallery Thumbnails: Revert back to ts-ignore
* Add new GH Action for ensuring the correct labels are added to PRs.
* Update Pull Request Template instructions for labels.
* Update validation.
* Update the validation for the type.
This commit updates the minimum WordPress and WooCommerce requirements in the `woocommerce-gutenberg-products-block.php` file. It sets the minimum WordPress version to 6.2 and the minimum WooCommerce version to 7.8. Additionally, it increases the WooCommerce version tested up to 7.9.
This commit updates the version of WooCommerce Blocks from 10.8.0-dev to 10.8.0 in the `composer.json`, `package-lock.json`, `package.json`, `readme.txt`, `src/Package.php`, and `woocommerce-gutenberg-products-block.php` files. This signifies the move from the development version to the stable release.
This commit updates the `readme.txt` file to document the changes made in version 10.8.0. This version includes numerous enhancements, bug fixes, and other changes.
Enhancements include updating various patterns to become wireframed, removing opinionated styles from multiple patterns, and introducing the ColorPanel component in the Mini-Cart block for custom color controls. Bug fixes address issues in the Classic Template block, product query logic, and PHP warnings among others. The "Various" section introduces new patterns and endpoints.
Each change is linked to its corresponding pull request for detailed tracking and discussion.
* Add PHPUnit tests for the ProductCollection block type
This commit introduces PHPUnit tests for the ProductCollection block type. A new test file, `ProductCollection.php`, has been added under the `BlockTypes` directory within the tests. The test file sets up a mock instance of `ProductCollection` and verifies its behavior. Particularly, it tests the merging of on-sale queries, ensuring the results are as expected.
To assist in the testing, a new mock class, `ProductCollectionMock`, has been created under the `Mocks` directory. This class extends the `ProductCollection` block type and provides methods for setting parsed block data and attribute filter query arguments.
These tests should help ensure the correctness and reliability of the `ProductCollection` block type.
* Expand PHPUnit tests for ProductCollection block to cover stock status queries
This commit expands the existing PHPUnit tests for the ProductCollection block type to cover scenarios involving stock status queries. Specifically, a new test method, `test_merging_stock_status_queries`, has been added.
This method tests if the 'woocommerceStockStatus' attribute is correctly merged into the query parameters. It verifies that the stock status is correctly incorporated into the 'meta_query' array as part of the constructed query.
This addition enhances the coverage of our test suite, ensuring that the ProductCollection block behaves as expected in scenarios involving stock status queries.
* Add extensive testing for ProductCollection block's query merging
The following test methods were added:
1. `test_merging_default_stock_queries`: This tests the merging of default stock queries, verifying the absence of meta_query in certain conditions.
2. `test_merging_attribute_queries`: This tests the merging of attribute queries, ensuring the correct taxonomy and terms are used in the merged tax_query.
3. `test_merging_order_by_rating_queries` and `test_merging_order_by_popularity_queries`: These test the merging of order by queries, checking for the right orderby and meta_key in the merged query.
4. `test_product_visibility_query_exist_in_merged_query`: This tests if the product visibility query exists in the merged query.
This additional testing improves the reliability and coverage of our tests, ensuring the correct functionality of the ProductCollection block's query merging process.
* Add unit tests for merged queries in ProductCollection block
- Merging multiple queries
- Merging filter by max price queries
- Merging filter by min price queries
- Merging filter by min and max price queries
- Merging filter by stock status queries
- Merging filter by attribute queries
- Merging multiple filter queries
These tests use PHPUnit assertions to validate the correctness of the merged queries.
* Add tests for REST query modifications in ProductCollection block
This commit adds two new test cases and a helper method to the `ProductCollection` test class.
The helper method, `build_request()`, constructs a simplified `WP_REST_Request` object for testing purposes. This request object simulates a typical request from the ProductCollection block, including potential WooCommerce parameters such as 'woocommerceOnSale', 'woocommerceAttributes', and 'woocommerceStockStatus'.
The first new test, `test_updating_rest_query_without_attributes()`, tests the block's capability to modify a REST query that doesn't include any product attribute filters. It verifies that the correct '_stock_status' and 'product_visibility' parameters are set in the meta and tax queries respectively.
The second test, `test_updating_rest_query_with_attributes()`, does the same as the previous one but with the inclusion of a product attribute filter in the REST request. This test verifies that the block can handle REST queries with attribute filters correctly.
These tests improve coverage on the ProductCollection block's REST query handling, ensuring that it can merge different filter queries correctly.
* Add test for merging taxonomies query in ProductCollection block
This commit introduces a new test, `test_merging_taxonomies_query()`, in the `ProductCollection` test class.
The test simulates a situation where the block has to merge taxonomy queries related to product categories and tags. The parsed block attributes are configured to include 'product_cat' and 'product_tag' taxonomies with certain term IDs.
The test then asserts that the merged query correctly includes these taxonomies with the appropriate term IDs and 'include_children' set to false. This confirms that the block correctly merges taxonomy filters when building the final query.
* Fix failing test
* Try again
* Try again
* Remove test_merging_filter_by_attribute_queries test
This commit removes the `test_merging_filter_by_attribute_queries()` test from the `ProductCollection` test class.
* Reintroduce test for merging attribute filter queries
This commit reintroduces the `test_merging_filter_by_attribute_queries()` test in the `ProductCollection` test class.
The test checks the correct merging of queries when filtering by color and size attributes. It sets various query variables and asserts the correct structure and content of the merged query.
This could be because the previous removal of this test was a mistake, or because changes in the code have once again made this test relevant.
* fix: passing correct block instance to build_frontend_query method
---------
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Make sure the revert button is registered and enqueued for usage exclusively in the site editor.
* Register and enqueue the styles for the revert button.
* Rename the files.
* Revert "Rename the file renames."
This reverts commit c0330ce70fec20bea1f957eddcf458881e16242c.
* Add plugin-proposal-optional-chaining to the WebPack plugins config.
* Rename the files.
* Remove unnecessary dependencies as those are already provided via : more specifically, get_script_data.
* Address CR.
* Featured Products 5-Item Grid pattern: Ensure a placeholder image is displayed when the product doesn't have any
* Ensure the wp-block-group is aligned wide.
* Update text styles
* Make texts translatable.
* Update the Featured Products 5-Item Grid pattern
* Change icon, title and description of the Express Checkout Block
* Fix icon style
* Update icon and add styles
* change icon for express payments in cart
* Add tests in Playwright for Mini-Cart drawer closing
* Make use of waitForSelector instead of waitForTimeout
* Make use of waitForSelector instead of waitForTimeout (II)