File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 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) {
110110 var escapedWord = _ . escapeRegExChars ( patterns [ i ] ) ;
111111 // added for diacritic insensitivity
112112 if ( diacriticInsensitive ) {
113- var escapedWord = escapedWord . replace ( / \S / g, accent_replacer ) ;
113+ escapedWord = escapedWord . replace ( / \S / g, accent_replacer ) ;
114114 }
115115 escapedPatterns . push ( escapedWord ) ;
116116 }
Original file line number Diff line number Diff line change @@ -35,6 +35,24 @@ describe('highlight', function() {
3535 expect ( testNode . innerHTML ) . toEqual ( after ) ;
3636 } ) ;
3737
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+
3856 it ( 'should support words only matching' , function ( ) {
3957 var before = 'tone one phone' ,
4058 after = 'tone <strong>one</strong> phone' ,
You can’t perform that action at this time.
0 commit comments