devstar插件

This commit is contained in:
2025-07-26 16:40:29 +08:00
commit 30033daafe
4387 changed files with 1041101 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
'use strict';
describe('mark with acrossElements and matches across iframes', function() {
var $ctx, $elements, errCall;
beforeEach(function(done) {
loadFixtures('across-elements/iframes/across.html');
$elements = $();
$ctx = $('.across-elements-iframes-across');
errCall = 0;
try {
new Mark($ctx[0]).mark(['dolor sit', 'amet. Lorem'], {
'diacritics': false,
'separateWordSearch': false,
'iframes': true,
'acrossElements': true,
'each': function($m) {
$elements = $elements.add($($m));
},
'done': done
});
} catch (e) {
errCall++;
}
}, 30000); // 30 sec timeout
it('should wrap matches across iframes recursively', function() {
expect(errCall).toBe(0);
expect($elements).toHaveLength(30); // including whitespace matches
});
});

View File

@@ -0,0 +1,38 @@
'use strict';
describe('mark with acrossElements and iframes', function() {
var $ctx, $elements, errCall;
beforeEach(function(done) {
loadFixtures('across-elements/iframes/main.html');
$elements = $();
$ctx = $('.across-elements-iframes');
errCall = 0;
try {
new Mark($ctx[0]).mark('lorem', {
'diacritics': false,
'separateWordSearch': false,
'iframes': true,
'acrossElements': true,
'each': function($m) {
$elements = $elements.add($($m));
},
'done': done
});
} catch (e) {
errCall++;
}
}, 30000); // 30 sec timeout
it('should wrap matches inside iframes', function() {
expect(errCall).toBe(0);
expect($elements).toHaveLength(8);
var unequal = false;
$elements.each(function() {
// make sure that some elements are inside an iframe
if ($(this).prop('ownerDocument') !== $ctx.prop('ownerDocument')) {
unequal = true;
}
});
expect(unequal).toBe(true);
});
});

View File

@@ -0,0 +1,30 @@
'use strict';
describe('mark with acrossElements and nested iframes', function() {
var $ctx, $elements, errCall;
beforeEach(function(done) {
loadFixtures('across-elements/iframes/nested.html');
$elements = $();
$ctx = $('.across-elements-iframes-nested');
errCall = 0;
try {
new Mark($ctx[0]).mark('lorem', {
'diacritics': false,
'separateWordSearch': false,
'iframes': true,
'acrossElements': true,
'each': function($m) {
$elements = $elements.add($($m));
},
'done': done
});
} catch (e) {
errCall++;
}
}, 30000); // 30 sec timeout
it('should wrap matches inside iframes recursively', function() {
expect(errCall).toBe(0);
expect($elements).toHaveLength(12);
});
});