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

Dropdown Menu: Document, test, refactor #2141

Merged
merged 5 commits into from
Aug 2, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Aug 1, 2017

Related: #1975

This pull request seeks to...

  • Add a README.md for the Dropdown Menu component
  • Add unit tests for the Dropdown Menu component
  • Perform some general refactoring:
    • Remove unused onSelect prop (YAGNI)
    • Manage active index by state transition
    • Ensure controls prop exists before calling on its length property (since not a required prop)
    • Use modulus % operator for "reset to beginning" logic

Testing instructions:

Verify that there are no regressions in the behavior of the Dropdown Menu, currently used only as the last control of the table block. Particularly with note of keyboard behaviors, recently refined in #1975.

Ensure that unit tests pass:

npm test

@aduth aduth requested a review from afercia August 1, 2017 23:06
@codecov
Copy link

codecov bot commented Aug 1, 2017

Codecov Report

Merging #2141 into master will increase coverage by 1.92%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2141      +/-   ##
==========================================
+ Coverage   20.33%   22.26%   +1.92%     
==========================================
  Files         136      136              
  Lines        4274     4272       -2     
  Branches      724      721       -3     
==========================================
+ Hits          869      951      +82     
+ Misses       2872     2804      -68     
+ Partials      533      517      -16
Impacted Files Coverage Δ
components/dropdown-menu/index.js 93.05% <89.47%> (+93.05%) ⬆️
components/dashicon/index.js 4.1% <0%> (+2.42%) ⬆️
components/button/index.js 90.9% <0%> (+18.18%) ⬆️

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 fef2904...f40ae0d. Read the comment docs.

@aduth aduth added the [Feature] UI Components Impacts or related to the UI component system label Aug 1, 2017
keyDown( LEFT ); // activeIndex: 0
keyDown( UP ); // activeIndex: 3 (reset to end)

expect( wrapper.state( 'activeIndex' ) ).toBe( 3 );
Copy link
Member

Choose a reason for hiding this comment

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

Why not test the activeIndex after each of these keypresses?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not test the activeIndex after each of these keypresses?

Good call. Updated in 366e98a.

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

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

Tested keyboard interaction, looks good to me!

@aduth aduth force-pushed the update/block-switcher-dropdown-menu branch from 836f1c6 to f40ae0d Compare August 2, 2017 14:54
@aduth aduth merged commit 46cd098 into master Aug 2, 2017
@aduth aduth deleted the update/block-switcher-dropdown-menu branch August 2, 2017 15:18
Tug pushed a commit that referenced this pull request May 12, 2020
Co-Authored-By: Drapich Piotr <drapich.piotr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants