make slot_event_overlap test even better

This commit is contained in:
Adam Shaw
2013-08-31 21:05:25 -07:00
parent 6eb4693972
commit b7f96ba79a
+22
View File
@@ -98,8 +98,18 @@
}
function _testOverlap(el, allowOverlap, isRTL) {
var events = el.find('.fc-event');
var cell = el.find('.fc-slot0 td');
var cellLeft = Math.round(cell.offset().left);
var cellWidth = Math.round(cell.outerWidth());
if (!events.length) { // json events probably couldn't load
console.log('need to run this from a real web server');
return false;
}
for (var i=0; i<events.length; i++) {
var event = $(events[i]);
@@ -109,6 +119,16 @@
var width = Math.floor(event.outerWidth());
var height = Math.floor(event.outerHeight());
if (left < cellLeft || left + width > cellLeft + cellWidth) {
console.log('event is out of bounds', event[0]);
return false;
}
if (width < 10 || height < 10) {
console.log('event is suprisingly small', event[0]);
return false;
}
if (allowOverlap) {
width /= 2; // make sure nothing overlaps the first half of the event
if (isRTL) {
@@ -160,6 +180,8 @@
return true;
}
// TODO: add tests for viewing events in week-mode also
</script>
<style>