dont mistake a jqui resize event for a window resize event

This commit is contained in:
Adam Shaw
2014-06-13 15:03:23 -07:00
parent 7cbac28270
commit 6153ac285e
3 changed files with 31 additions and 4 deletions
+6 -3
View File
@@ -486,8 +486,11 @@ function Calendar(element, instanceOptions) {
}
function windowResize() {
if (!ignoreWindowResize) {
function windowResize(ev) {
if (
!ignoreWindowResize &&
ev.target === window // so we don't process jqui "resize" events that have bubbled up
) {
if (currentView.start) { // view has already been rendered
var uid = ++resizeUID;
setTimeout(function() { // add a delay
@@ -499,7 +502,7 @@ function Calendar(element, instanceOptions) {
ignoreWindowResize--;
}
}
}, 200);
}, options.windowResizeDelay);
}else{
// calendar must have been initialized in a 0x0 iframe that has just been resized
lateRender();
+2 -1
View File
@@ -89,7 +89,8 @@ var defaults = {
dropAccept: '*',
handleWindowResize: true
handleWindowResize: true,
windowResizeDelay: 200 // milliseconds before a rerender happens
};
+23
View File
@@ -184,6 +184,29 @@ describe('eventResize', function() {
}
);
});
it('should not fire the windowResize handler', function(done) { // bug 1116
options.windowResize = function() { };
options.windowResizeDelay = 0;
spyOn(options, 'windowResize');
init(
function() {
$('.fc-event .ui-resizable-handle')
.simulate('mouseover') // for our dumb optimization
.simulate('drag-n-drop', {
dy: 200,
interpolation: {
stepCount: 10,
duration: 100
}
});
},
function() { // if an unintended rerender happened, won't get here anyway
expect(options.windowResize).not.toHaveBeenCalled();
done();
}
);
});
});
describe('when resizing a timed event without an end', function() {