Преглед на файлове

fixes to make the latest automated tests work in the IEs

Adam Shaw преди 11 години
родител
ревизия
15fc899f05
променени са 4 файла, в които са добавени 40 реда и са изтрити 29 реда
  1. 0 6
      build/karma.conf.js
  2. 3 1
      tests/automated/eventLimit-popover.js
  3. 30 18
      tests/automated/external-dnd.js
  4. 7 4
      tests/lib/jasmine-ext.js

+ 0 - 6
build/karma.conf.js

@@ -44,12 +44,6 @@ module.exports = function(config) {
 			'../dist/fullcalendar.css',
 			'../tests/base.css',
 
-			// For IE8 testing. Because it can't handle running all the tests at once.
-			// Comment out the *.js line and run karma with each of the lines below.
-			//'../tests/automated/{a,b,c,d,e,f,g,h,i,j,k,l}*.js'
-			//'../tests/automated/{m,n}*.js' // mostly moment tests
-			//'../tests/automated/{o,p,q,r,s,t,u,v,w,x,y,z}*.js'
-
 			'../tests/automated/*.js'
 		],
 

+ 3 - 1
tests/automated/eventLimit-popover.js

@@ -94,7 +94,9 @@ describe('eventLimit popover', function() {
 	it('closes when user clicks the X', function() {
 		init();
 		expect($('.fc-more-popover')).toBeVisible();
-		$('.fc-more-popover .fc-close').simulate('click');
+		$('.fc-more-popover .fc-close')
+			.simulate('click')
+			.trigger('click'); // needed this for IE8 for some reason
 		expect($('.fc-more-popover')).not.toBeVisible();
 	});
 

+ 30 - 18
tests/automated/external-dnd.js

@@ -46,9 +46,11 @@ describe('external drag and drop', function() {
 					$('#sidebar .event1').remove();
 					$('#cal').fullCalendar('next');
 					$('#cal').fullCalendar('prev');
-					$('#sidebar .event2').simulate('drag-n-drop', {
-						dropTarget: getMonthCell(1, 3)
-					});
+					setTimeout(function() { // needed for IE8
+						$('#sidebar .event2').simulate('drag-n-drop', {
+							dropTarget: getMonthCell(1, 3)
+						});
+					}, 0);
 				}
 				else if (callCnt === 1) {
 					expect(date).toEqualMoment('2014-08-06');
@@ -58,9 +60,11 @@ describe('external drag and drop', function() {
 			};
 
 			$('#cal').fullCalendar(options);
-			$('#sidebar .event1').simulate('drag-n-drop', {
-				dropTarget: getMonthCell(1, 3)
-			});
+			setTimeout(function() { // needed for IE8
+				$('#sidebar .event1').simulate('drag-n-drop', {
+					dropTarget: getMonthCell(1, 3)
+				});
+			}, 0);
 		});
 	});
 
@@ -81,9 +85,11 @@ describe('external drag and drop', function() {
 					$('#sidebar .event1').remove();
 					$('#cal').fullCalendar('next');
 					$('#cal').fullCalendar('prev');
-					$('#sidebar .event2').simulate('drag-n-drop', {
-						dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
-					});
+					setTimeout(function() { // needed for IE8, for firing the second time, for some reason
+						$('#sidebar .event2').simulate('drag-n-drop', {
+							dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
+						});
+					}, 0);
 				}
 				else if (callCnt === 1) {
 					expect(date).toEqualMoment('2014-08-20T01:00:00');
@@ -93,9 +99,11 @@ describe('external drag and drop', function() {
 			};
 
 			$('#cal').fullCalendar(options);
-			$('#sidebar .event1').simulate('drag-n-drop', {
-				dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
-			});
+			setTimeout(function() { // needed for IE8
+				$('#sidebar .event1').simulate('drag-n-drop', {
+					dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20
+				});
+			}, 0);
 		});
 
 		it('works with timezone as "local"', function(done) { // for issue 2225
@@ -105,9 +113,11 @@ describe('external drag and drop', function() {
 				done();
 			};
 			$('#cal').fullCalendar(options);
-			$('#sidebar .event1').simulate('drag-n-drop', {
-				dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
-			});
+			setTimeout(function() { // needed for IE8
+				$('#sidebar .event1').simulate('drag-n-drop', {
+					dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
+				});
+			}, 0);
 		});
 
 		it('works with timezone as "UTC"', function(done) { // for issue 2225
@@ -117,9 +127,11 @@ describe('external drag and drop', function() {
 				done();
 			};
 			$('#cal').fullCalendar(options);
-			$('#sidebar .event1').simulate('drag-n-drop', {
-				dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
-			});
+			setTimeout(function() { // needed for IE8
+				$('#sidebar .event1').simulate('drag-n-drop', {
+					dropTarget: $('.fc-slats tr:eq(2)') // middle is 1:00am on 2014-08-20, LOCAL TIME
+				});
+			}, 0);
 		});
 	});
 

+ 7 - 4
tests/lib/jasmine-ext.js

@@ -64,9 +64,10 @@ beforeEach(function() {
 				compare: function(actual) {
 					var elm = $(actual);
 					var result = {
-						pass: elm.width() !== elm[0].clientWidth ||
-							elm.height() !== elm[0].clientHeight
+						pass: elm[0].scrollWidth - 1 > elm[0].clientWidth || // -1 !!!
+							elm[0].scrollHeight - 1 > elm[0].clientHeight // -1 !!!
 					};
+					// !!! - IE was reporting a scrollWidth/scrollHeight 1 pixel taller than what it was :(
 					return result;
 				}
 			};
@@ -101,7 +102,8 @@ beforeEach(function() {
 					var otherBounds = getBounds(expected);
 					var result = {
 						pass: subjectBounds && otherBounds &&
-							subjectBounds.right <= otherBounds.left
+							Math.round(subjectBounds.right) <= Math.round(otherBounds.left)
+							// need to round because IE was giving weird fractions
 					};
 					if (!result.pass) {
 						result.message = 'Element is not to the left of the other element';
@@ -117,7 +119,8 @@ beforeEach(function() {
 					var otherBounds = getBounds(expected);
 					var result = {
 						pass: subjectBounds && otherBounds &&
-							subjectBounds.left >= otherBounds.right
+							Math.round(subjectBounds.left) >= Math.round(otherBounds.right)
+							// need to round because IE was giving weird fractions
 					};
 					if (!result.pass) {
 						result.message = 'Element is not to the right of the other element';