Skip to content

Commit 15fc899

Browse files
committedAug 26, 2014
fixes to make the latest automated tests work in the IEs
1 parent 956f26a commit 15fc899

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed
 

‎build/karma.conf.js

-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ module.exports = function(config) {
4444
'../dist/fullcalendar.css',
4545
'../tests/base.css',
4646

47-
// For IE8 testing. Because it can't handle running all the tests at once.
48-
// Comment out the *.js line and run karma with each of the lines below.
49-
//'../tests/automated/{a,b,c,d,e,f,g,h,i,j,k,l}*.js'
50-
//'../tests/automated/{m,n}*.js' // mostly moment tests
51-
//'../tests/automated/{o,p,q,r,s,t,u,v,w,x,y,z}*.js'
52-
5347
'../tests/automated/*.js'
5448
],
5549

‎tests/automated/eventLimit-popover.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ describe('eventLimit popover', function() {
9494
it('closes when user clicks the X', function() {
9595
init();
9696
expect($('.fc-more-popover')).toBeVisible();
97-
$('.fc-more-popover .fc-close').simulate('click');
97+
$('.fc-more-popover .fc-close')
98+
.simulate('click')
99+
.trigger('click'); // needed this for IE8 for some reason
98100
expect($('.fc-more-popover')).not.toBeVisible();
99101
});
100102

‎tests/automated/external-dnd.js

+30-18
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ describe('external drag and drop', function() {
4646
$('#sidebar .event1').remove();
4747
$('#cal').fullCalendar('next');
4848
$('#cal').fullCalendar('prev');
49-
$('#sidebar .event2').simulate('drag-n-drop', {
50-
dropTarget: getMonthCell(1, 3)
51-
});
49+
setTimeout(function() { // needed for IE8
50+
$('#sidebar .event2').simulate('drag-n-drop', {
51+
dropTarget: getMonthCell(1, 3)
52+
});
53+
}, 0);
5254
}
5355
else if (callCnt === 1) {
5456
expect(date).toEqualMoment('2014-08-06');
@@ -58,9 +60,11 @@ describe('external drag and drop', function() {
5860
};
5961

6062
$('#cal').fullCalendar(options);
61-
$('#sidebar .event1').simulate('drag-n-drop', {
62-
dropTarget: getMonthCell(1, 3)
63-
});
63+
setTimeout(function() { // needed for IE8
64+
$('#sidebar .event1').simulate('drag-n-drop', {
65+
dropTarget: getMonthCell(1, 3)
66+
});
67+
}, 0);
6468
});
6569
});
6670

@@ -81,9 +85,11 @@ describe('external drag and drop', function() {
8185
$('#sidebar .event1').remove();
8286
$('#cal').fullCalendar('next');
8387
$('#cal').fullCalendar('prev');
84-
$('#sidebar .event2').simulate('drag-n-drop', {
85-
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
86-
});
88+
setTimeout(function() { // needed for IE8, for firing the second time, for some reason
89+
$('#sidebar .event2').simulate('drag-n-drop', {
90+
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
91+
});
92+
}, 0);
8793
}
8894
else if (callCnt === 1) {
8995
expect(date).toEqualMoment('2014-08-20T01:00:00');
@@ -93,9 +99,11 @@ describe('external drag and drop', function() {
9399
};
94100

95101
$('#cal').fullCalendar(options);
96-
$('#sidebar .event1').simulate('drag-n-drop', {
97-
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
98-
});
102+
setTimeout(function() { // needed for IE8
103+
$('#sidebar .event1').simulate('drag-n-drop', {
104+
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
105+
});
106+
}, 0);
99107
});
100108

101109
it('works with timezone as "local"', function(done) { // for issue 2225
@@ -105,9 +113,11 @@ describe('external drag and drop', function() {
105113
done();
106114
};
107115
$('#cal').fullCalendar(options);
108-
$('#sidebar .event1').simulate('drag-n-drop', {
109-
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
110-
});
116+
setTimeout(function() { // needed for IE8
117+
$('#sidebar .event1').simulate('drag-n-drop', {
118+
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
119+
});
120+
}, 0);
111121
});
112122

113123
it('works with timezone as "UTC"', function(done) { // for issue 2225
@@ -117,9 +127,11 @@ describe('external drag and drop', function() {
117127
done();
118128
};
119129
$('#cal').fullCalendar(options);
120-
$('#sidebar .event1').simulate('drag-n-drop', {
121-
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
122-
});
130+
setTimeout(function() { // needed for IE8
131+
$('#sidebar .event1').simulate('drag-n-drop', {
132+
dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
133+
});
134+
}, 0);
123135
});
124136
});
125137

‎tests/lib/jasmine-ext.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ beforeEach(function() {
6464
compare: function(actual) {
6565
var elm = $(actual);
6666
var result = {
67-
pass: elm.width() !== elm[0].clientWidth ||
68-
elm.height() !== elm[0].clientHeight
67+
pass: elm[0].scrollWidth - 1 > elm[0].clientWidth || // -1 !!!
68+
elm[0].scrollHeight - 1 > elm[0].clientHeight // -1 !!!
6969
};
70+
// !!! - IE was reporting a scrollWidth/scrollHeight 1 pixel taller than what it was :(
7071
return result;
7172
}
7273
};
@@ -101,7 +102,8 @@ beforeEach(function() {
101102
var otherBounds = getBounds(expected);
102103
var result = {
103104
pass: subjectBounds && otherBounds &&
104-
subjectBounds.right <= otherBounds.left
105+
Math.round(subjectBounds.right) <= Math.round(otherBounds.left)
106+
// need to round because IE was giving weird fractions
105107
};
106108
if (!result.pass) {
107109
result.message = 'Element is not to the left of the other element';
@@ -117,7 +119,8 @@ beforeEach(function() {
117119
var otherBounds = getBounds(expected);
118120
var result = {
119121
pass: subjectBounds && otherBounds &&
120-
subjectBounds.left >= otherBounds.right
122+
Math.round(subjectBounds.left) >= Math.round(otherBounds.right)
123+
// need to round because IE was giving weird fractions
121124
};
122125
if (!result.pass) {
123126
result.message = 'Element is not to the right of the other element';

0 commit comments

Comments
 (0)
Please sign in to comment.