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

Added OUIA compatibility for Dropdown #3135

Merged
merged 1 commit into from Oct 17, 2019

Conversation

@quarckster
Copy link
Contributor

quarckster commented Oct 14, 2019

Part of #2423

What: Added OUIA props to Dropdown as per #2423

@quarckster

This comment has been minimized.

Copy link
Contributor Author

quarckster commented Oct 14, 2019

@redallen please help with type matching. Build failed due to this issue.

@quarckster quarckster mentioned this pull request Oct 14, 2019
2 of 5 tasks complete
@karelhala

This comment has been minimized.

Copy link
Contributor

karelhala commented Oct 15, 2019

@quarckster looks like the problem was with incorrect onSelect type. This should do the trick.

diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/Dropdown.tsx b/packages/patternfly-4/react-core/src/components/Dropdown/Dropdown.tsx
index 4cc061c65..86ee33ed3 100644
--- a/packages/patternfly-4/react-core/src/components/Dropdown/Dropdown.tsx
+++ b/packages/patternfly-4/react-core/src/components/Dropdown/Dropdown.tsx
@@ -23,7 +23,7 @@ export interface DropdownProps extends React.HTMLProps<HTMLDivElement> {
   /** Toggle for the dropdown, examples: <DropdownToggle> or <DropdownToggleCheckbox> */
   toggle: React.ReactElement<any>;
   /** Function callback called when user selects item */
-  onSelect?(event: React.SyntheticEvent<HTMLDivElement>): void;
+  onSelect?(event?: React.SyntheticEvent<HTMLDivElement>): void;
   /** Flag to indicate if the first dropdown item should gain initial focus, set false when adding
    * a specific auto-focus item (like a current selection) otherwise leave as true
    */
diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/DropdownWithContext.tsx b/packages/patternfly-4/react-core/src/components/Dropdown/DropdownWithContext.tsx
index fe1ea2218..307e825e8 100644
--- a/packages/patternfly-4/react-core/src/components/Dropdown/DropdownWithContext.tsx
+++ b/packages/patternfly-4/react-core/src/components/Dropdown/DropdownWithContext.tsx
@@ -21,7 +21,7 @@ class DropdownWithContext extends React.Component<DropdownProps & InjectedOuiaPr
     isGrouped: false,
     position: DropdownPosition.left,
     direction: DropdownDirection.down,
-    onSelect: Function.prototype,
+    onSelect: (): void => undefined,
     autoFocus: true,
     ouiaComponentType: 'Dropdown'
   };

Also don't forget to run node_modules/.bin/jest -u packages/patternfly-4/react-core/src/components/ in order to update your snapshots.

@redallen

This comment has been minimized.

Copy link
Contributor

redallen commented Oct 15, 2019

@quarckster I believe @karelhala is correct. This mismatching type for onSelect is Function vs (event: SyntheticEvent<HTMLDivElement, Event>) => void.

@dlabrecq dlabrecq dismissed their stale review Oct 16, 2019

Didn't see the mismatching type

@quarckster quarckster force-pushed the quarckster:dropdown_ouia branch from c18bd0f to 77e90dc Oct 16, 2019
@quarckster quarckster changed the title [WIP] Added OUIA compatibility for Dropdown Added OUIA compatibility for Dropdown Oct 16, 2019
@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Oct 16, 2019

PatternFly-React preview: https://patternfly-react-pr-3135.surge.sh

@quarckster quarckster force-pushed the quarckster:dropdown_ouia branch from 77e90dc to 377ef0b Oct 16, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Oct 16, 2019

Codecov Report

Merging #3135 into master will decrease coverage by <.01%.
The diff coverage is 70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3135      +/-   ##
==========================================
- Coverage   68.98%   68.98%   -0.01%     
==========================================
  Files         858      858              
  Lines       23612    23621       +9     
  Branches     1887     1889       +2     
==========================================
+ Hits        16288    16294       +6     
- Misses       6364     6366       +2     
- Partials      960      961       +1
Flag Coverage Δ
#misc 95.45% <ø> (ø) ⬆️
#patternfly3 69.3% <ø> (ø) ⬆️
#patternfly4 67.93% <70%> (-0.01%) ⬇️
Impacted Files Coverage Δ
...-4/react-core/src/components/Dropdown/Dropdown.tsx 100% <ø> (ø) ⬆️
...re/src/components/Dropdown/DropdownWithContext.tsx 90.32% <70%> (-4.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73c6169...a7390a7. Read the comment docs.

@karelhala karelhala added the ouia label Oct 16, 2019
@karelhala

This comment has been minimized.

Copy link
Contributor

karelhala commented Oct 16, 2019

Looks like the table snapshots were not updated @quarckster can you run node_modules/.bin/jest -u packages/patternfly-4/ to fix the failing tests as well?

@quarckster quarckster force-pushed the quarckster:dropdown_ouia branch from 377ef0b to a7390a7 Oct 17, 2019
@quarckster

This comment has been minimized.

Copy link
Contributor Author

quarckster commented Oct 17, 2019

@redallen redallen merged commit 8a9d853 into patternfly:master Oct 17, 2019
8 checks passed
8 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_integration Your tests passed on CircleCI!
Details
ci/circleci: build_pf3_docs Your tests passed on CircleCI!
Details
ci/circleci: build_pf4_docs Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test_jest_other Your tests passed on CircleCI!
Details
ci/circleci: test_jest_pf4 Your tests passed on CircleCI!
Details
ci/circleci: upload_docs Your tests passed on CircleCI!
Details
@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Oct 17, 2019

Your changes have been released in:

  • @patternfly/react-core@3.116.2
  • @patternfly/react-docs@4.14.28
  • @patternfly/react-inline-edit-extension@2.11.97
  • demo-app-ts@3.7.11
  • @patternfly/react-table@2.23.13
  • @patternfly/react-topology@2.9.6
  • @patternfly/react-virtualized-extension@1.2.79

Thanks for your contribution! 🎉

@quarckster quarckster deleted the quarckster:dropdown_ouia branch Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.