Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add runtime warning/errors to components #2007

Merged
merged 2 commits into from
Jul 8, 2024
Merged

Conversation

booc0mtaco
Copy link
Contributor

@booc0mtaco booc0mtaco commented Jul 5, 2024

  • add utility function for doing the logging
  • use in various components (Link, Button, util.s)
  • add additional tests

Test Plan:

  • Wrote automated tests
  • CI tests / new tests are not applicable
  • Manually tested my changes, but I want to keep the details secret
  • Created and used an alpha publish
  • Manually tested my changes, and here are the details:

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.58%. Comparing base (807485e) to head (b8771ee).

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2007      +/-   ##
==========================================
+ Coverage   97.53%   97.58%   +0.05%     
==========================================
  Files         108      109       +1     
  Lines        2555     2572      +17     
  Branches      640      645       +5     
==========================================
+ Hits         2492     2510      +18     
+ Misses         61       60       -1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jul 5, 2024

size-limit report 📦

Path Size
components 88.47 KB (+0.88% 🔺)
styles 27.65 KB (0%)

@booc0mtaco booc0mtaco requested review from jgao-czi, jeremiah-clothier and a team July 5, 2024 19:38
@booc0mtaco booc0mtaco force-pushed the aholloway/EDS-1367 branch 4 times, most recently from e71034a to 296218c Compare July 5, 2024 20:16
@@ -7,6 +7,17 @@ import * as stories from './Button.stories';
import type { StoryFile } from '../../util/utility-types';

describe('<Button />', () => {
beforeEach(() => {
const consoleMock = jest.spyOn(console, 'error');
const consoleWarnMock = jest.spyOn(console, 'warn');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is consoleWarnMock used to hide warning messages while tests run? I don't see it used apart from consoleWarnMock.mockImplementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good callout. I forgot to add an expect to make sure this isn't called at all .toHaveBeenCalledTimes(0)

typeof isDisabled === 'undefined' &&
typeof other.disabled !== 'undefined',
],
'Use "isDisabled" instead of "disabled" on button instances',
Copy link
Contributor

Choose a reason for hiding this comment

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

For more context, what cases is this warning for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be when using disabled instead of isDisabled, that situation where the UI shows that red dotted outline around a button (e.g., this case)

Instead of just a visual warning, this now will include some console warnings (or errors)

- add utility function for doing the logging
- use in various components (Link, Button, util.s)
- fix violations in EDS identified by these checks
- add additional tests
@booc0mtaco
Copy link
Contributor Author

@jeremiah-clothier thanks !

@booc0mtaco booc0mtaco merged commit 661130b into next Jul 8, 2024
10 checks passed
@booc0mtaco booc0mtaco deleted the aholloway/EDS-1367 branch July 8, 2024 16:45
This was referenced Jul 12, 2024
booc0mtaco added a commit that referenced this pull request Jul 15, 2024
## [15.1.0](v15.0.1...v15.1.0) (2024-07-15)

[Storybook](https://61313967cde49b003ae2a860-qztphlqyid.chromatic.com/)

### Features

* add runtime warning/errors to components ([#2007](#2007)) ([661130b](661130b))
* **InputField:** add show/hide button for password field type ([#2006](#2006)) ([52d9ca0](52d9ca0))
* **Modal:** add height property to modal API ([#2011](#2011)) ([8d0c68f](8d0c68f))


### Bug Fixes

* **Icon:** update pencil icon to latest design ([#2016](#2016)) ([cb8d1a7](cb8d1a7))
* **Link:** apply font weight to standalone sizes ([#2015](#2015)) ([2e47271](2e47271))
* **Select:** expose generic types to allow by to pass type checks ([#2008](#2008)) ([421c91b](421c91b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants