-
Notifications
You must be signed in to change notification settings - Fork 734
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
Conversation
There was a problem hiding this 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', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should handle ignore case-sensetive', () => { | |
it('should be case-insensetive', () => { |
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}]); | ||
}); | ||
}); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
||
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}]); | ||
}); |
There was a problem hiding this comment.
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');
There was a problem hiding this comment.
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.
Description
Text - highlight - refactor and handle some edge cases (add tests and move to utils)
Changelog
Text - highlight - refactor and handle some edge cases