This commit is contained in:
42
node_modules/mark.js/test/specs/basic/ignore-punctuation-synonyms.js
generated
vendored
Normal file
42
node_modules/mark.js/test/specs/basic/ignore-punctuation-synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignorePunctuation and synonyms', function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx1, $ctx2,
|
||||
punctuation = getPunctuation();
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation-synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-ignore-punctuation-synonyms > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-ignore-punctuation-synonyms > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lorem', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'synonyms': {
|
||||
'Lorem': 'ipsum'
|
||||
},
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['one', 'dos', 'lüfte'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'synonyms': {
|
||||
'ü': 'ue',
|
||||
'one': 'uno',
|
||||
'two': 'dos'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap synonyms', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(8);
|
||||
expect($ctx2.find('mark')).toHaveLength(9);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user