-
Notifications
You must be signed in to change notification settings - Fork 65
Fix Sky Highlight not recognizing backslash #1513
Fix Sky Highlight not recognizing backslash #1513
Conversation
Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 4b8f589 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 4b3815f (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 3408a04 (Please note that this is a fully automated comment.) |
@@ -27,11 +27,16 @@ export class SkyTextHighlightDirective | |||
|
|||
private static getRegexMatch(node: HTMLElement, searchText: string): RegExpExecArray { | |||
const text = node.nodeValue; | |||
const searchRegex = new RegExp(searchText, 'gi'); | |||
|
|||
const newSearchText = this.addBackSlash(searchText); |
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.
@joelamora: This works great! Instead of creating the separate method, mind implementing inline?
const text = node.nodeValue;
// Escape the backslash character:
searchText = searchText.replace(/\\/g, '\\\\');
const searchRegex = new RegExp(newSearchText, 'gi');
...
Thank you!
I'm approving this, but I'm going to make a note that we should include a unit test before release. @joelamora If you have the time, it would be appreciated. Otherwise, we'll take care of it this week! |
Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: edca472 (Please note that this is a fully automated comment.) |
Codecov Report
@@ Coverage Diff @@
## contrib-fix-sky-highlight-backslash #1513 +/- ##
===================================================================
Coverage 100% 100%
===================================================================
Files 387 387
Lines 7568 7569 +1
Branches 970 970
===================================================================
+ Hits 7568 7569 +1
Continue to review full report at Codecov.
|
57423d1
into
blackbaud:contrib-fix-sky-highlight-backslash
Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: b77f6fd (Please note that this is a fully automated comment.) |
Left: Backslash not recognized.
Right: Fixed.