Skip to content

fix(sub-header): update sort to use select component and update tests - #3239

Merged
mergify[bot] merged 3 commits into
box:masterfrom
QingyuChai:fix-sort-test
Feb 8, 2023
Merged

mergify[bot] merged 3 commits into
box:masterfrom
QingyuChai:fix-sort-test

Conversation

@QingyuChai

Copy link
Copy Markdown
Contributor

No description provided.


return (
<MenuItem
<SelectMenuItem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

use SelectMenuItem because it's literally MenuItem with isSelectItem

const SelectMenuItem = (props: MenuItemProps) => <MenuItem isSelectItem {...props} />;

@QingyuChai
QingyuChai marked this pull request as ready for review February 7, 2023 22:38
@QingyuChai
QingyuChai requested review from a team as code owners February 7, 2023 22:38
.childAt(1)
.prop('id'),
).toBe(messages.dateDESC.id);
expect(options.at(3).prop('isSelected')).toBe(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should you check the other options are not selected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can make sure that one of them isn't selected, but checking all of them seems a bit redundant

benjamin-shen
benjamin-shen previously approved these changes Feb 7, 2023
Comment on lines +152 to +154
options.forEach((option, i) => {
if (i !== 3) expect(option.prop('isSelected')).toBe(false);
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

could have done

options.forEach((option, i) => {
    expect(option.prop('isSelected')).toBe(i === 3);
}); 

but that would have been less readable

@JChan106 JChan106 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@mergify
mergify Bot merged commit 528a157 into box:master Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants