Skip to content

Conversation

@hertweckhr1
Copy link
Contributor

Description

  • added disableEdgeDetectionProp to Popover passed from popper.js
  • verified spread works properly on all components using popover under the covers.
  • added example in popover
  • added links to all popover-derived components (localizationEditor, combo box, time picker, multi input) back to popover in propDescriptions

fixes #540

@hertweckhr1 hertweckhr1 requested a review from a team May 17, 2019 16:58
@netlify
Copy link

netlify bot commented May 17, 2019

Deploy preview for fundamental-react ready!

Built with commit a1bbef0

https://deploy-preview-546--fundamental-react.netlify.com

Copy link
Contributor

@jbadan jbadan left a comment

Choose a reason for hiding this comment

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

I think here: https://github.com/SAP/fundamental-react/blob/master/src/Popover/Popover.js#L102 would be a good place to add a link to the Popper.js documentation.

Other than my few housekeeping changes this is looking really good!!

// popover with no disable edge detection
component = renderer.create(popOverDisableEdgeDetection);
tree = component.toJSON();
expect(tree).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this actually tests anything. I can't think of a useful unit test for this, perhaps it's time to bite the bullet and set up puppeteer? Thoughts @greg-a-smith ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this test doesn't really do anything. The only way to visually test this prop is to open the popover and scroll to a point where it should flip and then verify it doesn't.

Since that functionality is really core to popper.js, we could probably get away with a test that makes sure our internal Popper component gets this value passed to it and the modifiers are set correctly. Let me know if you need/want more explanation on that.


TimePicker.propDescriptions = {
...Time.propDescriptions,
popoverProps: 'Additional props to be spread to the [Popover](/popover) component.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a default for this? If not, we should add one so we don't have to rewrite it in all the components.

Copy link
Contributor

Choose a reason for hiding this comment

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

See previous note about using defaults.js.

ComboboxInput.propDescriptions = {
menu: 'An object containing a `Menu` component.'
menu: 'An object containing a `Menu` component.',
popoverProps: 'Additional props to be spread to the [Popover](/popover) component.'
Copy link
Contributor

Choose a reason for hiding this comment

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

This actually already exists in the defaults.js file albeit with "Popover" marked in backticks rather than a link. I think making it a link is a good idea, but then it should be edited in defaults.js so all components get the same change.

language: 'Text to display on the `<button>` element. Meant to be the language of the text in the `<input>`/`<textarea>` element.'
},
menu: 'An array of objects that represent the values of the elements in the dropdown menu. The shape of the objects in the array is `{ placeholder: string, language: string, inputProps: object }`.',
popoverProps: 'Additional props to be spread to the [Popover](/popover) component.',
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous note about using defaults.js.

localizedTextShape: {
imageLabel: 'Aria-label in <div> element for image.'
},
popoverProps: 'Additional props to be spread to the [Popover](/popover) component.',
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous note about using defaults.js.

<Popover
body={bodyContent}
control={<Button glyph='navigation-down-arrow' option='light' />}
disableEdgeDetection='true'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about boolean props.

// popover with no disable edge detection
component = renderer.create(popOverDisableEdgeDetection);
tree = component.toJSON();
expect(tree).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this test doesn't really do anything. The only way to visually test this prop is to open the popover and scroll to a point where it should flip and then verify it doesn't.

Since that functionality is really core to popper.js, we could probably get away with a test that makes sure our internal Popper component gets this value passed to it and the modifiers are set correctly. Let me know if you need/want more explanation on that.


TimePicker.propDescriptions = {
...Time.propDescriptions,
popoverProps: 'Additional props to be spread to the [Popover](/popover) component.',
Copy link
Contributor

Choose a reason for hiding this comment

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

See previous note about using defaults.js.

Copy link
Contributor

@jbadan jbadan left a comment

Choose a reason for hiding this comment

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

Everything looks great to me! 🎉🚢

noArrow: 'Set to **true** to render a popover without an arrow.',
placement: 'Initial position of the `body` (overlay) related to the `control`.',
popperProps: 'Additional props to be spread to the overlay element.',
popperProps: 'Additional props to be spread to the overlay element, supported by <a href="https://popper.js.org" target="blank">popper.js</a>.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Although it appears to work, the correct target value is _blank.

Copy link
Contributor

@greg-a-smith greg-a-smith left a comment

Choose a reason for hiding this comment

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

Looks good. 🚢

@hertweckhr1 hertweckhr1 merged commit 55381e5 into master May 22, 2019
@hertweckhr1 hertweckhr1 deleted the 6605disableEdgeDetection branch May 22, 2019 16:44
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.

Need to create disable edge detection prop for Popover

4 participants