-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Button] Add tests for buttonFrom
and buttonsFrom
#11037
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buttonFrom
and buttonsFrom
kyledurand
approved these changes
Oct 26, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Merged
laurkim
pushed a commit
that referenced
this pull request
Oct 30, 2023
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris-migrator@0.26.2 ### Patch Changes - [#11029](#11029) [`ca67934e0`](ca67934) Thanks [@lgriffee](https://github.com/lgriffee)! - Update `v12-styles-replace-custom-property-color` migration with additional tokens - Updated dependencies \[[`73b1d5d2c`](73b1d5d)]: - @shopify/polaris-tokens@8.0.2 - @shopify/stylelint-polaris@15.0.2 ## @shopify/polaris@12.0.2 ### Patch Changes - [#11037](#11037) [`f81abddba`](f81abdd) Thanks [@chloerice](https://github.com/chloerice)! - Added tests for `buttonFrom` and `buttonsFrom` utility functions - [#11061](#11061) [`74fb5d5c6`](74fb5d5) Thanks [@laurkim](https://github.com/laurkim)! - Fixed border radius styling on `TextField.Spinner` component - [#11062](#11062) [`78ff4e665`](78ff4e6) Thanks [@chloerice](https://github.com/chloerice)! - Updated `ContextualSaveBar` icon to `RiskMajor` and updated logos in examples to Shopify logo - [#11052](#11052) [`27317aa4b`](27317aa) Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed destructive states for PageActions and Page SecondaryActions - [#11053](#11053) [`caf553126`](caf5531) Thanks [@laurkim](https://github.com/laurkim)! - Removed `experimental` flag from Badge `tone` types - [#11049](#11049) [`7508e7014`](7508e70) Thanks [@sophschneider](https://github.com/sophschneider)! - Fixed Banner InlineIconBanner variant dismiss icon position when hideIcon is true - [#10808](#10808) [`b0d5750b0`](b0d5750) Thanks [@jesstelford](https://github.com/jesstelford)! - [IndexFilters] Loading spinner moved to be a suffix within the search box. - Updated dependencies \[[`73b1d5d2c`](73b1d5d)]: - @shopify/polaris-tokens@8.0.2 ## @shopify/polaris-tokens@8.0.2 ### Patch Changes - [#10602](#10602) [`73b1d5d2c`](73b1d5d) Thanks [@patrickDouglas](https://github.com/patrickDouglas)! - Export types missing for the Typescript Compiler (tsc) when using Node16/Bundler Module Resolution. ## @shopify/stylelint-polaris@15.0.2 ### Patch Changes - Updated dependencies \[[`73b1d5d2c`](73b1d5d)]: - @shopify/polaris-tokens@8.0.2 ## polaris.shopify.com@0.60.0 ### Minor Changes - [#11045](#11045) [`a1c13938f`](a1c1393) Thanks [@lgriffee](https://github.com/lgriffee)! - Add v12 polaris migrator documentation ### Patch Changes - [#10795](#10795) [`e78051a80`](e78051a) Thanks [@SMAKSS](https://github.com/SMAKSS)! - Fixed typos in `<Text />` variant tokens - [#11051](#11051) [`f2fabff25`](f2fabff) Thanks [@lgriffee](https://github.com/lgriffee)! - Alphabetize component list in v11 to v12 migration guide - [#11029](#11029) [`ca67934e0`](ca67934) Thanks [@lgriffee](https://github.com/lgriffee)! - Update `v12-styles-replace-custom-property-color` migration with additional tokens - Updated dependencies \[[`f81abddba`](f81abdd), [`74fb5d5c6`](74fb5d5), [`78ff4e665`](78ff4e6), [`27317aa4b`](27317aa), [`caf553126`](caf5531), [`7508e7014`](7508e70), [`73b1d5d2c`](73b1d5d), [`b0d5750b0`](b0d5750)]: - @shopify/polaris@12.0.2 - @shopify/polaris-tokens@8.0.2 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AnnaCheba
pushed a commit
to AnnaCheba/polaris
that referenced
this pull request
Apr 22, 2024
### WHY are these changes introduced? To prevent type errors from slipping through as Button API undergoes continued alignment, the `buttonFrom` utility needs tests. Right now in v12 the Button boolean props no longer exist as they were replaced with `variant` and `tone`, but `Action` and its extended types still support `destructive`, `plain`, etc. `buttonFrom` takes a `ComplexAction` as its first param and a `Partial<ButtonProps>` object as an optional second param. The utility was not mapping the action boolean properties to `variant` and `tone` as expected (fixed in Shopify#11028). This went uncaught because there were no tests and no stories rendering button variants created with the utility (like Modal's `primaryAction`). ### WHAT is this pull request doing? This PR adds tests for `buttonFrom` and `buttonsFrom`.
ascherkus
pushed a commit
to ascherkus/polaris
that referenced
this pull request
Feb 19, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris-migrator@0.26.2 ### Patch Changes - [Shopify#11029](Shopify#11029) [`ca67934e0`](Shopify@cdfc606) Thanks [@lgriffee](https://github.com/lgriffee)! - Update `v12-styles-replace-custom-property-color` migration with additional tokens - Updated dependencies \[[`73b1d5d2c`](Shopify@8c8bdc0)]: - @shopify/polaris-tokens@8.0.2 - @shopify/stylelint-polaris@15.0.2 ## @shopify/polaris@12.0.2 ### Patch Changes - [Shopify#11037](Shopify#11037) [`f81abddba`](Shopify@2c8209b) Thanks [@chloerice](https://github.com/chloerice)! - Added tests for `buttonFrom` and `buttonsFrom` utility functions - [Shopify#11061](Shopify#11061) [`74fb5d5c6`](Shopify@46467a7) Thanks [@laurkim](https://github.com/laurkim)! - Fixed border radius styling on `TextField.Spinner` component - [Shopify#11062](Shopify#11062) [`78ff4e665`](Shopify@c8db6f6) Thanks [@chloerice](https://github.com/chloerice)! - Updated `ContextualSaveBar` icon to `RiskMajor` and updated logos in examples to Shopify logo - [Shopify#11052](Shopify#11052) [`27317aa4b`](Shopify@b7c8685) Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed destructive states for PageActions and Page SecondaryActions - [Shopify#11053](Shopify#11053) [`caf553126`](Shopify@77e9c8b) Thanks [@laurkim](https://github.com/laurkim)! - Removed `experimental` flag from Badge `tone` types - [Shopify#11049](Shopify#11049) [`7508e7014`](Shopify@84aad13) Thanks [@sophschneider](https://github.com/sophschneider)! - Fixed Banner InlineIconBanner variant dismiss icon position when hideIcon is true - [Shopify#10808](Shopify#10808) [`b0d5750b0`](Shopify@f68d5bb) Thanks [@jesstelford](https://github.com/jesstelford)! - [IndexFilters] Loading spinner moved to be a suffix within the search box. - Updated dependencies \[[`73b1d5d2c`](Shopify@8c8bdc0)]: - @shopify/polaris-tokens@8.0.2 ## @shopify/polaris-tokens@8.0.2 ### Patch Changes - [Shopify#10602](Shopify#10602) [`73b1d5d2c`](Shopify@8c8bdc0) Thanks [@patrickDouglas](https://github.com/patrickDouglas)! - Export types missing for the Typescript Compiler (tsc) when using Node16/Bundler Module Resolution. ## @shopify/stylelint-polaris@15.0.2 ### Patch Changes - Updated dependencies \[[`73b1d5d2c`](Shopify@8c8bdc0)]: - @shopify/polaris-tokens@8.0.2 ## polaris.shopify.com@0.60.0 ### Minor Changes - [Shopify#11045](Shopify#11045) [`a1c13938f`](Shopify@3bcae1f) Thanks [@lgriffee](https://github.com/lgriffee)! - Add v12 polaris migrator documentation ### Patch Changes - [Shopify#10795](Shopify#10795) [`e78051a80`](Shopify@23f1840) Thanks [@SMAKSS](https://github.com/SMAKSS)! - Fixed typos in `<Text />` variant tokens - [Shopify#11051](Shopify#11051) [`f2fabff25`](Shopify@8aedb53) Thanks [@lgriffee](https://github.com/lgriffee)! - Alphabetize component list in v11 to v12 migration guide - [Shopify#11029](Shopify#11029) [`ca67934e0`](Shopify@cdfc606) Thanks [@lgriffee](https://github.com/lgriffee)! - Update `v12-styles-replace-custom-property-color` migration with additional tokens - Updated dependencies \[[`f81abddba`](Shopify@2c8209b), [`74fb5d5c6`](Shopify@46467a7), [`78ff4e665`](Shopify@c8db6f6), [`27317aa4b`](Shopify@b7c8685), [`caf553126`](Shopify@77e9c8b), [`7508e7014`](Shopify@84aad13), [`73b1d5d2c`](Shopify@8c8bdc0), [`b0d5750b0`](Shopify@f68d5bb)]: - @shopify/polaris@12.0.2 - @shopify/polaris-tokens@8.0.2 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
To prevent type errors from slipping through as Button API undergoes continued alignment, the
buttonFrom
utility needs tests. Right now in v12 the Button boolean props no longer exist as they were replaced withvariant
andtone
, butAction
and its extended types still supportdestructive
,plain
, etc.buttonFrom
takes aComplexAction
as its first param and aPartial<ButtonProps>
object as an optional second param. The utility was not mapping the action boolean properties tovariant
andtone
as expected (fixed in #11028). This went uncaught because there were no tests and no stories rendering button variants created with the utility (like Modal'sprimaryAction
).WHAT is this pull request doing?
This PR adds tests for
buttonFrom
andbuttonsFrom
.