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

Give close button on flyout a data-test-subj #1000

Conversation

stacey-gammon
Copy link
Contributor

Will be useful for elastic/kibana#20163

@@ -53,14 +39,17 @@ export class EuiFlyout extends Component {
color="text"
aria-label="Closes this dialog"
onClick={onClose}
data-test-subj="euiFlyoutCloseButton"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something that can be passed down via {...props}? Like if we added closeButtonProps that accepted an object of props and here just spread them into the close button.

My worry with hard-coding this value is if there are multiple flyouts on the page, it might not know which close button is being targeted and so you could get a false pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea that's a downside. We could do that too. I don't feel strongly either way, though if we do go that route, we could put onClose in that too (but then it should be onClick) closeButtonProps = { onClick, data-test-subj, aria-label }.

I'm game with either.

Copy link
Contributor

@cjcenizal cjcenizal Jul 11, 2018

Choose a reason for hiding this comment

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

I think this is the kind of situation where it makes sense to hard-code the data-test-subj. We do the same thing for the close button in toasts and for the clear and toggle buttons in the combo box, and rely on the consumer to add a scoping data-test-subj to the particular instance of the component itself to avoid conflicts.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

LGTM! Was the reformatting done automatically by your IDE @stacey-gammon?

@cjcenizal
Copy link
Contributor

Looks like the Jest snapshots need to be updated.

CHANGELOG.md Outdated
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `1.2.1`.
- Gave Flyout close button a data-test-subj ([#1000](https://github.com/elastic/eui/pull/1000/files))
Copy link
Contributor

@cjcenizal cjcenizal Jul 11, 2018

Choose a reason for hiding this comment

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

Maybe change this to:

- Gave `EuiFlyout` close button a `data-test-subj` etc...

for consistency?

@stacey-gammon
Copy link
Contributor Author

Was the reformatting done automatically by your IDE @stacey-gammon?

yep. I have since turned it off for the eui repo because it reformatted all of CHANGELOG.md.

@stacey-gammon
Copy link
Contributor Author

Re: jest snapshots. Can you walk me through that @cjcenizal ? Looks like the commands are a bit different for eui vs Kibana. I ran yarn then yarn jest but everything failed with:

  ● renders EuiModalBody

    
          Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none. To
          configure an adapter, you should call `Enzyme.configure({ adapter: new Adapter() })`
          before using any of Enzyme's top level APIs, where `Adapter` is the adapter
          corresponding to the library currently being tested. For example:
    
          import Adapter from 'enzyme-adapter-react-15';
    
          To find out more about this, see http://airbnb.io/enzyme/docs/installation/index.html

don't see anything in contributing doc re: how to run jest tests.

@stacey-gammon
Copy link
Contributor Author

nm i found the docs. I need to read more thoroughly. :)

@cjcenizal
Copy link
Contributor

nm i found the docs

Oh good because I was just about to look for them! 😄

@stacey-gammon stacey-gammon merged commit 43a82b3 into elastic:master Jul 11, 2018
@stacey-gammon stacey-gammon deleted the 2018-07-11-data-test-subj-for-flyout-close branch July 11, 2018 19:06
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.

3 participants