Adam Shaw 8 лет назад
Родитель
Сommit
3b17a41ea4
3 измененных файлов с 15 добавлено и 11 удалено
  1. 3 3
      src/models/event/EventDef.js
  2. 1 1
      src/models/event/SingleEventDef.js
  3. 11 7
      tests/legacy/constraint.js

+ 3 - 3
src/models/event/EventDef.js

@@ -192,13 +192,13 @@ EventDef.pluckAndParse = function(rawProps, source) {
 		def.className = className;
 	}
 
+	// transfer all other simple props
+	$.extend(def, pluckProps(rawProps, EventDef.VERBATIM_PROPS));
+
 	// raw input object might have specified
 	// intercepted earlier
 	delete rawProps.source;
 
-	// transfer all other simple props
-	$.extend(def, pluckProps(rawProps, EventDef.VERBATIM_PROPS));
-
 	// leftovers are misc props
 	def.miscProps = rawProps;
 

+ 1 - 1
src/models/event/SingleEventDef.js

@@ -64,7 +64,7 @@ SingleEventDef.pluckAndParse = function(rawProps, source) {
 		return false;
 	}
 
-	if (end && !end.isValid()) {
+	if (end && (!end.isValid() || !end.isAfter(start))) {
 		end = null;
 	}
 

+ 11 - 7
tests/legacy/constraint.js

@@ -471,6 +471,7 @@ describe('event constraint', function() {
 						{
 							start: '2014-11-12T01:00:00',
 							end: '2014-11-12T03:00:00',
+							className: 'dragging-event',
 							constraint: 'yo'
 						},
 						{
@@ -479,7 +480,7 @@ describe('event constraint', function() {
 							end: '2014-11-13T05:00:00'
 						}
 					];
-					testEventDrag(options, '2014-11-13T02:00:00', true, done);
+					testEventDrag(options, '2014-11-13T02:00:00', true, done, 'dragging-event');
 				});
 			});
 
@@ -490,7 +491,8 @@ describe('event constraint', function() {
 							{
 								start: '2014-11-12T01:00:00',
 								end: '2014-11-12T03:00:00',
-								constraint: 'yo'
+								constraint: 'yo',
+								className: 'dragging-event'
 							},
 							{
 								id: 'yo',
@@ -498,7 +500,7 @@ describe('event constraint', function() {
 								end: '2014-11-13T04:00:00'
 							}
 						];
-						testEventDrag(options, '2014-11-13T04:00:00', false, done);
+						testEventDrag(options, '2014-11-13T04:00:00', false, done, 'dragging-event');
 					});
 				});
 				describe('when an implied end time', function() {
@@ -508,14 +510,15 @@ describe('event constraint', function() {
 							{
 								start: '2014-11-12T01:00:00',
 								end: '2014-11-12T03:00:00',
-								constraint: 'yo'
+								constraint: 'yo',
+								className: 'dragging-event'
 							},
 							{
 								id: 'yo',
 								start: '2014-11-13T01:00:00'
 							}
 						];
-						testEventDrag(options, '2014-11-13T01:00:00', false, done);
+						testEventDrag(options, '2014-11-13T01:00:00', false, done, 'dragging-event');
 					});
 				});
 			});
@@ -526,7 +529,8 @@ describe('event constraint', function() {
 						{
 							start: '2014-11-12T01:00:00',
 							end: '2014-11-12T03:00:00',
-							constraint: 'yo'
+							constraint: 'yo',
+							className: 'dragging-event'
 						},
 						{
 							id: 'yo',
@@ -535,7 +539,7 @@ describe('event constraint', function() {
 							rendering: 'background'
 						}
 					];
-					testEventDrag(options, '2014-11-13T04:00:00', false, done);
+					testEventDrag(options, '2014-11-13T04:00:00', false, done, 'dragging-event');
 				});
 			});