Răsfoiți Sursa

make separate jasmine util function for promises

Adam Shaw 9 ani în urmă
părinte
comite
0310eb47a2

+ 2 - 2
tests/automated-better/event-drag/disableNonCurrentDates.js

@@ -11,7 +11,7 @@ describe('disableNonCurrentDates event dragging', function() {
 	});
 
 	describe('when dragging pointer into disabled region', function() {
-		it('won\'t allow the drop', function() {
+		pit('won\'t allow the drop', function() {
 			initCalendar();
 			return EventDragUtils.drag(
 				DayGridRenderUtils.getSingleDayEl('2017-06-08')[0].getBoundingClientRect(),
@@ -23,7 +23,7 @@ describe('disableNonCurrentDates event dragging', function() {
 	});
 
 	describe('when dragging an event\'s start into a disabled region', function() {
-		it('allow the drop if the cursor stays over non-disabled cells', function() {
+		pit('allow the drop if the cursor stays over non-disabled cells', function() {
 			initCalendar();
 			return DayGridEventDragUtils.drag('2017-06-08', '2017-06-01')
 				.then(function(res) {

+ 1 - 1
tests/automated-better/event-drag/maxDate.js

@@ -12,7 +12,7 @@ describe('maxDate event dragging', function() {
 			editable: true
 		});
 
-		it('won\'t go after maxDate', function() {
+		pit('won\'t go after maxDate', function() {
 			initCalendar();
 			return DayGridEventDragUtils.drag('2017-06-05', '2017-06-08')
 				.then(function(res) {

+ 1 - 1
tests/automated-better/event-drag/minDate.js

@@ -12,7 +12,7 @@ describe('minDate event dragging', function() {
 			editable: true
 		});
 
-		it('won\'t go before minDate', function() {
+		pit('won\'t go before minDate', function() {
 			initCalendar();
 			return DayGridEventDragUtils.drag('2017-06-08', '2017-06-06')
 				.then(function(res) {

+ 1 - 1
tests/automated-better/event-resize/maxDate.js

@@ -12,7 +12,7 @@ describe('maxDate event resizing', function() {
 			editable: true
 		});
 
-		it('won\'t go after maxDate', function() {
+		pit('won\'t go after maxDate', function() {
 			initCalendar();
 			return EventResizeUtils.resize(
 				DayGridRenderUtils.getSingleDayEl('2017-06-06')[0].getBoundingClientRect(),

+ 6 - 18
tests/automated-better/globals.js

@@ -2,24 +2,12 @@
 // Jasmine Enhancements
 // ---------------------------------------------------------------------------------------------------------------------
 
-/*
-Give it/fit the ability to return promises
-*/
-[ 'it', 'fit' ].forEach(function(funcName) {
-	var origFunc = window[funcName];
-
-	window[funcName] = function(description, runFunc) {
-		origFunc(description, function(done) {
-			var res = runFunc(done);
-			if (res && res.then) {
-				res.then(done);
-			}
-			else {
-				done();
-			}
-		});
-	};
-});
+// like `it`, but with the ability to return a promise
+function pit(description, runFunc) {
+	it(description, function(done) {
+		runFunc().then(done);
+	});
+}
 
 
 // Setup / Teardown