Skip to content

Feat/text highlight refactor #1669

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

Merged
merged 6 commits into from
Nov 16, 2021
Merged

Conversation

M-i-k-e-l
Copy link
Collaborator

Description

Text - highlight - refactor and handle some edge cases (add tests and move to utils)

Changelog

Text - highlight - refactor and handle some edge cases

@M-i-k-e-l M-i-k-e-l requested a review from lidord-wix November 16, 2021 13:28
@M-i-k-e-l M-i-k-e-l added the Important for Next Release PR that must be included in the release version label Nov 16, 2021
Copy link
Contributor

@lidord-wix lidord-wix 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 and makes a lot of sense!
I left small comments :)

]);
});

it('should handle ignore case-sensetive', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('should handle ignore case-sensetive', () => {
it('should be case-insensetive', () => {

Comment on lines 111 to 116
it('Should handle special characters starts with @', () => {
const uut = new Text({});
const result = uut.getArrayPartsByHighlight('[email protected]', ['@wix']);
expect(result).toEqual([{string: 'uilib', shouldHighlight: false}, {string: '@wix', shouldHighlight: true}, {string: '.com', shouldHighlight: false}]);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this different from the test in line 99?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know, I did not write it; I'm guessing that there were bugs that needed verification.

Comment on lines +52 to +56

it('Should handle full string.', () => {
const result = getTextPartsByHighlight('Dancing in the Dark', 'Dancing in the Dark');
expect(result).toEqual([{string: 'Dancing in the Dark', shouldHighlight: true}]);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a test for more than full string:
getTextPartsByHighlight('Dancing in the Dark', 'Dancing in the Darkk');

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is very important in the current logic, adding in case it ever changes 👍
Also noticed we don't have these tests for the array --> found another bug.

@M-i-k-e-l M-i-k-e-l requested a review from lidord-wix November 16, 2021 14:43
@lidord-wix lidord-wix merged commit a06be42 into master Nov 16, 2021
@M-i-k-e-l M-i-k-e-l deleted the feat/text-highlight-refactor branch November 16, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants