mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 23:20:02 +00:00
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
|
'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);
|
||
|
});
|
||
|
});
|
||
|
});
|