1d82f671a3
Fixes #35539. git-svn-id: https://develop.svn.wordpress.org/trunk@36352 602fd350-edb4-49c9-b593-d223f7449a82
29 lines
826 B
JavaScript
29 lines
826 B
JavaScript
ModuleLoader.require([
|
|
"tinymce/Env",
|
|
"tinymce/caret/LineUtils"
|
|
], function(Env, LineUtils) {
|
|
module("tinymce.caret.LineUtils");
|
|
|
|
if (!Env.ceFalse) {
|
|
return;
|
|
}
|
|
|
|
function rect(x, y, w, h) {
|
|
return {
|
|
left: x,
|
|
top: y,
|
|
bottom: y + h,
|
|
right: x + w,
|
|
width: w,
|
|
height: h
|
|
};
|
|
}
|
|
|
|
test('findClosestClientRect', function() {
|
|
deepEqual(LineUtils.findClosestClientRect([rect(10, 10, 10, 10), rect(30, 10, 10, 10)], 15), rect(10, 10, 10, 10));
|
|
deepEqual(LineUtils.findClosestClientRect([rect(10, 10, 10, 10), rect(30, 10, 10, 10)], 27), rect(30, 10, 10, 10));
|
|
deepEqual(LineUtils.findClosestClientRect([rect(10, 10, 10, 10), rect(30, 10, 10, 10)], 23), rect(10, 10, 10, 10));
|
|
deepEqual(LineUtils.findClosestClientRect([rect(10, 10, 10, 10), rect(20, 10, 10, 10)], 13), rect(10, 10, 10, 10));
|
|
});
|
|
});
|