Adam Shaw 8 rokov pred
rodič
commit
0e6896cb03

+ 0 - 4
tests/globals.js

@@ -172,10 +172,6 @@ function describeTimezone(name, callback) {
 // Misc
 // ---------------------------------------------------------------------------------------------------------------------
 
-function isElWithinRtl(el) {
-	return el.closest('.fc').hasClass('fc-rtl');
-}
-
 function oneCall(func) {
 	var called;
 	called = false;

+ 1 - 0
tests/legacy/businessHours.js

@@ -1,6 +1,7 @@
 // most other businessHours tests are in background-events.js
 
 import { doElsMatchSegs, getBoundingRect } from '../lib/dom-utils';
+import { getTimeGridTop, getTimeGridDayEls, getTimeGridSlotEls } from '../lib/time-grid';
 
 describe('businessHours', function() {
 	var options;

+ 2 - 0
tests/legacy/eventAllow.js

@@ -1,3 +1,5 @@
+import { dragTimeGridEvent } from '../lib/time-grid';
+
 describe('eventAllow', function() {
 	var options;
 

+ 2 - 1
tests/legacy/nowIndicator.js

@@ -1,4 +1,5 @@
-import { getBoundingRect } from '../lib/dom-utils';
+import { getBoundingRect, isElWithinRtl } from '../lib/dom-utils';
+import { getTimeGridLine } from '../lib/time-grid';
 
 describe('now indicator', function() {
 	var FC = $.fullCalendar;

+ 3 - 1
tests/legacy/selectAllow.js

@@ -1,3 +1,5 @@
+import { selectTimeGrid } from '../lib/time-grid';
+
 describe('selectAllow', function() {
 	var options;
 
@@ -47,4 +49,4 @@ describe('selectAllow', function() {
 				done();
 			});
 	});
-});
+});

+ 5 - 0
tests/lib/dom-utils.js

@@ -51,6 +51,11 @@ function getHandlerHash(el) {
 }
 
 
+export function isElWithinRtl(el) {
+	return el.closest('.fc').hasClass('fc-rtl');
+}
+
+
 /* copied from other proj
 ----------------------------------------------------------------------------------------------------------------------*/
 

+ 7 - 22
tests/lib/time-grid.js

@@ -2,7 +2,8 @@
 
 import { getBoundingRect } from '../lib/dom-utils';
 
-function dragTimeGridEvent(eventEl, dropDate) {
+
+export function dragTimeGridEvent(eventEl, dropDate) {
 	return new Promise(function(resolve) {
 		var calendar = $('#cal').fullCalendar('getCalendar');
 		var modifiedEvent = null;
@@ -24,7 +25,7 @@ function dragTimeGridEvent(eventEl, dropDate) {
 }
 
 
-function selectTimeGrid(start, inclusiveEnd) {
+export function selectTimeGrid(start, inclusiveEnd) {
 	return new Promise(function(resolve) {
 		var calendar = $('#cal').fullCalendar('getCalendar');
 		var selectInfo = null;
@@ -62,7 +63,7 @@ function getTimeGridPoint(date) {
 }
 
 
-function getTimeGridLine(date) { // not in Scheduler
+export function getTimeGridLine(date) { // not in Scheduler
 	var date = $.fullCalendar.moment.parseZone(date);
 	var top = getTimeGridTop(date.time());
 	var dayEls = getTimeGridDayEls(date);
@@ -80,7 +81,7 @@ function getTimeGridLine(date) { // not in Scheduler
 }
 
 
-function getTimeGridTop(time) {
+export function getTimeGridTop(time) {
 	var time = moment.duration(time);
 	var slotEls = getTimeGridSlotEls(time);
 
@@ -90,32 +91,16 @@ function getTimeGridTop(time) {
 }
 
 
-function getTimeGridDayEls(date) {
+export function getTimeGridDayEls(date) {
 	var date = $.fullCalendar.moment.parseZone(date);
 
 	return $('.fc-time-grid .fc-day[data-date="' + date.format('YYYY-MM-DD') + '"]');
 }
 
 
-function getTimeGridSlotEls(timeDuration) {
+export function getTimeGridSlotEls(timeDuration) {
 	var timeDuration = moment.duration(timeDuration);
 	var date = $.fullCalendar.moment.utc('2016-01-01').time(timeDuration);
 
 	return $('.fc-time-grid .fc-slats tr[data-time="' + date.format('HH:mm:ss') + '"]');
 }
-
-
-function isElWithinRtl(el) {
-	return el.closest('.fc').hasClass('fc-rtl');
-}
-
-
-function getBoundingRect(el) {
-	var el = $(el);
-	expect(el.length).toBe(1);
-	var rect = el.offset();
-	rect.right = rect.left + el.outerWidth();
-	rect.bottom = rect.top + el.outerHeight();
-	rect.node = el[0]; // very useful for debugging
-	return rect;
-}