This commit is contained in:
27
node_modules/mark.js/test/specs/basic/accuracy-complementary-limiters.js
generated
vendored
Normal file
27
node_modules/mark.js/test/specs/basic/accuracy-complementary-limiters.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
describe('basic mark with accuracy complementary and limiters', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/accuracy-complementary-limiters.html');
|
||||
|
||||
$ctx = $('.basic-accuracy-complementary-limiters');
|
||||
new Mark($ctx[0]).mark('test', {
|
||||
'accuracy': {
|
||||
'value': 'complementary',
|
||||
'limiters': [
|
||||
',', '.', '-', '!', '"', '\'', '(', ')', '%'
|
||||
]
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches without custom limiters', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
var textOpts = ['loremtestlorem', 'loremtest', 'test'];
|
||||
$ctx.find('mark').each(function() {
|
||||
expect($.inArray($(this).text(), textOpts)).toBeGreaterThan(-1);
|
||||
});
|
||||
});
|
||||
});
|
36
node_modules/mark.js/test/specs/basic/accuracy-complementary.js
generated
vendored
Normal file
36
node_modules/mark.js/test/specs/basic/accuracy-complementary.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
describe('basic mark with accuracy complementary', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/accuracy-complementary.html');
|
||||
|
||||
$ctx1 = $('.basic-accuracy-complementary > div:first-child');
|
||||
$ctx2 = $('.basic-accuracy-complementary > div:last-child');
|
||||
new Mark($ctx1[0]).mark(['lorem', 'ipsumx'], {
|
||||
'accuracy': 'complementary',
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['lorem', 'ipsumtest'], {
|
||||
'accuracy': 'complementary',
|
||||
'separateWordSearch': true,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap the correct matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
var textOpts = ['testLoremtest', 'ipsumx', 'ipsumx-test', 'öipsumxö'];
|
||||
$ctx1.find('mark').each(function() {
|
||||
expect($.inArray($(this).text(), textOpts)).toBeGreaterThan(-1);
|
||||
});
|
||||
});
|
||||
it('should work with separateWordSearch', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(2);
|
||||
var textOpts = ['testLorem', 'ipsumtest'];
|
||||
$ctx2.find('mark').each(function() {
|
||||
expect($.inArray($(this).text(), textOpts)).toBeGreaterThan(-1);
|
||||
});
|
||||
});
|
||||
});
|
26
node_modules/mark.js/test/specs/basic/accuracy-exactly-limiters.js
generated
vendored
Normal file
26
node_modules/mark.js/test/specs/basic/accuracy-exactly-limiters.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
describe('basic mark with accuracy exactly and limiters', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/accuracy-exactly-limiters.html');
|
||||
|
||||
$ctx = $('.basic-accuracy-exactly-limiters');
|
||||
new Mark($ctx[0]).mark('test', {
|
||||
'accuracy': {
|
||||
'value': 'exactly',
|
||||
'limiters': [
|
||||
',', '.', '-', '!', '"', '\'', '(', ')', '%'
|
||||
]
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches without custom limiters', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(6);
|
||||
$ctx.find('mark').each(function() {
|
||||
expect($(this).text()).toBe('test');
|
||||
});
|
||||
});
|
||||
});
|
50
node_modules/mark.js/test/specs/basic/accuracy-exactly.js
generated
vendored
Normal file
50
node_modules/mark.js/test/specs/basic/accuracy-exactly.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
describe('basic mark with accuracy exactly', function() {
|
||||
var $ctx1, $ctx2, $ctx3;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/accuracy-exactly.html');
|
||||
|
||||
$ctx1 = $('.basic-accuracy-exactly > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-accuracy-exactly > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-accuracy-exactly > div:nth-child(3)');
|
||||
new Mark($ctx1[0]).mark('ipsu', {
|
||||
'accuracy': 'exactly',
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('ipsu dolo', {
|
||||
'accuracy': 'exactly',
|
||||
'separateWordSearch': true,
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark('ipsu', {
|
||||
'accuracy': 'exactly',
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap the right matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(1);
|
||||
expect($ctx1.find('mark').text()).toBe('ipsu');
|
||||
expect($ctx1.find('.not mark')).toHaveLength(0);
|
||||
});
|
||||
it('should work with separateWordSearch', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(2);
|
||||
var textOpts = ['ipsu', 'dolo'];
|
||||
$ctx2.find('mark').each(function() {
|
||||
expect($.inArray($(this).text(), textOpts)).toBeGreaterThan(-1);
|
||||
});
|
||||
expect($ctx2.find('.not mark')).toHaveLength(0);
|
||||
});
|
||||
it('should work with diacritics', function() {
|
||||
expect($ctx3.find('mark')).toHaveLength(4);
|
||||
var textOpts = ['ipsu', 'ipsü', 'īpsu', 'īpsü'];
|
||||
$ctx3.find('mark').each(function() {
|
||||
expect($.inArray($(this).text(), textOpts)).toBeGreaterThan(-1);
|
||||
});
|
||||
expect($ctx3.find('.not mark')).toHaveLength(0);
|
||||
});
|
||||
});
|
21
node_modules/mark.js/test/specs/basic/accuracy-partially.js
generated
vendored
Normal file
21
node_modules/mark.js/test/specs/basic/accuracy-partially.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
describe('basic mark with accuracy partially', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/accuracy-partially.html');
|
||||
|
||||
$ctx = $('.basic-accuracy-partially');
|
||||
new Mark($ctx[0]).mark('lorem', {
|
||||
'accuracy': 'partially',
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap the right matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
$ctx.find('mark').each(function() {
|
||||
expect($(this).text()).toBe('Lorem');
|
||||
});
|
||||
});
|
||||
});
|
25
node_modules/mark.js/test/specs/basic/array-keyword.js
generated
vendored
Normal file
25
node_modules/mark.js/test/specs/basic/array-keyword.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
describe('basic mark with an array of keywords', function() {
|
||||
var $ctx, notFound;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/array-keyword.html');
|
||||
|
||||
$ctx = $('.basic-array-keyword');
|
||||
notFound = [];
|
||||
new Mark($ctx[0]).mark(['lorem', 'ipsum', 'test', 'hey'], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'noMatch': function(term) {
|
||||
notFound.push(term);
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap all matching keywords from the array', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
});
|
||||
it('should call noMatch for not found array items', function() {
|
||||
expect(notFound).toEqual(['test', 'hey']);
|
||||
});
|
||||
});
|
18
node_modules/mark.js/test/specs/basic/case-sensitive-diacritics.js
generated
vendored
Normal file
18
node_modules/mark.js/test/specs/basic/case-sensitive-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
describe('basic mark with caseSenstive and diacritics', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/case-sensitive-diacritics.html');
|
||||
|
||||
$ctx = $('.basic-case-sensitive-diacritics');
|
||||
new Mark($ctx.get()).mark(['Dolor', 'Amet', 'Aliquam', 'Lorem ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'caseSensitive': true,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find case sensitive matches with diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
});
|
||||
});
|
22
node_modules/mark.js/test/specs/basic/case-sensitive-synonyms-diacritics.js
generated
vendored
Normal file
22
node_modules/mark.js/test/specs/basic/case-sensitive-synonyms-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
describe('basic mark with caseSensitive synonyms and diacritics', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/case-sensitive-synonyms-diacritics.html');
|
||||
|
||||
$ctx = $('.basic-case-sensitive-synonyms-diacritics');
|
||||
new Mark($ctx[0]).mark(['Dolor', 'Aliquam', 'Sed', 'Lorèm ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'synonyms': {
|
||||
'Sed': 'justø',
|
||||
'Dolor': 'Ãmet'
|
||||
},
|
||||
'caseSensitive': true,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find case sensitive synonyms with diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(15);
|
||||
});
|
||||
});
|
36
node_modules/mark.js/test/specs/basic/case-sensitive-synonyms.js
generated
vendored
Normal file
36
node_modules/mark.js/test/specs/basic/case-sensitive-synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
describe('basic mark with caseSensitive synonyms', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/case-sensitive-synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-case-sensitive-synonyms > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-case-sensitive-synonyms > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lorem', {
|
||||
'synonyms': {
|
||||
'Lorem': 'ipsum'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'caseSensitive': true,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['one', '2', 'lüfte'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'caseSensitive': true,
|
||||
'synonyms': {
|
||||
'ü': 'ue',
|
||||
'one': '1',
|
||||
'two': '2'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap keywords and synonyms', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(6);
|
||||
expect($ctx2.find('mark')).toHaveLength(5);
|
||||
});
|
||||
});
|
29
node_modules/mark.js/test/specs/basic/case-sensitive.js
generated
vendored
Normal file
29
node_modules/mark.js/test/specs/basic/case-sensitive.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
describe('basic mark with caseSenstive', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/case-sensitive.html');
|
||||
|
||||
$ctx1 = $('.basic-case-sensitive > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-case-sensitive > div:nth-child(2)');
|
||||
new Mark($ctx1.get()).mark('At', {
|
||||
'caseSensitive': true,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['lorem'], {
|
||||
'diacritics': true,
|
||||
'separateWordSearch': false,
|
||||
'caseSensitive': false,
|
||||
'synonyms' : {
|
||||
'lorem': 'Lorem'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find case sensitive matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(2);
|
||||
expect($ctx2.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
18
node_modules/mark.js/test/specs/basic/context-array.js
generated
vendored
Normal file
18
node_modules/mark.js/test/specs/basic/context-array.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
describe('basic mark called with an array of contexts', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/context-array.html');
|
||||
|
||||
$ctx = $('.basic-context-array');
|
||||
new Mark($ctx.get()).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
});
|
||||
});
|
20
node_modules/mark.js/test/specs/basic/context-direct.js
generated
vendored
Normal file
20
node_modules/mark.js/test/specs/basic/context-direct.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
describe('basic mark directly inside the context', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/context-direct.html');
|
||||
|
||||
$ctx = $('.basic-context-direct');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
19
node_modules/mark.js/test/specs/basic/context-nodelist.js
generated
vendored
Normal file
19
node_modules/mark.js/test/specs/basic/context-nodelist.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
describe('basic mark called with a NodeList context', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/context-nodelist.html');
|
||||
|
||||
$ctx = $('.basic-context-nodelist');
|
||||
var ctxNodelist = document.querySelectorAll('.basic-context-nodelist');
|
||||
new Mark(ctxNodelist).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
});
|
||||
});
|
18
node_modules/mark.js/test/specs/basic/context-string.js
generated
vendored
Normal file
18
node_modules/mark.js/test/specs/basic/context-string.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
describe('basic mark called with a string selector as context', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/context-string.html');
|
||||
|
||||
$ctx = $('.basic-context-string');
|
||||
new Mark('.basic-context-string').mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(8);
|
||||
});
|
||||
});
|
27
node_modules/mark.js/test/specs/basic/custom-element-class-unmark.js
generated
vendored
Normal file
27
node_modules/mark.js/test/specs/basic/custom-element-class-unmark.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
describe('basic unmark with custom element and class', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/custom-element-class.html');
|
||||
|
||||
$ctx = $('.basic-custom-element-class > div:first-child');
|
||||
var instance = new Mark($ctx[0]);
|
||||
instance.mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'element': 'i',
|
||||
'className': 'custom',
|
||||
'done': function() {
|
||||
instance.unmark({
|
||||
'element': 'i',
|
||||
'className': 'custom',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove all marked elements', function() {
|
||||
expect($ctx).not.toContainElement('i.custom');
|
||||
});
|
||||
});
|
31
node_modules/mark.js/test/specs/basic/custom-element-class.js
generated
vendored
Normal file
31
node_modules/mark.js/test/specs/basic/custom-element-class.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
describe('basic mark with custom element and class', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/custom-element-class.html');
|
||||
|
||||
$ctx1 = $('.basic-custom-element-class > div:first-child');
|
||||
$ctx2 = $('.basic-custom-element-class > div:last-child');
|
||||
new Mark($ctx1[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'element': 'i',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'element': 'i',
|
||||
'className': 'custom',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should not add a class to matched elements if specified', function() {
|
||||
expect($ctx1.find('i')).toHaveLength(4);
|
||||
});
|
||||
it('should wrap matches with specified element and class', function() {
|
||||
expect($ctx2.find('i.custom')).toHaveLength(4);
|
||||
});
|
||||
});
|
30
node_modules/mark.js/test/specs/basic/debug.js
generated
vendored
Normal file
30
node_modules/mark.js/test/specs/basic/debug.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
describe('basic mark with debug callback', function() {
|
||||
var $ctx, debugCalled;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
debugCalled = 0;
|
||||
$ctx = $('.basic');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'debug': true,
|
||||
'log': {
|
||||
'debug': function() {
|
||||
debugCalled++;
|
||||
},
|
||||
'warn': function() {
|
||||
debugCalled++;
|
||||
}
|
||||
},
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the log function when debug is enabled', function() {
|
||||
expect(debugCalled).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
19
node_modules/mark.js/test/specs/basic/diacritics-vietnamese.js
generated
vendored
Normal file
19
node_modules/mark.js/test/specs/basic/diacritics-vietnamese.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
describe('basic mark with diacritics for Vietnamese', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/diacritics-vietnamese.html');
|
||||
|
||||
$ctx = $('.basic-diacritics-vietnamese');
|
||||
// including a term with a "s" and a whitespace to check "merge blanks"
|
||||
// behavior in combination with diacritics
|
||||
new Mark($ctx[0]).mark(['truong', 'am', 'ac'], {
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should treat normal and diacritic characters equally', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(9);
|
||||
});
|
||||
});
|
21
node_modules/mark.js/test/specs/basic/diacritics.js
generated
vendored
Normal file
21
node_modules/mark.js/test/specs/basic/diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
describe('basic mark with diacritics', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/diacritics.html');
|
||||
|
||||
$ctx = $('.basic-diacritics');
|
||||
// including a term with a "s" and a whitespace to check "merge blanks"
|
||||
// behavior in combination with diacritics
|
||||
new Mark($ctx[0]).mark(['dolor', 'amet', 'justo', 'lores ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should treat normal and diacritic characters equally', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(15);
|
||||
});
|
||||
});
|
29
node_modules/mark.js/test/specs/basic/done.js
generated
vendored
Normal file
29
node_modules/mark.js/test/specs/basic/done.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
describe('basic mark with done callback', function() {
|
||||
var $ctx, doneCalled, totalMatches;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
totalMatches = doneCalled = 0;
|
||||
$ctx = $('.basic');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function(counter) {
|
||||
doneCalled++;
|
||||
totalMatches = counter;
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the done callback once only', function(done) {
|
||||
setTimeout(function() {
|
||||
expect(doneCalled).toBe(1);
|
||||
done();
|
||||
}, 3000);
|
||||
});
|
||||
it('should call the done callback with total matches', function() {
|
||||
expect(totalMatches).toBe(4);
|
||||
});
|
||||
});
|
45
node_modules/mark.js/test/specs/basic/duplicate-context.js
generated
vendored
Normal file
45
node_modules/mark.js/test/specs/basic/duplicate-context.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
describe('basic mark with duplicated contexts', function() {
|
||||
var $ctx1, $ctx2, ctx1Called, ctx2Called;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/duplicate-context.html');
|
||||
|
||||
$ctx1 = $('.basic-duplicate-context > div:first-child');
|
||||
$ctx2 = $('.basic-duplicate-context > div:last-child');
|
||||
ctx1Called = ctx2Called = 0;
|
||||
new Mark([$ctx1[0], $ctx1[0]]).mark('test', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'filter': function(){
|
||||
ctx1Called++;
|
||||
// return false. Otherwise matches would become wrapped and no
|
||||
// further matches would be found. Therefore no further filter
|
||||
// calls would be done
|
||||
return false;
|
||||
},
|
||||
'done': function() {
|
||||
new Mark([$ctx2[0], $ctx2.find('span')[0]]).mark('test', {
|
||||
'filter': function(){
|
||||
ctx2Called++;
|
||||
// return false. Otherwise matches would become wrapped
|
||||
// and no further matches would be found. Therefore no
|
||||
// further filter calls would be done
|
||||
return false;
|
||||
},
|
||||
'done': function(){
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should ignore duplicated passed contexts', function() {
|
||||
// it should be called only once, as there's only one text node
|
||||
expect(ctx1Called).toBe(1);
|
||||
});
|
||||
it('should ignore contexts inside other contexts', function(){
|
||||
// it should be called only twice, as there are two text nodes
|
||||
expect(ctx2Called).toBe(2);
|
||||
});
|
||||
});
|
45
node_modules/mark.js/test/specs/basic/duplicate-keyword.js
generated
vendored
Normal file
45
node_modules/mark.js/test/specs/basic/duplicate-keyword.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
describe('basic mark with duplicated keywords', function() {
|
||||
var $ctx1, $ctx2, ctx1Called, ctx2Called;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/duplicate-keywords.html');
|
||||
|
||||
$ctx1 = $('.basic-duplicate-keywords > div:first-child');
|
||||
$ctx2 = $('.basic-duplicate-keywords > div:last-child');
|
||||
ctx1Called = ctx2Called = 0;
|
||||
new Mark($ctx1[0]).mark(['test', 'test'], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'filter': function(){
|
||||
ctx1Called++;
|
||||
// return false. Otherwise matches would become wrapped and no
|
||||
// further matches would be found. Therefore no further filter
|
||||
// calls would be done
|
||||
return false;
|
||||
},
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lorem test ipsum', {
|
||||
'separateWordSearch': true,
|
||||
'filter': function(){
|
||||
ctx2Called++;
|
||||
// return false. Otherwise matches would become wrapped
|
||||
// and no further matches would be found. Therefore no
|
||||
// further filter calls would be done
|
||||
return false;
|
||||
},
|
||||
'done': function(){
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should ignore duplicated array keywords', function() {
|
||||
// it should be called only once, as there's only one unique keyword
|
||||
expect(ctx1Called).toBe(1);
|
||||
});
|
||||
it('should ignore duplicated keywords with separateWordSearch', function(){
|
||||
expect(ctx2Called).toBe(9);
|
||||
});
|
||||
});
|
24
node_modules/mark.js/test/specs/basic/each.js
generated
vendored
Normal file
24
node_modules/mark.js/test/specs/basic/each.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
describe('basic mark with each callback', function() {
|
||||
var $ctx, eachCalled;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
eachCalled = 0;
|
||||
$ctx = $('.basic');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'each': function() {
|
||||
eachCalled++;
|
||||
},
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the each callback for each marked element', function() {
|
||||
expect(eachCalled).toBe(4);
|
||||
});
|
||||
});
|
31
node_modules/mark.js/test/specs/basic/empty.js
generated
vendored
Normal file
31
node_modules/mark.js/test/specs/basic/empty.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
describe('basic mark in an empty context', function() {
|
||||
var $ctx1, $ctx2, done1 = false,
|
||||
done2 = false;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/empty.html');
|
||||
|
||||
$ctx1 = $('.notExistingSelector');
|
||||
$ctx2 = $('.basic-empty');
|
||||
new Mark($ctx1[0]).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done1 = true;
|
||||
new Mark($ctx2[0]).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done2 = true;
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the done function', function() {
|
||||
expect(done1).toBe(true);
|
||||
expect(done2).toBe(true);
|
||||
});
|
||||
});
|
28
node_modules/mark.js/test/specs/basic/entities.js
generated
vendored
Normal file
28
node_modules/mark.js/test/specs/basic/entities.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
describe('basic mark with HTML entities', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/entities.html');
|
||||
|
||||
$ctx1 = $('.basic-entities > div:first-child');
|
||||
$ctx2 = $('.basic-entities > div:last-child');
|
||||
new Mark($ctx1[0]).mark('Lorem © ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('justo √ duo', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(1);
|
||||
expect($ctx2.find('mark')).toHaveLength(1);
|
||||
});
|
||||
});
|
29
node_modules/mark.js/test/specs/basic/escape.js
generated
vendored
Normal file
29
node_modules/mark.js/test/specs/basic/escape.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
describe('basic mark with regex characters', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/escape.html');
|
||||
|
||||
$ctx = $('.basic-escape');
|
||||
new Mark($ctx[0]).mark([
|
||||
'39,00 €', '0.009 €', 'Unk?nown', 'Some+>thing', 'www.happy.com\\'
|
||||
], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should escape search terms and wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(5);
|
||||
});
|
||||
it('should not modify text node values', function() {
|
||||
expect($ctx.find('mark').get(0)).toContainText('39,00 €');
|
||||
expect($ctx.find('mark').get(1)).toContainText('0.009 €');
|
||||
expect($ctx.find('mark').get(2)).toContainText('Unk?nown');
|
||||
expect($ctx.find('mark').get(3)).toContainText('Some+>thing');
|
||||
expect($ctx.find('mark').get(4)).toContainText('www.happy.com\\');
|
||||
});
|
||||
});
|
31
node_modules/mark.js/test/specs/basic/events.js
generated
vendored
Normal file
31
node_modules/mark.js/test/specs/basic/events.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
describe('unmark with click event', function() {
|
||||
var $ctx, eventCalled;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/events.html');
|
||||
|
||||
$ctx = $('.basic-events');
|
||||
eventCalled = 0;
|
||||
$ctx.find('.event-target').on('click', function() {
|
||||
++eventCalled;
|
||||
});
|
||||
var instance = new Mark($ctx[0]);
|
||||
instance.mark('test', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
instance.unmark({
|
||||
'done': function() {
|
||||
$ctx.find('.event-target').click();
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should not remove bound events', function() {
|
||||
expect(eventCalled).toBe(1);
|
||||
});
|
||||
|
||||
});
|
24
node_modules/mark.js/test/specs/basic/exclude.js
generated
vendored
Normal file
24
node_modules/mark.js/test/specs/basic/exclude.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
describe('basic mark with exclude', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/exclude.html');
|
||||
|
||||
$ctx = $('.basic-exclude');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'exclude': [
|
||||
'*[data-ignore]',
|
||||
'.ignore'
|
||||
],
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should exclude matches that are inside exclude selectors', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
47
node_modules/mark.js/test/specs/basic/filter.js
generated
vendored
Normal file
47
node_modules/mark.js/test/specs/basic/filter.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
describe('basic mark with filter callback', function() {
|
||||
var $ctx;
|
||||
beforeEach(function() {
|
||||
loadFixtures('basic/filter.html');
|
||||
|
||||
$ctx = $('.basic-filter');
|
||||
});
|
||||
|
||||
it('should call the callback with the right parameters', function(done) {
|
||||
var counter = {
|
||||
'lorem': 0,
|
||||
'ipsum': 0,
|
||||
'dolor': 0
|
||||
},
|
||||
totalCounter = 0,
|
||||
calls = 0;
|
||||
try {
|
||||
new Mark($ctx[0]).mark(Object.keys(counter), {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'filter': function(node, term, totalMatches, matches) {
|
||||
expect(node.nodeType).toBe(3);
|
||||
expect($.inArray(
|
||||
term,
|
||||
Object.keys(counter)
|
||||
)).toBeGreaterThan(-1);
|
||||
expect(totalCounter).toBe(totalMatches);
|
||||
expect(counter[term]).toBe(matches);
|
||||
if (++calls !== 3) {
|
||||
counter[term]++;
|
||||
totalCounter++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
'done': function() {
|
||||
expect($ctx.find('mark')).toHaveLength(15);
|
||||
done();
|
||||
}
|
||||
});
|
||||
} catch (e){
|
||||
done.fail(e.message);
|
||||
}
|
||||
});
|
||||
});
|
19
node_modules/mark.js/test/specs/basic/ignore-joiners-diacritics.js
generated
vendored
Normal file
19
node_modules/mark.js/test/specs/basic/ignore-joiners-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignoreJoiners and diacritics', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-joiners-diacritics.html');
|
||||
|
||||
$ctx = $('.basic-ignore-joiners-diacritics');
|
||||
new Mark($ctx.get()).mark(['Dolor', 'Lorem ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'ignoreJoiners': true,
|
||||
'diacritics': true,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find matches containing diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(15);
|
||||
});
|
||||
});
|
32
node_modules/mark.js/test/specs/basic/ignore-joiners-escape.js
generated
vendored
Normal file
32
node_modules/mark.js/test/specs/basic/ignore-joiners-escape.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignoreJoiners and special characters', function() {
|
||||
var err, $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-joiners-escape.html');
|
||||
|
||||
$ctx = $('.basic-ignore-joiners-escape');
|
||||
err = false;
|
||||
try {
|
||||
new Mark($ctx.get()).mark([
|
||||
'Lorem ipsum+',
|
||||
'sit*',
|
||||
'amet?',
|
||||
'$50',
|
||||
'{no}',
|
||||
'www.happy.com\\'
|
||||
], {
|
||||
'separateWordSearch': false,
|
||||
'ignoreJoiners': true,
|
||||
'done': done
|
||||
});
|
||||
} catch (e) {
|
||||
err = true;
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
it('should find matches', function() {
|
||||
expect(err).toBe(false);
|
||||
expect($ctx.find('mark')).toHaveLength(9);
|
||||
});
|
||||
});
|
26
node_modules/mark.js/test/specs/basic/ignore-joiners-synonyms-diacritics.js
generated
vendored
Normal file
26
node_modules/mark.js/test/specs/basic/ignore-joiners-synonyms-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
describe(
|
||||
'basic mark with ignoreJoiners and synonyms with diacritics',
|
||||
function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-joiners-synonyms-diacritics.html');
|
||||
|
||||
$ctx = $('.basic-ignore-joiners-synonyms-diacritics');
|
||||
new Mark($ctx[0]).mark(['Dołor', 'Sed', 'Lorèm ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'ignoreJoiners': true,
|
||||
'synonyms': {
|
||||
'Sed': 'justø',
|
||||
'Dołor': 'ãmet'
|
||||
},
|
||||
'diacritics': true,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find synonyms with diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(33);
|
||||
});
|
||||
}
|
||||
);
|
36
node_modules/mark.js/test/specs/basic/ignore-joiners-synonyms.js
generated
vendored
Normal file
36
node_modules/mark.js/test/specs/basic/ignore-joiners-synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignoreJoiners and synonyms', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-joiners-synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-ignore-joiners-synonyms > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-ignore-joiners-synonyms > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lorem', {
|
||||
'synonyms': {
|
||||
'Lorem': 'ipsum'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignoreJoiners': true,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['one', 'dos', 'lüfte'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignoreJoiners': true,
|
||||
'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);
|
||||
});
|
||||
});
|
28
node_modules/mark.js/test/specs/basic/ignore-joiners.js
generated
vendored
Normal file
28
node_modules/mark.js/test/specs/basic/ignore-joiners.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignoreJoiners', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-joiners.html');
|
||||
|
||||
$ctx1 = $('.basic-ignore-joiners > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-ignore-joiners > div:nth-child(2)');
|
||||
new Mark($ctx1.get()).mark('Lorem ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'ignoreJoiners': true,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'ignoreJoiners': false,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find matches when enabled', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
});
|
||||
it('should not find matches when disabled', function(){
|
||||
expect($ctx2.find('mark')).toHaveLength(2);
|
||||
});
|
||||
});
|
61
node_modules/mark.js/test/specs/basic/ignore-punctuation-accuracy.js
generated
vendored
Normal file
61
node_modules/mark.js/test/specs/basic/ignore-punctuation-accuracy.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignorePunctuation and accuracy', function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx1, $ctx2,
|
||||
punctuation = getPunctuation(),
|
||||
regexp = new RegExp('[' + punctuation.join('') + ']', 'g');
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation-accuracy.html');
|
||||
|
||||
$ctx1 = $('.basic-ignore-punctuation-accuracy > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-ignore-punctuation-accuracy > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('rem ips', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'accuracy': {
|
||||
'value': 'complementary',
|
||||
// remove certain limiters for the given HTML
|
||||
'limiters': '!#$%&*+,-./:;<=>?@^_`{|}~¡¿'.split('')
|
||||
},
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'accuracy': 'exact',
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it(
|
||||
'should find matches with spaces and complementary accuracy',
|
||||
function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(5);
|
||||
var count = 0,
|
||||
regex = /lorem\s+ipsum/i;
|
||||
$ctx1.find('mark').each(function() {
|
||||
if (regex.test($(this).text().replace(regexp, ''))) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(5);
|
||||
}
|
||||
);
|
||||
it('should find matches with exact accuracy', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(5);
|
||||
var count = 0;
|
||||
$ctx2.find('mark').each(function() {
|
||||
if ($(this).text().replace(regexp, '') === 'ipsum') {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(5);
|
||||
});
|
||||
});
|
58
node_modules/mark.js/test/specs/basic/ignore-punctuation-ignore-joiners.js
generated
vendored
Normal file
58
node_modules/mark.js/test/specs/basic/ignore-punctuation-ignore-joiners.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignorePunctuation and ignoreJoiners', function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx1, $ctx2, $container,
|
||||
punctuation = getPunctuation(),
|
||||
regexp = new RegExp(
|
||||
'[\u00ad\u200b\u200c\u200d' + punctuation.join('') + ']',
|
||||
'g'
|
||||
);
|
||||
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation-ignore-joiners.html');
|
||||
$container = $('.basic-ignore-punctuation-ignore-joiners');
|
||||
$ctx1 = $container.children('div:nth-child(1)');
|
||||
$ctx2 = $container.children('div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lorem ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignoreJoiners': true,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignoreJoiners': true,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find matches containing spaces and ignore joiners', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(6);
|
||||
var count = 0,
|
||||
regex = /lorem\s+ipsum/i;
|
||||
$ctx1.find('mark').each(function() {
|
||||
if (regex.test($(this).text().replace(regexp, ''))) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(6);
|
||||
});
|
||||
it('should find matches containing ignore joiners', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(6);
|
||||
var count = 0;
|
||||
$ctx2.find('mark').each(function() {
|
||||
if ($(this).text().replace(regexp, '') === 'ipsum') {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(6);
|
||||
});
|
||||
});
|
54
node_modules/mark.js/test/specs/basic/ignore-punctuation-separate-word-search.js
generated
vendored
Normal file
54
node_modules/mark.js/test/specs/basic/ignore-punctuation-separate-word-search.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
describe(
|
||||
'basic mark with ignorePunctuation and separateWordSearch', function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx1, $ctx2, $container,
|
||||
punctuation = getPunctuation(),
|
||||
regexp = new RegExp('[' + punctuation.join('') + ']', 'g');
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation-separate-word-search.html');
|
||||
|
||||
$container = $('.basic-ignore-punctuation-separate-word-search');
|
||||
$ctx1 = $container.children('div:nth-child(1)');
|
||||
$ctx2 = $container.children('div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lorem ipsum', {
|
||||
'separateWordSearch': true,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['amet ipsum'], {
|
||||
'separateWordSearch': true,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find separate matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(11);
|
||||
var count = 0,
|
||||
regex = /^(lorem|ipsum)$/i;
|
||||
$ctx1.find('mark').each(function() {
|
||||
if (regex.test($(this).text().replace(regexp, ''))) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(11);
|
||||
expect($ctx2.find('mark')).toHaveLength(8);
|
||||
count = 0;
|
||||
regex = /^(ipsum|amet)$/i;
|
||||
$ctx2.find('mark').each(function() {
|
||||
if (regex.test($(this).text().replace(regexp, ''))) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(8);
|
||||
});
|
||||
}
|
||||
);
|
32
node_modules/mark.js/test/specs/basic/ignore-punctuation-synonyms-diacritics.js
generated
vendored
Normal file
32
node_modules/mark.js/test/specs/basic/ignore-punctuation-synonyms-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
describe(
|
||||
'basic mark with ignorePunctuation and synonyms with diacritics',
|
||||
function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx,
|
||||
punctuation = getPunctuation();
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation-synonyms-diacritics.html');
|
||||
|
||||
$ctx = $('.basic-ignore-punctuation-synonyms-diacritics');
|
||||
new Mark($ctx[0]).mark(['Dołor', 'Sed', 'Lorèm ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'ignorePunctuation': punctuation,
|
||||
'synonyms': {
|
||||
'Sed': 'justø',
|
||||
'Dołor': 'ãmet'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find synonyms with diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(33);
|
||||
});
|
||||
}
|
||||
);
|
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);
|
||||
});
|
||||
});
|
64
node_modules/mark.js/test/specs/basic/ignore-punctuation.js
generated
vendored
Normal file
64
node_modules/mark.js/test/specs/basic/ignore-punctuation.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
describe('basic mark with ignorePunctuation', function() {
|
||||
function getPunctuation() {
|
||||
return ':;.,-–—‒_(){}[]!\'"+='
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split('');
|
||||
}
|
||||
var $ctx1, $ctx2, $ctx3,
|
||||
punctuation = getPunctuation(),
|
||||
regexp = new RegExp('[' + punctuation.join('') + ']', 'g');
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/ignore-punctuation.html');
|
||||
|
||||
$ctx1 = $('.basic-ignore-punctuation > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-ignore-punctuation > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-ignore-punctuation > div:nth-child(3)');
|
||||
new Mark($ctx1[0]).mark('ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['Lorem ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': punctuation,
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark(['ipsum'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'ignorePunctuation': '',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find single word matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(5);
|
||||
var count = 0;
|
||||
$ctx1.find('mark').each(function() {
|
||||
if ($(this).text().replace(regexp, '') === 'ipsum') {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(5);
|
||||
});
|
||||
it('should find matches containing whitespace', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(5);
|
||||
var count = 0,
|
||||
regex = /lorem\s+ipsum/i;
|
||||
$ctx2.find('mark').each(function() {
|
||||
if (regex.test($(this).text().replace(regexp, ''))) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
expect(count).toBe(5);
|
||||
});
|
||||
it('should not find matches when disabled', function() {
|
||||
expect($ctx3.find('mark')).toHaveLength(1);
|
||||
});
|
||||
|
||||
});
|
27
node_modules/mark.js/test/specs/basic/jquery.js
generated
vendored
Normal file
27
node_modules/mark.js/test/specs/basic/jquery.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
describe('basic mark called with jquery', function() {
|
||||
var $ctx, ret;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
$ctx = $('.basic');
|
||||
ret = $ctx.mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
// otherwise "ret =" will not be executed
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
it('should return the provided context jquery element', function() {
|
||||
expect(ret instanceof $).toBe(true);
|
||||
expect(ret).toBeMatchedBy('.basic');
|
||||
});
|
||||
});
|
50
node_modules/mark.js/test/specs/basic/large-document.js
generated
vendored
Normal file
50
node_modules/mark.js/test/specs/basic/large-document.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
describe('basic mark in large documents', function() {
|
||||
var $ctx, err, start, end, diff;
|
||||
|
||||
var browser = {
|
||||
isIe: function() {
|
||||
return navigator.appVersion.indexOf('MSIE') != -1;
|
||||
},
|
||||
navigator: navigator.appVersion,
|
||||
getVersion: function() {
|
||||
var version = 999; // we assume a sane browser
|
||||
if (navigator.appVersion.indexOf('MSIE') != -1) {
|
||||
version = parseFloat(navigator.appVersion.split('MSIE')[1]);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
};
|
||||
var time = browser.isIe() && browser.getVersion() <= 9 ? 30000 : 10000;
|
||||
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/large-document.html');
|
||||
|
||||
$ctx = $('.basic-large-document');
|
||||
err = false;
|
||||
start = new Date();
|
||||
try {
|
||||
new Mark($ctx[0]).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
end = new Date();
|
||||
diff = end.getTime() - start.getTime();
|
||||
done();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
err = true;
|
||||
}
|
||||
}, 60000);
|
||||
|
||||
it('should not throw a recursion error', function() {
|
||||
expect(err).toBe(false);
|
||||
});
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(9569);
|
||||
});
|
||||
it('should be faster than ' + time + ' ms', function() {
|
||||
expect(diff).toBeLessThan(time);
|
||||
});
|
||||
});
|
29
node_modules/mark.js/test/specs/basic/main.js
generated
vendored
Normal file
29
node_modules/mark.js/test/specs/basic/main.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
describe('basic mark', function() {
|
||||
var $ctx, ret;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
$ctx = $('.basic');
|
||||
ret = new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
// otherwise "ret =" will not be executed
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
it('should return an object with further methods', function() {
|
||||
expect(ret instanceof Mark).toBe(true);
|
||||
expect(typeof ret.mark).toBe('function');
|
||||
expect(typeof ret.unmark).toBe('function');
|
||||
expect(typeof ret.markRegExp).toBe('function');
|
||||
});
|
||||
});
|
29
node_modules/mark.js/test/specs/basic/manipulated-mark.js
generated
vendored
Normal file
29
node_modules/mark.js/test/specs/basic/manipulated-mark.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
describe('unmark with elements inside marked elements', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/manipulated-mark.html');
|
||||
|
||||
$ctx = $('.basic-manipulated-mark');
|
||||
var instance = new Mark($ctx[0]);
|
||||
instance.mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
$('<span />', {
|
||||
'html': 'test',
|
||||
'id': 'manipulatedMark'
|
||||
}).appendTo($ctx.find('mark').first());
|
||||
instance.unmark({
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should not delete subsequently added elements', function() {
|
||||
expect($ctx).toContainElement('#manipulatedMark');
|
||||
});
|
||||
});
|
26
node_modules/mark.js/test/specs/basic/merge-blanks.js
generated
vendored
Normal file
26
node_modules/mark.js/test/specs/basic/merge-blanks.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
describe('basic mark with multiple blanks', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/merge-blanks.html');
|
||||
|
||||
$ctx1 = $('.basic-merge-blanks > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-merge-blanks > div:nth-child(2)');
|
||||
new Mark($ctx1.get()).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
new Mark($ctx2.get()).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches regardless of the number of blanks', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
expect($ctx2.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
52
node_modules/mark.js/test/specs/basic/nested-mark.js
generated
vendored
Normal file
52
node_modules/mark.js/test/specs/basic/nested-mark.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
describe(
|
||||
'basic mark in already marked element',
|
||||
function() {
|
||||
var $ctx, instance;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/nested-mark.html');
|
||||
|
||||
$ctx = $('.basic-nested-mark');
|
||||
instance = new Mark($ctx[0]);
|
||||
instance.mark('lorem test ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'className': 'root',
|
||||
'done': function() {
|
||||
instance.mark('test', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'className': 'nested',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches even in already marked elements', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(5);
|
||||
expect($ctx.find('mark.root')).toHaveLength(2);
|
||||
expect($ctx.find('mark.nested')).toHaveLength(3);
|
||||
expect($ctx.find('mark.root')).toContainElement('mark.nested');
|
||||
expect($ctx.find('mark.root')).toContainText('lorem test ipsum');
|
||||
expect($ctx.find('mark.nested')).toContainText('test');
|
||||
});
|
||||
it('should unwrap nested mark elements correctly', function(done) {
|
||||
instance.unmark({
|
||||
'className': 'root',
|
||||
'done': function() {
|
||||
expect($ctx.find('mark.root')).not.toExist();
|
||||
expect($ctx.find('mark.nested')).toHaveLength(3);
|
||||
expect($ctx.find('mark.nested')).toContainText('test');
|
||||
instance.unmark({
|
||||
'className': 'nested',
|
||||
'done': function() {
|
||||
expect($ctx.find('mark.nested')).not.toExist();
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
24
node_modules/mark.js/test/specs/basic/no-match.js
generated
vendored
Normal file
24
node_modules/mark.js/test/specs/basic/no-match.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
describe('basic mark with noMatch callback', function() {
|
||||
var $ctx, notFound;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
notFound = [];
|
||||
$ctx = $('.basic');
|
||||
new Mark($ctx[0]).mark('test', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'noMatch': function(term) {
|
||||
notFound.push(term);
|
||||
},
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should call the noMatch callback for not found terms', function() {
|
||||
expect(notFound).toEqual(['test']);
|
||||
});
|
||||
});
|
22
node_modules/mark.js/test/specs/basic/no-options.js
generated
vendored
Normal file
22
node_modules/mark.js/test/specs/basic/no-options.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
describe('basic mark with no options', function() {
|
||||
var $ctx, err;
|
||||
beforeEach(function() {
|
||||
loadFixtures('basic/no-options.html');
|
||||
|
||||
$ctx = $('.basic-no-options');
|
||||
err = false;
|
||||
try {
|
||||
new Mark($ctx[0]).mark('lorem ipsum');
|
||||
} catch (e){
|
||||
err = true;
|
||||
}
|
||||
});
|
||||
|
||||
it('should not throw an error', function() {
|
||||
expect(err).toBe(false);
|
||||
});
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark').length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
20
node_modules/mark.js/test/specs/basic/same-keywords.js
generated
vendored
Normal file
20
node_modules/mark.js/test/specs/basic/same-keywords.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
describe('basic mark with multiple same keywords', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/same-keywords.html');
|
||||
|
||||
$ctx = $('.basic-same-keywords');
|
||||
new Mark($ctx[0]).mark(['test', 'test'], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('matches should be wrapped only once', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(1);
|
||||
});
|
||||
});
|
24
node_modules/mark.js/test/specs/basic/script-style.js
generated
vendored
Normal file
24
node_modules/mark.js/test/specs/basic/script-style.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
describe(
|
||||
'basic mark in a context with script-tags and style-tags',
|
||||
function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/script-style.html');
|
||||
|
||||
$ctx = $('.basic-script-style');
|
||||
new Mark($ctx[0]).mark('lorem', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
it('should not wrap anything inside these tags', function() {
|
||||
expect($ctx.find('style, script')).not.toContainElement('mark');
|
||||
});
|
||||
}
|
||||
);
|
36
node_modules/mark.js/test/specs/basic/separate-word-search-blank.js
generated
vendored
Normal file
36
node_modules/mark.js/test/specs/basic/separate-word-search-blank.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
describe('basic mark with separateWordSearch and blanks', function() {
|
||||
var $ctx1, $ctx2, $ctx3;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/separate-word-search-blank.html');
|
||||
|
||||
$ctx1 = $('.basic-separate-blank > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-separate-blank > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-separate-blank > div:nth-child(3)');
|
||||
new Mark($ctx1[0]).mark('lorem ', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': true,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(' lorem ', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': true,
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark([''], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': true,
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap matches, ignore blanks and call done', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
expect($ctx2.find('mark')).toHaveLength(4);
|
||||
expect($ctx3.find('mark')).toHaveLength(0);
|
||||
});
|
||||
});
|
33
node_modules/mark.js/test/specs/basic/separate-word-search.js
generated
vendored
Normal file
33
node_modules/mark.js/test/specs/basic/separate-word-search.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
describe('basic mark with separateWordsearch', function() {
|
||||
var $ctx1, $ctx2, notFound;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/separate-word-search.html');
|
||||
|
||||
$ctx1 = $('.basic-separate > div:first-child');
|
||||
$ctx2 = $('.basic-separate > div:last-child');
|
||||
notFound = [];
|
||||
new Mark($ctx1[0]).mark('lorem ipsum test', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': true,
|
||||
'noMatch': function(term) {
|
||||
notFound.push(term);
|
||||
},
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['lorem ipsum'], {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': true,
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap separated words', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(8);
|
||||
expect($ctx2.find('mark')).toHaveLength(8);
|
||||
});
|
||||
it('should call the noMatch callback for separated words', function() {
|
||||
expect(notFound).toEqual(['test']);
|
||||
});
|
||||
});
|
30
node_modules/mark.js/test/specs/basic/synonyms-diacritics.js
generated
vendored
Normal file
30
node_modules/mark.js/test/specs/basic/synonyms-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
describe('basic mark with synonyms and diacritics', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/synonyms-diacritics.html');
|
||||
|
||||
$ctx1 = $('.basic-synonyms-diacritics > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-synonyms-diacritics > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark(['dolor', 'amet'], {
|
||||
'separateWordSearch': false,
|
||||
'synonyms': {
|
||||
'dolor': 'justo'
|
||||
},
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('Lorem', {
|
||||
'separateWordSearch': false,
|
||||
'synonyms': {
|
||||
'Lorem': 'amet'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find synonyms with diacritics', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(14);
|
||||
expect($ctx2.find('mark')).toHaveLength(8);
|
||||
});
|
||||
});
|
21
node_modules/mark.js/test/specs/basic/synonyms-merge-blanks.js
generated
vendored
Normal file
21
node_modules/mark.js/test/specs/basic/synonyms-merge-blanks.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
describe('basic mark with synonyms and multiple blanks', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/synonyms-merge-blanks.html');
|
||||
|
||||
$ctx = $('.basic-synonyms-merge-blanks');
|
||||
new Mark($ctx[0]).mark(['dolor', 'amet'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'synonyms': {
|
||||
'dolor': 'lorem ipsum'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should find synonyms with diacritics', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
27
node_modules/mark.js/test/specs/basic/synonyms-no-match.js
generated
vendored
Normal file
27
node_modules/mark.js/test/specs/basic/synonyms-no-match.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
describe('basic mark with synonyms and noMatch', function() {
|
||||
var $ctx, notFound;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/synonyms-no-match.html');
|
||||
|
||||
$ctx = $('.basic-synonyms-no-match > p');
|
||||
notFound = [];
|
||||
new Mark($ctx[0]).mark('test', {
|
||||
'synonyms': {
|
||||
'test': 'ipsum'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'noMatch': function(term) {
|
||||
notFound.push(term);
|
||||
},
|
||||
'done': function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should not call noMatch if there are synonym matches', function() {
|
||||
expect(notFound).toEqual([]);
|
||||
});
|
||||
});
|
20
node_modules/mark.js/test/specs/basic/synonyms-not-empty.js
generated
vendored
Normal file
20
node_modules/mark.js/test/specs/basic/synonyms-not-empty.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
describe('basic mark ignore empty synonyms', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/synonyms-not-empty.html');
|
||||
$ctx = $('.synonyms-not-empty > div');
|
||||
new Mark($ctx[0]).mark('lorem', {
|
||||
'synonyms': {
|
||||
'lorem': ''
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'done': done
|
||||
});
|
||||
});
|
||||
|
||||
it('should ignore empty synonyms', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
34
node_modules/mark.js/test/specs/basic/synonyms.js
generated
vendored
Normal file
34
node_modules/mark.js/test/specs/basic/synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
describe('basic mark with synonyms', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-synonyms > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-synonyms > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('lorem', {
|
||||
'synonyms': {
|
||||
'lorem': 'ipsum'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark(['one', '2', 'lüfte'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'synonyms': {
|
||||
'ü': 'ue',
|
||||
'one': '1',
|
||||
'two': '2'
|
||||
},
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should wrap synonyms as well as keywords', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(8);
|
||||
expect($ctx2.find('mark')).toHaveLength(4);
|
||||
});
|
||||
});
|
28
node_modules/mark.js/test/specs/basic/unmark-exclude.js
generated
vendored
Normal file
28
node_modules/mark.js/test/specs/basic/unmark-exclude.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
describe('basic unmark with exclude', function() {
|
||||
var $ctx;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/unmark-exclude.html');
|
||||
|
||||
$ctx = $('.basic-unmark-exclude');
|
||||
new Mark($ctx[0]).mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
new Mark($ctx[0]).unmark({
|
||||
'exclude': [
|
||||
'*[data-ignore] *',
|
||||
'.ignore *'
|
||||
],
|
||||
'done': function(){
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should not unmark inside exclude selectors', function() {
|
||||
expect($ctx.find('mark')).toHaveLength(2);
|
||||
});
|
||||
});
|
31
node_modules/mark.js/test/specs/basic/unmark-jquery.js
generated
vendored
Normal file
31
node_modules/mark.js/test/specs/basic/unmark-jquery.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
describe('basic unmark with jquery', function() {
|
||||
var $ctx, ret;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
$ctx = $('.basic');
|
||||
$ctx.mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
ret = $ctx.unmark({
|
||||
'done': function() {
|
||||
// otherwise "ret =" will not be executed
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove all marked elements', function() {
|
||||
expect($ctx).not.toContainElement('mark');
|
||||
});
|
||||
it('should return the provided context jquery element', function() {
|
||||
expect(ret instanceof $).toBe(true);
|
||||
expect(ret).toBeMatchedBy('.basic');
|
||||
});
|
||||
});
|
40
node_modules/mark.js/test/specs/basic/unmark.js
generated
vendored
Normal file
40
node_modules/mark.js/test/specs/basic/unmark.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
describe('basic unmark', function() {
|
||||
var $ctx, ret;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/main.html');
|
||||
|
||||
$ctx = $('.basic');
|
||||
var instance = new Mark($ctx[0]);
|
||||
instance.mark('lorem ipsum', {
|
||||
'diacritics': false,
|
||||
'separateWordSearch': false,
|
||||
'done': function() {
|
||||
ret = instance.unmark({
|
||||
'done': function() {
|
||||
// otherwise "ret =" will not be executed
|
||||
setTimeout(function() {
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove all marked elements', function() {
|
||||
expect($ctx).not.toContainElement('mark');
|
||||
});
|
||||
it('should restore the DOM to the original state', function() {
|
||||
// all text nodes (including empty nodes from mark-tag removal)
|
||||
// should be converted into a single node
|
||||
var nodes = $ctx.find('> p')[0].childNodes;
|
||||
expect(nodes.length).toBe(1);
|
||||
});
|
||||
it('should return an object with further methods', function() {
|
||||
expect(ret instanceof Mark).toBe(true);
|
||||
expect(typeof ret.mark).toBe('function');
|
||||
expect(typeof ret.unmark).toBe('function');
|
||||
expect(typeof ret.markRegExp).toBe('function');
|
||||
});
|
||||
});
|
65
node_modules/mark.js/test/specs/basic/wildcards-between-words.js
generated
vendored
Normal file
65
node_modules/mark.js/test/specs/basic/wildcards-between-words.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
describe('basic mark with wildcards between words', function() {
|
||||
var $ctx1, $ctx2, $ctx3, $ctx4;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards-between-words.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards-between-words > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-wildcards-between-words > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-wildcards-between-words > div:nth-child(3)');
|
||||
$ctx4 = $('.basic-wildcards-between-words > div:nth-child(4)');
|
||||
new Mark($ctx1[0]).mark('lorem?ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lorem*ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark('lorem?ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'withSpaces',
|
||||
'done': function() {
|
||||
new Mark($ctx4[0]).mark('lorem*ipsum', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'withSpaces',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it(
|
||||
'should match wildcard with zero to one non-whitespace in the keyword',
|
||||
function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(4);
|
||||
}
|
||||
);
|
||||
it(
|
||||
'should match wildcard with zero or more non-whitespace in the keyword',
|
||||
function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(5);
|
||||
}
|
||||
);
|
||||
it(
|
||||
'should match wildcard with zero to one character in the keyword',
|
||||
function() {
|
||||
expect($ctx3.find('mark')).toHaveLength(6);
|
||||
}
|
||||
);
|
||||
it(
|
||||
'should match wildcard with zero or more characters in the keyword',
|
||||
function() {
|
||||
expect($ctx4.find('mark')).toHaveLength(9);
|
||||
}
|
||||
);
|
||||
|
||||
});
|
28
node_modules/mark.js/test/specs/basic/wildcards-diacritics.js
generated
vendored
Normal file
28
node_modules/mark.js/test/specs/basic/wildcards-diacritics.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
describe('basic mark with wildcards and diacritics', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards-diacritics.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards-diacritics > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-wildcards-diacritics > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('lor?m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lör*m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find wildcard matches containing diacritics', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(7);
|
||||
expect($ctx2.find('mark')).toHaveLength(13);
|
||||
});
|
||||
});
|
47
node_modules/mark.js/test/specs/basic/wildcards-escaped.js
generated
vendored
Normal file
47
node_modules/mark.js/test/specs/basic/wildcards-escaped.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
describe('basic mark with escaped wildcards', function() {
|
||||
var $ctx1, $ctx2, $ctx3;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards-escaped.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-wildcards > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-wildcards > div:nth-child(3)');
|
||||
new Mark($ctx1[0]).mark('lor\\?m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lor\\*m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark([
|
||||
'lor\\?m',
|
||||
'Lor\\*m'
|
||||
], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should treat escaped \'?\' normally when wildcards set', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(1);
|
||||
});
|
||||
it('should treat escaped \'*\' normally when wildcards set', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(1);
|
||||
});
|
||||
it(
|
||||
'should treat escaped \'?\' and \'*\' normally when wildcards not set',
|
||||
function() {
|
||||
expect($ctx3.find('mark')).toHaveLength(2);
|
||||
}
|
||||
);
|
||||
});
|
36
node_modules/mark.js/test/specs/basic/wildcards-ignore-joiners-synonyms.js
generated
vendored
Normal file
36
node_modules/mark.js/test/specs/basic/wildcards-ignore-joiners-synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
describe('basic mark with wildcards and synonyms', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards-ignore-joiners-synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards-ignore-joiners-synonyms div:first');
|
||||
$ctx2 = $('.basic-wildcards-ignore-joiners-synonyms div:last');
|
||||
new Mark($ctx1[0]).mark('Lor?m', {
|
||||
'synonyms': {
|
||||
'Lor?m': 'Ips?m'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'ignoreJoiners': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('Lor*m', {
|
||||
'synonyms': {
|
||||
'Lor*m': 'Ips*m'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'ignoreJoiners': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should match wildcards and joiners inside of synonyms', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(10);
|
||||
expect($ctx2.find('mark')).toHaveLength(17);
|
||||
});
|
||||
});
|
34
node_modules/mark.js/test/specs/basic/wildcards-synonyms.js
generated
vendored
Normal file
34
node_modules/mark.js/test/specs/basic/wildcards-synonyms.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
describe('basic mark with wildcards and synonyms', function() {
|
||||
var $ctx1, $ctx2;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards-synonyms.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards-synonyms > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-wildcards-synonyms > div:nth-child(2)');
|
||||
new Mark($ctx1[0]).mark('Lor?m', {
|
||||
'synonyms': {
|
||||
'Lor?m': 'Ips?m'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('Lor*m', {
|
||||
'synonyms': {
|
||||
'Lor*m': 'Ips*m'
|
||||
},
|
||||
'separateWordSearch': false,
|
||||
'diacritics': true,
|
||||
'wildcards': 'enabled',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should match wildcards inside of synonyms', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(10);
|
||||
expect($ctx2.find('mark')).toHaveLength(17);
|
||||
});
|
||||
});
|
52
node_modules/mark.js/test/specs/basic/wildcards.js
generated
vendored
Normal file
52
node_modules/mark.js/test/specs/basic/wildcards.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
describe('basic mark with wildcards', function() {
|
||||
var $ctx1, $ctx2, $ctx3, $ctx4;
|
||||
beforeEach(function(done) {
|
||||
loadFixtures('basic/wildcards.html');
|
||||
|
||||
$ctx1 = $('.basic-wildcards > div:nth-child(1)');
|
||||
$ctx2 = $('.basic-wildcards > div:nth-child(2)');
|
||||
$ctx3 = $('.basic-wildcards > div:nth-child(3)');
|
||||
$ctx4 = $('.basic-wildcards > div:nth-child(4)');
|
||||
new Mark($ctx1[0]).mark('lor?m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx2[0]).mark('lor*m', {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx3[0]).mark(['lor?m', 'Lor*m'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'enabled',
|
||||
'done': function() {
|
||||
new Mark($ctx4[0]).mark(['lor?m', 'Lor*m'], {
|
||||
'separateWordSearch': false,
|
||||
'diacritics': false,
|
||||
'wildcards': 'disabled',
|
||||
'done': done
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should find \'?\' wildcard matches', function() {
|
||||
expect($ctx1.find('mark')).toHaveLength(6);
|
||||
});
|
||||
it('should find \'*\' wildcard matches', function() {
|
||||
expect($ctx2.find('mark')).toHaveLength(8);
|
||||
});
|
||||
it('should find both \'?\' and \'*\' matches', function() {
|
||||
expect($ctx3.find('mark')).toHaveLength(14);
|
||||
});
|
||||
it('should find wildcards as plain characters when disabled', function() {
|
||||
expect($ctx4.find('mark')).toHaveLength(2);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user