File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ var highlight = (function(doc) {
110
110
var escapedWord = _ . escapeRegExChars ( patterns [ i ] ) ;
111
111
// added for diacritic insensitivity
112
112
if ( diacriticInsensitive ) {
113
- var escapedWord = escapedWord . replace ( / \S / g, accent_replacer ) ;
113
+ escapedWord = escapedWord . replace ( / \S / g, accent_replacer ) ;
114
114
}
115
115
escapedPatterns . push ( escapedWord ) ;
116
116
}
Original file line number Diff line number Diff line change @@ -35,6 +35,24 @@ describe('highlight', function() {
35
35
expect ( testNode . innerHTML ) . toEqual ( after ) ;
36
36
} ) ;
37
37
38
+ it ( 'should support diacritic insensitivity' , function ( ) {
39
+ var before = 'ABƠDE' ,
40
+ after = 'A<strong>BƠD</strong>E' ,
41
+ testNode = buildTestNode ( before ) ;
42
+
43
+ highlight ( { node : testNode , pattern : 'bod' , diacriticInsensitive : true } ) ;
44
+ expect ( testNode . innerHTML ) . toEqual ( after ) ;
45
+ } ) ;
46
+
47
+ it ( 'should be diacritic sensitive by default' , function ( ) {
48
+ var before = 'ABƠDE' ,
49
+ after = 'ABƠDE' ,
50
+ testNode = buildTestNode ( before ) ;
51
+
52
+ highlight ( { node : testNode , pattern : 'BOD' } ) ;
53
+ expect ( testNode . innerHTML ) . toEqual ( after ) ;
54
+ } ) ;
55
+
38
56
it ( 'should support words only matching' , function ( ) {
39
57
var before = 'tone one phone' ,
40
58
after = 'tone <strong>one</strong> phone' ,
You can’t perform that action at this time.
0 commit comments