This commit is contained in:
31
node_modules/mark.js/test/specs/regexp/ignore-groups.js
generated
vendored
Normal file
31
node_modules/mark.js/test/specs/regexp/ignore-groups.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
describe('mark with regular expression and ignoreGroups', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('regexp/ignore-groups.html');
|
||||
|
||||
$ctx1 = $('.regexp-ignore-groups > div:first-child');
|
||||
$ctx2 = $('.regexp-ignore-groups > div:last-child');
|
||||
new Mark($ctx1[0]).markRegExp(/(Lor)([^]?m[\s]*)(ipsum)/gmi, {
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).markRegExp(/(Lor)([^]?m[\s]*)(ipsum)/gmi, {
|
||||
'ignoreGroups': 2,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should silently ignore groups when disabled', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
$ctx1.find('mark').each(function() {
|
||||
expect($(this).text()).toBe('Lorem ipsum');
|
||||
});
|
||||
});
|
||||
it('should ignore specified groups when enabled', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(4);
|
||||
$ctx2.find('mark').each(function() {
|
||||
expect($(this).text()).toBe('ipsum');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user