Skip to content

feat(highlights): Create in highlight mode#573

Merged
ConradJChan merged 9 commits intobox:masterfrom
ConradJChan:highlight-mode
Sep 5, 2020
Merged

feat(highlights): Create in highlight mode#573
ConradJChan merged 9 commits intobox:masterfrom
ConradJChan:highlight-mode

Conversation

@ConradJChan
Copy link
Contributor

@ConradJChan ConradJChan commented Sep 2, 2020

create highlight

TODO:

  • Unit tests
  • cross browser testing

@ConradJChan ConradJChan marked this pull request as ready for review September 4, 2020 07:19
@ConradJChan ConradJChan requested a review from a team as a code owner September 4, 2020 07:19
Copy link
Contributor

@mingzexiao6 mingzexiao6 left a comment

Choose a reason for hiding this comment

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

LGTM except one test fails. Oh never mind, you fixed it just now

mingzexiao6
mingzexiao6 previously approved these changes Sep 4, 2020
jstoffan
jstoffan previously approved these changes Sep 4, 2020
Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

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

Few minor comments, but otherwise LGTM.

test('should call setActiveAnnotationId', () => {
const wrapper = getWrapper();
wrapper.find(HighlightList).simulate('select', '123');
(wrapper.find(HighlightList).prop('onSelect') as Function)('123');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the cast needed here and for onClick? It looks like it's not needed in other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is because the onSelect prop is typed as optional

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably allow the non-null assertion in tests. It's actually safer than a cast, in this case, since it maintains the true type. Can be done later, though.

range: mockRange,
});
expect(defaults.getSelection).toHaveBeenCalled();
expect(setSelectionAction).toHaveBeenCalled();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at this again, it seems like we could pass in store with the shape we want and let the selectors do their thing, removing the need to mock them. Could be done in a follow-up, though.

@ConradJChan ConradJChan merged commit 7780f39 into box:master Sep 5, 2020
@ConradJChan ConradJChan deleted the highlight-mode branch September 5, 2020 00:05
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