Commit Graph

1353 Commits

Author SHA1 Message Date
Tung Du 995d41e2a9 Fix: Empty Mini Cart contents overflow issue (https://github.com/woocommerce/woocommerce-blocks/pull/5635)
* fix: add wrapper for empty mini cart contents inner blocks. Allow inner content to be scrollable

* fix overflow issue for the editor

* add padding for the empty cart view
2022-02-01 17:19:41 +01:00
Luigi Teschio 9d1464baf3 Featured Product: Enable global style (https://github.com/woocommerce/woocommerce-blocks/pull/5555)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* Featured Product block: enable global style woocommerce/woocommerce-blocks#4965

Featured Product block: enable global style

* fix border color

* fix eslint error

* fix opacity

* fix border radius

* fix opacity

* disable font-size support

* restore height for featured product and featured category
2022-02-01 15:01:31 +01:00
Luigi Teschio 2438fcd434 Disable font-size for the Featured Category block woocommerce/woocommerce-blocks#5681 (https://github.com/woocommerce/woocommerce-blocks/pull/5682)
Disable font-size for the Featured Category block
2022-01-31 18:03:54 +01:00
Manos Psychogyiopoulos 6ed7034223 Add inner wrapper div in 'td.wc-block-cart-item__product' (https://github.com/woocommerce/woocommerce-blocks/pull/5240)
* Add inner wrapper div in td.wc-block-cart-item__product

Adding this wrapper element is necessary in order to be able to "fake" item grouping in a theme-agnostic manner: https://user-images.githubusercontent.com/1783726/118831630-97855600-b8c8-11eb-8906-c7f9ada769e7.png

* Whoops

* Remove classnames function

* Update indentation for QuantitySelector

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-01-31 15:18:29 +00:00
Niels Lange 83ae876898 Keep top margin for create account section in editor (https://github.com/woocommerce/woocommerce-blocks/pull/5633) 2022-01-31 22:15:46 +07:00
Tomasz Tunik 54ca9e16b0 Fix ReadMore component maxLines prop reactivity (https://github.com/woocommerce/woocommerce-blocks/pull/5673)
when changing property value of maxLines component would not
update until remounted or reloaded with new settings
2022-01-31 13:56:19 +01:00
Thomas Roberts c7aa3a75b9 Update tests to use `useEvent` (https://github.com/woocommerce/woocommerce-blocks/pull/5573)
* Update payment-method-data-context tests to use userEvent

* Update mini cart block tests to use userEvent

* Update payment methods tests to use userEvent
2022-01-31 10:53:21 +00:00
Thomas Roberts afd9d42805 Add Checkout Order Summary inner block tests (https://github.com/woocommerce/woocommerce-blocks/pull/5675)
* Add fake items fixture

* Add test for rendering items in sidebar

* Add test for items with addons

* Add textContentMatcherAccrossSiblings helper

This is needed to match text when it's spread over a few elements

* Add test to ensure subtotal renders correctly

* Add test to ensure discounts are rendered correctly

* Add test to ensure fees are shown correctly

* Add test to check coupon entry form isn't present when coupons disabled

* Add more mock data to useStoreCart

* Mock useShippingDataContext

* Rename useStoreCartValue to useStoreCartReturnValue

* Remove unnecessary coupon button test

This should be tested within the TotalsCoupon component

* Add tests for shipping presence

* Add test for coupons

* Remove cart items fixtures

These are no longer needed

* Move the findByText utils to the utils folder

* Move inner blocks test to correct directory
2022-01-31 10:53:08 +00:00
Thomas Roberts a46f13c6c5 Move Checkout block attributes into metadata (`block.json`) (https://github.com/woocommerce/woocommerce-blocks/pull/5594)
* Add block title to AbstractBlock class

* Add block title to Checkout block

* Include all block.json files in tsconfig

* Add get_block_title method to Checkout.php

* Remove redundant block_title field

* Add block.json and remove static attributes from attributes.ts

* Register block using attributes from block.json

* Add metadata_path to AbstractBlock

* Add function to AssetsApi to get the metadata path from the plugin root

* Register the block using metadata if it's set in the block's class

* Remove get_block_title method

* Only add supports and attributes to the block when not registering with metadata

* Change get_block_metadata to get_block_metadata_path

* Change indentation to tabs in block.json

* Update comment to clarify why attributes and supports are set later

* Check if path to metadata is not empty instead of set and not empty

* Move checkout block out of cart-checkout directory

* Update get_block_metadata_path function to find block.json automatically

* Remove metadata path from AbstractBlock

* Check if there's a metadata file and register blocks with metadata if so

* Move deprecated attributes out of metadata and into attributes.ts

* Re-add deprecated attributes to checkout index

* Move order notes test

* Move test for checkout phone number in edito

* Fix indentation in checkout/block.json

* Move checkout terms tests

* Try forcing storefront theme in e2e tests

* Revert "Try forcing storefront theme in e2e tests"

This reverts commit 5b0fd47a2c39aadb0141a4ed28cbc0e6baa89625.

* Try capturing screenshot on test failures

* Try uploading error in try catch

* Try uploading artefacts on error

* Test uploading artefacts

* Screenshot just before looking for edit post layout

* Revert "Screenshot just before looking for edit post layout"

This reverts commit 61dff027789ce13a0d84e7b6f11e431637c5a450.

* Revert "Test uploading artefacts"

This reverts commit adf5cc55bcdb677f889bf5a62803b4150d98e665.

* Revert "Try uploading artefacts on error"

This reverts commit 7441a832a113a95fef89cc1b8db6dc79271be516.

* Revert "Try uploading error in try catch"

This reverts commit ca412ce505d56286b164f588a201a451f6bceeb6.

* Revert "Try capturing screenshot on test failures"

This reverts commit 0de6e97df19b116091a7bb3b8652713867d2d80f.

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-01-28 16:37:06 +00:00
Thomas Roberts b7560ebed5 Add tests for Checkout Terms block (https://github.com/woocommerce/woocommerce-blocks/pull/5621)
* Install @wordpress/block-editor package

* Add test for checkout terms frontend block

* Add tests for checkout terms in editor

* Add tests for Checkout Terms in editor

* Use void 0 as function's return type

* Update tests to use toBeInTheDocument and split checkbox test in two

* Use void 0 for empty function
2022-01-27 12:34:52 +00:00
Tung Du 6f4c00a2fd Fix: Exclude Mini Cart and other blocks inside the Mini Cart Contents block (https://github.com/woocommerce/woocommerce-blocks/pull/5616) 2022-01-27 17:10:53 +07:00
Tom Cafferkey 9934533375 Revert "Allow LegacyTemplate block to be reinserted, only on WooCommerce block templates. (https://github.com/woocommerce/woocommerce-blocks/pull/5545)" (https://github.com/woocommerce/woocommerce-blocks/pull/5643)
This reverts commit cf9c82e02e.
2022-01-27 09:45:00 +00:00
Luigi Teschio 2370ce4378 Featured Category block: add support for global style (https://github.com/woocommerce/woocommerce-blocks/pull/5542)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* fix opacity

* fix border radius

* fix order rules css
2022-01-26 18:16:50 +01:00
Alex Florisca 4ba300d6d1 Prevent third party blocks from breaking the entire checkout/cart block (https://github.com/woocommerce/woocommerce-blocks/pull/5297)
* Prevent third party blocks from breaking the entire checkout block

* Fixed types and block error boundary around forced blocks

* Move InnerBlocksComponentWrapper and remove extra }

* Allow HTML nodes to be rendered in the component tree, not just eleents
2022-01-25 12:01:19 +00:00
Niels Lange 59c8ddc531 Show single express payment button in full width (https://github.com/woocommerce/woocommerce-blocks/pull/5601)
* Show single express payment button in full width

* Change :first-child:nth-last-child(1) to :only-child
2022-01-24 10:22:02 +07:00
Tung Du 718f2dbc6f Mini Cart Contents: Support link and text colors (https://github.com/woocommerce/woocommerce-blocks/pull/5566) 2022-01-22 00:39:04 +07:00
Thomas Roberts aaaf6787a3 Add tests for phone field on checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5604) 2022-01-21 13:24:48 +00:00
Mike Jolley c25f8ec531 Manually update dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/5602)
* Add markdown-it and follow-redirects to package.

* fix eslint warning
2022-01-21 12:09:07 +00:00
Thomas Roberts 0d7b8ab95a Add tests for order notes component (https://github.com/woocommerce/woocommerce-blocks/pull/5605) 2022-01-21 12:07:36 +00:00
Mike Jolley bcba16e4a5 Prevent Redirect URL leaking between payment gateways (https://github.com/woocommerce/woocommerce-blocks/pull/5560)
* Reset redirectUrl to blank if not included in response.

* Force redirect URL for successful responses

* Revert "Force redirect URL for successful responses"

This reverts commit 61aae8b459843237b5428be8fa0cdb9500cd0485.
2022-01-20 11:25:40 +00:00
Luigi Teschio dd36c00180 Restore correct font style when the block is loaded in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/5600)
* Restore correct font style when the block is loaded in the editor

Restore correct font style when the block is loaded in the editor

* fix style on Twenty Twenty theme
2022-01-20 10:02:17 +01:00
Luigi Teschio 5f37425c90 Fix global style for Product Summary block, Product Stock Indicator block, and Product Title block (https://github.com/woocommerce/woocommerce-blocks/pull/5595)
* Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

Fix global style for Product Summary block, Product Stock Indicator block, and ProductTitle block

* add feature flag

* fix lint errors

* fix global style bugs on Product Title block
2022-01-19 15:02:30 +01:00
Mike Jolley c492a97d83 Fix default `stockStatusOptions` in tag and attribute blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5590)
* Fix default stockStatusOptions in tag and attribute blocks

These should be an array of keys, not objects.

* Fix stockStatus definition on PHP side

* Swap state to debounce.

* Improve presentation of stock filters

* Remove state usage for display options

* Remove debounce

* Consistent panel titles
2022-01-19 11:42:21 +00:00
Tom Cafferkey cf9c82e02e Allow LegacyTemplate block to be reinserted, only on WooCommerce block templates. (https://github.com/woocommerce/woocommerce-blocks/pull/5545)
* Set attribute of legacy template block when block is inserted

* Allow inserter on Woo templates only

* Allow correct legacy block straight from the inserter

* Use WP Data store outside component to register block

* Pass in all attribute data when registering block

* Accommodate templates targetted at specific products or taxonomies

* Replace beginsWith with startsWith

* Replace test data with production data

* Conditionally use stores selector if it exists

* Unsubscribe if the store does not exist

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-01-17 10:50:57 +00:00
Luigi Teschio 2a2aee49df Stock Indicator block: Add support for global style (https://github.com/woocommerce/woocommerce-blocks/pull/5525)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* Stock indicator block: add support for global style woocommerce/woocommerce-blocks#4965

Stock indicator block: add support for global style

* fix import after merge
2022-01-17 10:11:26 +01:00
Luigi Teschio dfa98dcb5e Price Filter block: enable global style woocommerce/woocommerce-blocks#4965 (https://github.com/woocommerce/woocommerce-blocks/pull/5559)
Price Filter block: enable global style woocommerce/woocommerce-blocks#4965
2022-01-17 10:10:26 +01:00
Niels Lange 599e395dc1 Fix inconsistent HTML of rating section (https://github.com/woocommerce/woocommerce-blocks/pull/5552) 2022-01-14 18:32:28 +07:00
Thomas Roberts c950f29400 Remove extra padding for cart sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5430)
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-01-13 17:10:18 +00:00
Raluca Stan b1bef86632 Fix Using / for division is deprecated warnings seen when building the project (https://github.com/woocommerce/woocommerce-blocks/pull/5556) 2022-01-13 15:01:36 +01:00
Alex Florisca a8d979c47b Default all product images to "cropped" and actual image width (https://github.com/woocommerce/woocommerce-blocks/pull/5551)
* Default imageSizing for the all products block to 'cropped'

* set max-width:100%, width: auto on product grid images
2022-01-12 17:50:48 +00:00
Luigi Teschio d2ef7143d9 Summary Product block: Add support for global style (https://github.com/woocommerce/woocommerce-blocks/pull/5524)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* Summary Product block: add support for global style woocommerce/woocommerce-blocks#4965

Summary Product block: add support for global style

* add color global style under feature flag

* fix import after merge

* fix typo
2022-01-12 16:31:25 +01:00
Luigi Teschio 9ad060b352 Product Title block: add support global style (https://github.com/woocommerce/woocommerce-blocks/pull/5515)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* fix global style title color (https://github.com/woocommerce/woocommerce-blocks/pull/5548)

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-01-12 14:33:46 +01:00
Luigi Teschio cba17c2ef9 Mini Cart block: re-enable background support woocommerce/woocommerce-blocks#4965 (https://github.com/woocommerce/woocommerce-blocks/pull/5539)
Mini Cart block: re-enable background support woocommerce/woocommerce-blocks#4965
2022-01-11 15:08:16 +01:00
Mike Jolley a5bd8f0564 Fix All Products Block Tests due to incorrect Stock Filter addition (https://github.com/woocommerce/woocommerce-blocks/pull/5541)
* Remove stock filter from all products block

* Add missing stock filter to product-category block
2022-01-11 11:25:05 +00:00
Mike Jolley a1695861f2 Add minimum quantity, maximum quantity, and step (multiple_of) to the Cart Block and Store API (https://github.com/woocommerce/woocommerce-blocks/pull/5406)
* add min and step to Store API

* add min and step support

* typo

* Update assets/js/base/components/quantity-selector/index.tsx

* Update assets/js/base/components/quantity-selector/index.tsx

* Fix debounce callback

* Style qty input to show steps

* Implement quantity_limits in API

* Quantity validation

* Update product API

* Normalize on + -

* Separate add to cart events from cart item events in regards to limits

* Prevent qty change for editable line items

* Unify filters

* Remove step number indicator from buttons ¯\_(ツ)_/¯

* Normalize on mount

* Update docs

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-01-11 11:09:59 +00:00
Mike Jolley e19abbc0c2 Remove Built-in Stripe Integration in favour of Stripe Extension (https://github.com/woocommerce/woocommerce-blocks/pull/5449)
* Remove Stripe from PHP side

* Remove stripe from client

* fix const name in tests

* Update docs
2022-01-11 10:53:38 +00:00
Thomas Roberts df6e27e22f Add margin below shipping packages in checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5529)
* Add margin below shipping packages in checkout

* Add margin below shipping packages in checkout but not in cart
2022-01-11 10:27:37 +00:00
jonny-bull 87cb033cbd Add stock level filter to product blocks (https://github.com/woocommerce/woocommerce-blocks/pull/4943) 2022-01-10 13:39:24 +00:00
Tung Du 14c1017feb Mini Cart Contents block improvements (https://github.com/woocommerce/woocommerce-blocks/pull/5446) 2022-01-08 08:19:01 +07:00
Tung Du 4b159f0fcd Allow inserting blocks to filled mini cart (https://github.com/woocommerce/woocommerce-blocks/pull/5527) 2022-01-08 07:51:20 +07:00
Raluca Stan 5c232fa7a1 Force a string token property for the activePaymentMethod (https://github.com/woocommerce/woocommerce-blocks/pull/5535) 2022-01-07 14:41:25 +01:00
Luigi Teschio c54440d0e1 Add wide and full alignment support for legacy template block (https://github.com/woocommerce/woocommerce-blocks/pull/5433)
* add align wide and full support for legacy template block

* fix PHP warning

* add a comment on get_markup_with_classes_by_attributes

* rename function

* add align wide and full support for legacy template block

* fix PHP warning

* add a comment on get_markup_with_classes_by_attributes

* rename function

* fix regex

* update regex

* update regex

* fix code styling
2022-01-07 10:47:48 +01:00
Luigi Teschio 340669bb90 Filter Products By Price block: don't allow to insert negative values on inputs (https://github.com/woocommerce/woocommerce-blocks/pull/5123)
* Don't allow to insert negative values on input for Filter Products By Price block woocommerce/woocommerce-blocks#2695

Don't allow to insert negative values on input for Filter Products By Price block

* renaming util functions and add comments
2022-01-06 15:30:34 +01:00
Luigi Teschio 549e10fabb Mini Cart Block: The color of the badge reflects the global style (https://github.com/woocommerce/woocommerce-blocks/pull/5477)
* Mini Cart Block: the color of the badge reflects the global style woocommerce/woocommerce-blocks#4965

Mini Cart Block: the color of the badge reflects the global style woocommerce/woocommerce-blocks#4965

* disable background
2022-01-06 09:47:34 +01:00
Lucio Giannotta 78a25b235f Legacy Template: Add warning about block removal (https://github.com/woocommerce/woocommerce-blocks/pull/5208)
Legacy blocks were previous locked for removal to avoid unintended
consequences. However, this would lock the ability to move the block within
other e.g. layout blocks and unnecessarily limit merchant customization ability.

Now that we have reverted this decision, merchants could delete this block,
which is likely **not** what they want to do. While we investigate other, more
long-term, solutions, we are adding a warning notice.

Refs woocommerce/woocommerce-blocks#5180. Fixes woocommerce/woocommerce-blocks#5207.

* Rename legacy blocks to avoid confusion with the term “Template”
2022-01-05 19:18:23 +01:00
Malith Senaweera 65835d3689 Fix duplicated error notices (https://github.com/woocommerce/woocommerce-blocks/pull/5476)
* Fix duplicated error notices

StoreNoticeProvider is already being used within Block component. This
removal prevents duplicated error notices within the Payment Options
section

* Move StoreNoticeProvider from payment block

Remove StoreNoticeProvider from payment block and move it to the parent
frontend block to avoid unnecessarily loading the notice provider
2022-01-04 17:37:46 +00:00
Luigi Teschio 723eabee80 Add global style for Active Filters block (https://github.com/woocommerce/woocommerce-blocks/pull/5465)
* Enable global style for active filters block

* show blacklisted blocks in full site editing side

* fix test

* --amend

* fix check
2022-01-03 10:41:19 +01:00
Mike Jolley 0e53cea85c Fix initial population of address data in `useCustomerData` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5473)
* Re-init customer data once cart has loaded

* Tweak typedef

* Track changes without capturing blank initial state in useCheckoutAddress
2021-12-31 16:10:43 +01:00
Thomas Roberts a8e094473c Revert "Remove extra padding for cart sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5247)" (https://github.com/woocommerce/woocommerce-blocks/pull/5429)
This reverts commit a60cd66692.
2021-12-30 12:24:18 +00:00
Thomas Roberts 5036c69638 Add E2E tests for Filter blocks (Price, Attribute, and Active Filters) (https://github.com/woocommerce/woocommerce-blocks/pull/4562)
* Add clear and fill input test util

* Add tests for Filter Products by Price

* Add class name to filter products by price block in editor

* Update wp-env

* Fix formatting

* Update lock

* Revert "Update lock"

This reverts commit f4e809e000430eea3972c94fd2aea0a19ba6961b.

* Create product attributes during setup

* Remove product attributes during teardown

* Add attributes in fixture-data

* Add two new products, for attribute testing

* Load attributes into store and apply them to products

* Add class to Filter by Attribute when editing

This is so it can be targeted in E2E tests more easily.

* Add tests for Filter Product by Attribute

* Fix formatting in attribute-filter.test.js

* Add tests for active filters block

* Add doc block for ensuteCleanAttributes

* Update wording of title test in all filter block E2E

* Update test wording to read better

* Update snapshots

* Use pptr-testing-library selectors to click elements

This makes the tests easier to reason with, and lets us take a step back from the implementation details (classnames etc.)

* Add saveOrPublish test util

* Use pptr-testing-library selectors to click elements in attribute filter

* Use pptr-testing-library selectors to click elements in price filter

* Add `puppeteer-testing-library`

* Use puppeteer-testing-library API to look for H6 button

* Use correct argument in jest-puppeteer.dev.config

* Update package.json & package-lock.json

* remove tests for 5.3

* remove snapshots

* Remove ensureCleanAttributes

* Remove puppeteer-testing-library, install missing expect-puppeteer package and update tests

The puppeteer-testing-library, although added by gutenberg is not actively used.
I have removed it and realised that the added functionality can be easily replaced by expect-puppeteer.
This is a package that we specify in the jest configuration but it was not part of our package.json.
The selectors from puppeteer-testing-library have been replaced with .toClick and the utility clearAndFillInput with .toFill

The Filter by Attribute block has been skiped until tests are fixed.

* Add back setupPageSettings to jest setup

* Fix filter by attribute block test

* Fix linting error

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2021-12-23 17:26:10 +01:00