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

adds missing tests to Page and its sub-components #526

Merged
merged 13 commits into from Nov 15, 2018
Merged

Conversation

kvendrik
Copy link
Member

@kvendrik kvendrik commented Nov 1, 2018

WHY are these changes introduced?

fixes https://github.com/Shopify/polaris-react-deprecated/issues/2438

WHAT is this pull request doing?

  • Adds missing tests to Page and its sub-components.
  • Removes indicator logic (more details here ca283f3).

@kvendrik kvendrik added Testing 🤖Skip Changelog Causes CI to ignore changelog update check. labels Nov 1, 2018
@BPScott BPScott temporarily deployed to polaris-react-pr-526 November 1, 2018 16:37 Inactive
Removed the indicator logic as its not being used right now, there is no scenario in which it was being rendered. More details on why  here: Shopify/polaris-react-deprecated#1550.
@kvendrik kvendrik changed the title [WIP] adds missing tests to Page and its sub-components adds missing tests to Page and its sub-components Nov 6, 2018
@danrosenthal
Copy link
Contributor

danrosenthal commented Nov 13, 2018

@kvendrik is this still a WIP, or is it ready to be reviewed? Looks like the WIP bot is picking up a work in progress from a linked PR.

@kvendrik
Copy link
Member Author

kvendrik commented Nov 13, 2018

@danrosenthal this is ready to be reviewed, tagged @solonaarmstrong last week but looks like she hasn't had time yet. 😄 Not sure why the WIP test is still in progress it looks like its not triggering when I change the PR title.

@kvendrik kvendrik changed the title adds missing tests to Page and its sub-components [WIP] adds missing tests to Page and its sub-components Nov 13, 2018
@kvendrik kvendrik changed the title [WIP] adds missing tests to Page and its sub-components adds missing tests to Page and its sub-components Nov 13, 2018
Copy link
Member

@chloerice chloerice left a comment

Choose a reason for hiding this comment

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

You make writing tests look easy 😅 🙌 Rebase && :shipit:

@BPScott BPScott temporarily deployed to polaris-react-pr-526 November 14, 2018 15:46 Inactive
@solonaarmstrong-zz
Copy link

You make writing tests look easy

That he does!

@@ -0,0 +1,99 @@
import * as React from 'react';
import {Icon, UnstyledLink} from 'components';
Copy link

Choose a reason for hiding this comment

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

I'm not sure we can import this way? I think they need to be imported from their respective folders.

});

describe('children', () => {
it('get rendered when an icon is present', () => {

Choose a reason for hiding this comment

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

gets?

expect(onActionSpy).toHaveBeenCalledTimes(1);
});
});
});

Choose a reason for hiding this comment

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

Should this have a test for disclosure?

Copy link
Member Author

@kvendrik kvendrik Nov 15, 2018

Choose a reason for hiding this comment

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

There is a test that makes sure the children get rendered when disclosure is defined (because of the if statement that controls how they get rendered based on if disclosure is defined). Apart from that the only related behaviour is the addition of an icon which is purely presentational and we therefor probably want to leave to the VRT.

@@ -20,11 +17,9 @@ class ActionGroup extends React.Component<Props, never> {
render() {
const {actions, details, title, icon, active} = this.props;

const detailsMarkup = details ? (
const detailsMarkup = details && (

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member Author

@kvendrik kvendrik Nov 15, 2018

Choose a reason for hiding this comment

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

Wasn't necessary just came past it and decided to clean it up. 😄

Choose a reason for hiding this comment

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

I'm not clear on when we use &&. Wouldn't this need to be null if it doesn't pass the condition, since it's markup?

Copy link
Member Author

@kvendrik kvendrik Nov 15, 2018

Choose a reason for hiding this comment

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

Its explained more in-depth in React's docs but the short answer is that undefined is part of type ReactNode 😄 . So whenever you need to render a component conditionally instead of someCondition ? <Component /> : null you can simply do someCondition && <Component />.

@ghost
Copy link

ghost commented Nov 15, 2018

🎉 Thanks for your contribution to Polaris React!

@kvendrik kvendrik deleted the fix/page-tests branch November 15, 2018 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖Skip Changelog Causes CI to ignore changelog update check.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants