Browse Source

Update tests

acerix 8 years ago
parent
commit
e62b686ad5
1 changed files with 27 additions and 25 deletions
  1. 27 25
      tests/legacy/eventMouseover.js

+ 27 - 25
tests/legacy/eventMouseover.js

@@ -1,39 +1,41 @@
 describe('eventMouseover', function() {
-	var options;
-
-	beforeEach(function() {
-		affix('#cal');
-		options = {
-			defaultDate: '2014-08-01',
-			scrollTime: '00:00:00'
-		};
+
+	pushOptions({
+		defaultDate: '2014-08-01',
+		scrollTime: '00:00:00'
 	});
 
 	[ 'month', 'agendaWeek' ].forEach(function(viewName) {
 		describe('for ' + viewName + ' view', function() {
-			beforeEach(function() {
-				options.defaultView = viewName;
+
+			pushOptions({
+				defaultView: viewName
 			});
+
 			it('will trigger a eventMouseout with updateEvent', function(done) {
-				options.events = [ {
-					title: 'event',
-					start: '2014-08-02T01:00:00',
-					className: 'event'
-				} ];
-				options.eventMouseover = function(event, ev) {
-					expect(typeof event).toBe('object');
-					expect(typeof ev).toBe('object');
-					event.title = 'YO';
-					$('#cal').fullCalendar('updateEvent', event);
-				};
-				options.eventMouseout = function(event, ev) {
+
+				var eventMouseoutSpy = spyOnCalendarCallback('eventMouseout', function(event, ev) {
 					expect(typeof event).toBe('object');
 					expect(typeof ev).toBe('object');
 					done();
-				};
-				spyOn(options, 'eventMouseout').and.callThrough();
-				$('#cal').fullCalendar(options);
+				});
+
+				initCalendar({
+					events: [ {
+						title: 'event',
+						start: '2014-08-02T01:00:00',
+						className: 'event'
+					} ],
+					eventMouseover: function(event, ev) {
+						expect(typeof event).toBe('object');
+						expect(typeof ev).toBe('object');
+						event.title = 'YO';
+						currentCalendar.updateEvent(event);
+					}
+				});
+
 				$('.event').simulate('mouseover');
+
 			});
 		});
 	});