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

Fixes #1947 | Create ClayTable component #2019

Closed
wants to merge 79 commits into from

Conversation

diegonvs
Copy link
Contributor

@diegonvs diegonvs commented May 23, 2019

  • Component

  • Tests

  • Stories

  • Migration guide

  • What do think folks about using Structural testing with Storybook? I think that is another way to cover all our Jest Snapshots :)

  • Sometimes, for a better experience in stories, some components with state are needed. So I'm creating some of them inside fixtures folder. However we could have a global package for fixtures for using in storybook without publishing them. What do you think?

  • Another question is: Would be a good practice cover all possibilities using helper classes on our Composable Components?

@diegonvs diegonvs changed the base branch from master to develop May 23, 2019 19:21
@diegonvs diegonvs changed the title Fixes #1947 | Update lockfile Fixes #1947 | Create ClayTable component May 23, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2567

  • 33 of 33 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 83.271%

Totals Coverage Status
Change from base Build 2555: 0.5%
Covered Lines: 890
Relevant Lines: 1025

💛 - Coveralls

packages/clay-table/src/Body.tsx Outdated Show resolved Hide resolved
packages/clay-table/src/Cell.tsx Show resolved Hide resolved
packages/clay-table/src/Cell.tsx Outdated Show resolved Hide resolved
packages/clay-table/src/Cell.tsx Outdated Show resolved Hide resolved
packages/clay-table/src/Cell.tsx Outdated Show resolved Hide resolved
packages/clay-table/src/Cell.tsx Outdated Show resolved Hide resolved
*/

import * as React from 'react';
import * as TestRenderer from 'react-test-renderer';
Copy link
Member

Choose a reason for hiding this comment

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

I think we can only use react-testing-library from now on. What do you think @bryceosterhaus?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think it'd be a good rule of thumb to opt for always using react-testing-library and especially testing any functional parts of the component. I'm growing less and less confident in snapshots since its so easy to just "update all"

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. I think a snapshot is mostly only useful as a smoke test (ie. did it render at all?) and as an informational document of (not a meaningful assertion about) what the component currently produces.

Head: TableHeadType;
Row: TableRowType;
} = ({
bodyVerticalAlignment,
Copy link
Member

Choose a reason for hiding this comment

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

I'm just a bit reluctant with this bunch of APIs that we have to set up the classes, this is pretty cool but I'm worried because it raises our maintenance layer above the API's, that's a bit worrisome, I'd try to put it on the balance and not need to add everything we have in classes. One thing that can help us with that and add only those that the Lexicon provides and className will do the rest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think about it @bryceosterhaus @pat270? Would be a good idea leave some APIs using css utilities on the component?

packages/clay-table/src/index.tsx Outdated Show resolved Hide resolved
@matuzalemsteles
Copy link
Member

hey @diegonvs I would also try to narrow down the stories with the full use cases by adding many rows and columns, I think it would be enough to just show the low-level components and maybe a complete storie composing them all. Since we are discussing the high-level in #2017 we will probably have to reorganize our stories to list examples with the low-level and high-level ones.

...otherProps
}) => {
return (
<tbody {...otherProps} className={className}>
Copy link
Member

Choose a reason for hiding this comment

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

No need to declare className here. It'll already be there with ...otherProps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

...otherProps
}) => {
return (
<thead {...otherProps} className={className}>
Copy link
Member

Choose a reason for hiding this comment

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

no need to declare className here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Body: TableBodyType;
Cell: TableCellType;
Head: TableHeadType;
Row: TableRowType;
Copy link
Member

Choose a reason for hiding this comment

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

Rather than export these types from their components you can just do something like

Body: typeof TableBody;
Cell: typeof TableCell;
Head: typeof TableHead;
Row: typeof TableRow;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

matuzalemsteles and others added 24 commits May 27, 2019 15:45
@diegonvs
Copy link
Contributor Author

I gonna reopen this PR to solve merge conflicts and git history.

@diegonvs diegonvs closed this May 28, 2019
@diegonvs
Copy link
Contributor Author

reopened at #2026

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.

7 participants