Commit Graph

5605 Commits

Author SHA1 Message Date
dependabot[bot] 5ca496c20b Bump yoast/phpunit-polyfills from 1.0.5 to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/9795)
* Bump yoast/phpunit-polyfills from 1.0.5 to 2.0.0

Bumps [yoast/phpunit-polyfills](https://github.com/Yoast/PHPUnit-Polyfills) from 1.0.5 to 2.0.0.
- [Release notes](https://github.com/Yoast/PHPUnit-Polyfills/releases)
- [Changelog](https://github.com/Yoast/PHPUnit-Polyfills/blob/2.x/CHANGELOG.md)
- [Commits](https://github.com/Yoast/PHPUnit-Polyfills/compare/1.0.5...2.0.0)

---
updated-dependencies:
- dependency-name: yoast/phpunit-polyfills
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove expect exception usage

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-28 12:53:40 +01:00
dependabot[bot] 4bdf361f7a Bump preactjs/compressed-size-action (https://github.com/woocommerce/woocommerce-blocks/pull/9304)
Bumps [preactjs/compressed-size-action](https://github.com/preactjs/compressed-size-action) from 265b0667736973f2d83b1a35fdc5440d6cb3322e to 8a15fc9a36a94c8c3f7835af11a4924da7e95c7c.
- [Release notes](https://github.com/preactjs/compressed-size-action/releases)
- [Commits](265b066773...8a15fc9a36)

---
updated-dependencies:
- dependency-name: preactjs/compressed-size-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-28 12:04:32 +01:00
Luigi Teschio 0038caeb85 fix phpcs error (https://github.com/woocommerce/woocommerce-blocks/pull/10330) 2023-07-28 13:01:23 +02:00
dependabot[bot] 47ef07ca57 Bump terser-webpack-plugin from 3.0.3 to 4.2.3 (https://github.com/woocommerce/woocommerce-blocks/pull/7981)
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 3.0.3 to 4.2.3.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v3.0.3...v4.2.3)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-28 11:53:24 +01:00
dependabot[bot] f53d27048d Bump webpack-cli from 3.3.12 to 4.10.0 (https://github.com/woocommerce/woocommerce-blocks/pull/8881)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.12 to 4.10.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.10.0)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-28 11:30:17 +01:00
dependabot[bot] b7225ca549 Bump dependabot/fetch-metadata from 1.5.1 to 1.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/10066)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.5.1...v1.6.0)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2023-07-28 11:05:25 +01:00
dependabot[bot] 0706ebac63 Bump use-debounce from 7.0.1 to 9.0.4 (https://github.com/woocommerce/woocommerce-blocks/pull/9306)
* Bump use-debounce from 7.0.1 to 9.0.4

Bumps [use-debounce](https://github.com/xnimorz/use-debounce) from 7.0.1 to 9.0.4.
- [Release notes](https://github.com/xnimorz/use-debounce/releases)
- [Changelog](https://github.com/xnimorz/use-debounce/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xnimorz/use-debounce/commits/9.0.4)

---
updated-dependencies:
- dependency-name: use-debounce
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix mocked function

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-27 16:10:43 +01:00
dependabot[bot] 357c76376e Bump @storybook/client-api from 6.5.14 to 7.1.1 (https://github.com/woocommerce/woocommerce-blocks/pull/10385)
Bumps [@storybook/client-api](https://github.com/storybookjs/storybook/tree/HEAD/code/deprecated/client-api) from 6.5.14 to 7.1.1.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.1.1/code/deprecated/client-api)

---
updated-dependencies:
- dependency-name: "@storybook/client-api"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 14:48:18 +01:00
dependabot[bot] 1ace01977c Bump actions/stale from 6 to 8 (https://github.com/woocommerce/woocommerce-blocks/pull/8927)
Bumps [actions/stale](https://github.com/actions/stale) from 6 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v6...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 14:28:54 +01:00
dependabot[bot] 1af6da5f02 Bump semver from 5.7.1 to 5.7.2 (https://github.com/woocommerce/woocommerce-blocks/pull/10172)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 13:54:16 +01:00
Mike Jolley 5906125168 Cart and Checkout Page Migration: Inherit Page template and fix rendering (https://github.com/woocommerce/woocommerce-blocks/pull/10375)
* Change shortcode block render callback

* Inherit template from original "page" template
2023-07-27 13:43:26 +01:00
dependabot[bot] c12f7bda70 Bump mockery/mockery from 1.6.2 to 1.6.4 (https://github.com/woocommerce/woocommerce-blocks/pull/10335)
Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.2 to 1.6.4.
- [Release notes](https://github.com/mockery/mockery/releases)
- [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md)
- [Commits](https://github.com/mockery/mockery/compare/1.6.2...1.6.4)

---
updated-dependencies:
- dependency-name: mockery/mockery
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-27 13:05:22 +01:00
Niels Lange 5f14d1c5aa Update README.md 2023-07-27 12:29:39 +03:00
Alex Florisca 1e2e0fbe9c Update express checkout title, description, icon (https://github.com/woocommerce/woocommerce-blocks/pull/10237)
* 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
2023-07-27 09:08:29 +01:00
Albert Juhé Lluveras 22be5a532a Add tests in Playwright for Mini-Cart drawer closing (https://github.com/woocommerce/woocommerce-blocks/pull/10305)
* Add tests in Playwright for Mini-Cart drawer closing

* Make use of waitForSelector instead of waitForTimeout

* Make use of waitForSelector instead of waitForTimeout (II)
2023-07-27 08:53:24 +02:00
Albert Juhé Lluveras 966cf8a4c9 Fix Classic Template block in Single Product custom templates (https://github.com/woocommerce/woocommerce-blocks/pull/10342)
* Fix Classic Template block in Single Product custom templates

* Update src/BlockTemplatesController.php

Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>

---------

Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2023-07-27 08:26:30 +02:00
Tung Du b5100e9d99 Fix: incorrect default number of products in editor when inheriting query (https://github.com/woocommerce/woocommerce-blocks/pull/10303) 2023-07-27 10:06:16 +07:00
Patricia Hillebrandt ae04cabbae Store Customization > Introduce the new Social: Follow us in social media pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10368)
* Add the new Social: Follow us in social media pattern and relevant images.

* Update the URLs

* Remove all IDs from the images.

* Make title translatable. Removed hardcoded color for the icons. Update indentation.
2023-07-26 17:56:54 +02:00
dependabot[bot] 63685a2ffe Bump storybook-addon-react-docgen from 1.2.42 to 1.2.43 (https://github.com/woocommerce/woocommerce-blocks/pull/9887)
Bumps [storybook-addon-react-docgen](https://github.com/hipstersmoothie/storybook-addon-react-docgen) from 1.2.42 to 1.2.43.
- [Release notes](https://github.com/hipstersmoothie/storybook-addon-react-docgen/releases)
- [Changelog](https://github.com/hipstersmoothie/storybook-addon-react-docgen/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hipstersmoothie/storybook-addon-react-docgen/compare/v1.2.42...v1.2.43)

---
updated-dependencies:
- dependency-name: storybook-addon-react-docgen
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 08:51:58 -07:00
dependabot[bot] dfd6a7ee21 Bump commander from 9.4.0 to 11.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/9889)
Bumps [commander](https://github.com/tj/commander.js) from 9.4.0 to 11.0.0.
- [Release notes](https://github.com/tj/commander.js/releases)
- [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tj/commander.js/compare/v9.4.0...v11.0.0)

---
updated-dependencies:
- dependency-name: commander
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 08:42:49 -07:00
Alba Rincón 51ca561130 Remove styles from `Product Details Product Listing` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10362)
* Fix black and white colors

* Remove styles from button and title
2023-07-26 16:12:11 +02:00
Roy Ho a57642318a Change custom toolbar item to use toolbar button (https://github.com/woocommerce/woocommerce-blocks/pull/10246) 2023-07-26 06:19:41 -07:00
Karol Manijak b5d3580ccf Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+ (https://github.com/woocommerce/woocommerce-blocks/pull/10360)
* Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+

* Extract the logic of checking the post template support for grid view toi separate function

* Change the versions comparison and improve description of custom version compare function
2023-07-26 15:13:54 +02:00
Roy Ho 02c95b9b1a Remove uneeded testin step for 10198 (https://github.com/woocommerce/woocommerce-blocks/pull/10371) 2023-07-26 06:12:58 -07:00
Patricia Hillebrandt 529f17dac9 Store Customization > Large Footer pattern - Update the pattern to become wireframed (https://github.com/woocommerce/woocommerce-blocks/pull/10323)
* Remove opinionated font styles and sizes from the Large Footer pattern.

* Ensure the year is dinamically changed in the footer.

* Make string translatable

* Update translation to include the WooCommerce brand.
2023-07-26 13:51:14 +02:00
Albert Juhé Lluveras 84849ca99d Fix Checkout Order Route markdown link (https://github.com/woocommerce/woocommerce-blocks/pull/10364) 2023-07-26 11:37:51 +01:00
Paulo Arromba 73633ee3d1 Render Checkout/Cart containing pages without template overriding (https://github.com/woocommerce/woocommerce-blocks/pull/10359)
* Render Checkout/Cart containing pages without template overriding

* Fix checkout typo

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-26 11:25:49 +01:00
Mike Jolley 025a280b33 Babel and Autoprefixer updates (https://github.com/woocommerce/woocommerce-blocks/pull/10341) 2023-07-26 10:58:17 +01:00
Karol Manijak e09962d65a Optimise imports of Product Query variation (https://github.com/woocommerce/woocommerce-blocks/pull/10340)
* Optimise imports of Product Query variation

* Lint: add whitespace
2023-07-26 11:08:01 +02:00
Alex Florisca 99e1f46281 Change stable version and changelog after release of 10.7.1 2023-07-26 09:53:27 +01:00
Hsing-yu Flowers 35760814d6 Add an endpoint for processing pay for order orders (https://github.com/woocommerce/woocommerce-blocks/pull/10287)
* Register order route

* Check authorization for getting the order

* Add order data to the response

* Add order schema for the endpoint

* Move validation check to order controller

* Add order item schema

* Check if the order is associated with current user

* Fix after rebase

* Add checkout order endpoint

* Add order authorization trait

* Allow to use the order update customer endpoint in dev build only

* Get both customer and guest details

* Remove duplicate function

* Update the cart update customer class doc block

* Remove duplicate order route

* Update documentation for feature flags

* Add checkout trait

* Remove checkout trait

* Update billing address and order

* Only allow checkout pending orders

* Create checout trait

* Use sanitize text field

* Extend from checkout schema

* Update response message

* Allow failed orders to be paid for

* Update authorization error message
2023-07-25 13:00:01 -07:00
Patricia Hillebrandt e29360642d Store Customization > Introduce the new Featured Products: Fresh & Tasty pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10339)
* Introduce the new Featured Products: Fresh & Tasty pattern.

* Update lettuce image.

* Update indentation.

* Make all strings translatable.

* Align all prices right

* Ensure text doesnt stack on mobile

* Update mobile display for the prices

* Update mobile display for the product names

* Remove the image id and the text styles
2023-07-25 17:11:11 +02:00
Patricia Hillebrandt 15db0701f2 Store Customization > Featured Category Triple pattern - Update the pattern to become wireframed (https://github.com/woocommerce/woocommerce-blocks/pull/10343)
* Remove custom font color from the cover block.

* Update indentation for the Featured Category Triple pattern.

* Update indentation for the third column

* Make all strings translatable.

* replate all paragraph blocks with a wp-block-heading

* Ensure the central text is also white

* replace the buttons with a paragraphs.

* Remove unnecessary styles from wp:column

* Remove more unnecessary styles from wp-block-cover

* Remove the has-text-color class and other unnecessary positioning styles

* Update headings from h4 to h3 and update the paragraph styles.

* Replate theme's has-base-color with has-white-color
2023-07-25 16:00:22 +02:00
Albert Juhé Lluveras c74e27d666 Remove opinionated styles from Alternating Image and Text pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10292)
* Remove opinionated styles from Alternating Image and Text pattern

* Vertically center all columns
2023-07-25 10:12:29 +02:00
Mike Jolley 8223e71085 Revert "Bump fast-xml-parser from 4.2.4 to 4.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10136)"
This reverts commit 77ffa1fede.
2023-07-24 17:15:37 +01:00
Mike Jolley b0fca9482a Revert "Bump word-wrap from 1.2.3 to 1.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10333)"
This reverts commit 70f174a5e1.
2023-07-24 17:14:37 +01:00
Mike Jolley 3b60cfcf08 Revert "Bump autoprefixer from 10.4.7 to 10.4.14 (https://github.com/woocommerce/woocommerce-blocks/pull/8794)"
This reverts commit 457700ff9d.
2023-07-24 17:13:24 +01:00
dependabot[bot] 70f174a5e1 Bump word-wrap from 1.2.3 to 1.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10333)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 15:46:01 +01:00
Alexandre Lara f2d313d1a6 Add to cart form: Fix fatal error when missing `product` param in add_to_cart_redirect_filter (https://github.com/woocommerce/woocommerce-blocks/pull/10316)
* Transform product param optional in add_to_cart_redirect_filter method

* Remove unnecessary argument from add_to_cart_redirect_filter

* Remove mocked filter call

* Remove unnecessary argument from function docs
2023-07-24 11:45:40 -03:00
dependabot[bot] 457700ff9d Bump autoprefixer from 10.4.7 to 10.4.14 (https://github.com/woocommerce/woocommerce-blocks/pull/8794)
Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.7 to 10.4.14.
- [Release notes](https://github.com/postcss/autoprefixer/releases)
- [Changelog](https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/autoprefixer/compare/10.4.7...10.4.14)

---
updated-dependencies:
- dependency-name: autoprefixer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 15:44:49 +01:00
dependabot[bot] 77ffa1fede Bump fast-xml-parser from 4.2.4 to 4.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10136)
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.2.4 to 4.2.5.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v4.2.4...v4.2.5)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2023-07-24 15:21:59 +01:00
Alba Rincón a4233a957c Remove opinionated styles from pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10306) 2023-07-24 12:25:34 +02:00
Albert Juhé Lluveras ce16b98893 Fix SearchListControl styles (II) (https://github.com/woocommerce/woocommerce-blocks/pull/10308) 2023-07-24 11:30:54 +02:00
Alba Rincón b8f798b017 Use the `Single Product` block for the `Product Details Product Listing` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/9978)
* Show alignment toolbar also when the block is in the single product block

* Start using `Single Product` for the `Product Details Product Listing` pattern

* Use counter and stars blocks in the pattern

* Undo button change

* Make the new rating blocks not experimental

* Add Beta to the average rating block

* Add blocks to block types controller
2023-07-24 11:02:24 +02:00
Roy Ho ef7b811e4b Remove border control (https://github.com/woocommerce/woocommerce-blocks/pull/10277) 2023-07-21 05:46:55 -07:00
Roy Ho 37e197c149 Move sale badge to top right of product image (https://github.com/woocommerce/woocommerce-blocks/pull/10297) 2023-07-21 05:45:09 -07:00
Roy Ho 84f2e47b14 Check if index element exists before using (https://github.com/woocommerce/woocommerce-blocks/pull/10300) 2023-07-21 05:44:16 -07:00
Niels Lange ebf4bef204 Add missing page titles in Cart and Checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/10281)
* Add missing page titles to the Cart and Checkout templates

* Adjust headline level

* Add i18n support for Cart and Checkout template titles

* Keep empty line between “wp:group” and “wp:template-part”

* Add empty line between “wp:template-part” and “wp:group”
2023-07-21 14:38:08 +02:00
Manish Menaria 6e10e2fbcb Product Collection - Add PHP unit tests (https://github.com/woocommerce/woocommerce-blocks/pull/10289)
* 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.
2023-07-21 15:43:22 +05:30
Darren Ethier f708593adb Add Color Panel (https://github.com/woocommerce/woocommerce-blocks/pull/10062)
* Add new ColorPanel component

* Implement new ColorPanel component for the Mini-Cart

* Move ColorPanel types into their own types.ts file alongside the ColorPanel component

* Add useColorPanelStyles hook

* Rename classes to className

* Disable @wordpress/no-unsafe-wp-apis

* Fix tests: Move defaultColorItem object to utils file

* Remove unnecssary types from QuantityBadge

* Fix conflicts

* Remove context

* Fix color picker JS error

* Migrate attribute data to be compatible with ColorPanel component

* Fix incompatible attributes

* Remove useColorPanelStyles hook

* migrateAttributesToColorPanel JS unit tests

* PHP MiniCartUtils tests

* Remove unncessary code for classNames in MiniCart edit

---------

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2023-07-21 10:35:32 +01:00