mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-06-27 16:10:13 +08:00
code quality improvements (for jshint)
This commit is contained in:
+5
-4
@@ -315,10 +315,11 @@ function EventManager(options) { // assumed to be a calendar
|
||||
|
||||
|
||||
function removeEvents(filter) {
|
||||
var i;
|
||||
if (!filter) { // remove all
|
||||
cache = [];
|
||||
// clear all array sources
|
||||
for (var i=0; i<sources.length; i++) {
|
||||
for (i=0; i<sources.length; i++) {
|
||||
if ($.isArray(sources[i].events)) {
|
||||
sources[i].events = [];
|
||||
}
|
||||
@@ -332,7 +333,7 @@ function EventManager(options) { // assumed to be a calendar
|
||||
}
|
||||
cache = $.grep(cache, filter, true);
|
||||
// remove events from array sources
|
||||
for (var i=0; i<sources.length; i++) {
|
||||
for (i=0; i<sources.length; i++) {
|
||||
if ($.isArray(sources[i].events)) {
|
||||
sources[i].events = $.grep(sources[i].events, filter, true);
|
||||
}
|
||||
@@ -362,14 +363,14 @@ function EventManager(options) { // assumed to be a calendar
|
||||
|
||||
|
||||
function pushLoading() {
|
||||
if (!loadingLevel++) {
|
||||
if (!(loadingLevel++)) {
|
||||
trigger('loading', null, true, getView());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function popLoading() {
|
||||
if (!--loadingLevel) {
|
||||
if (!(--loadingLevel)) {
|
||||
trigger('loading', null, false, getView());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ function AgendaEventRenderer() {
|
||||
// record event sides and title positions
|
||||
for (i=0; i<segCnt; i++) {
|
||||
seg = segs[i];
|
||||
if (eventElement = seg.element) {
|
||||
if ((eventElement = seg.element)) {
|
||||
seg.vsides = vsides(eventElement, true);
|
||||
seg.hsides = hsides(eventElement, true);
|
||||
titleElement = eventElement.find('.fc-event-title');
|
||||
@@ -292,7 +292,7 @@ function AgendaEventRenderer() {
|
||||
// set all positions/dimensions at once
|
||||
for (i=0; i<segCnt; i++) {
|
||||
seg = segs[i];
|
||||
if (eventElement = seg.element) {
|
||||
if ((eventElement = seg.element)) {
|
||||
eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
|
||||
height = Math.max(0, seg.outerHeight - seg.vsides);
|
||||
eventElement[0].style.height = height + 'px';
|
||||
|
||||
+17
-18
@@ -50,25 +50,25 @@ function AgendaView(element, calendar, viewName) {
|
||||
t.afterRender = afterRender;
|
||||
t.computeDateTop = computeDateTop;
|
||||
t.getIsCellAllDay = getIsCellAllDay;
|
||||
t.allDayRow = function() { return allDayRow }; // badly named
|
||||
t.getCoordinateGrid = function() { return coordinateGrid }; // specifically for AgendaEventRenderer
|
||||
t.getHoverListener = function() { return hoverListener };
|
||||
t.allDayRow = function() { return allDayRow; }; // badly named
|
||||
t.getCoordinateGrid = function() { return coordinateGrid; }; // specifically for AgendaEventRenderer
|
||||
t.getHoverListener = function() { return hoverListener; };
|
||||
t.colLeft = colLeft;
|
||||
t.colRight = colRight;
|
||||
t.colContentLeft = colContentLeft;
|
||||
t.colContentRight = colContentRight;
|
||||
t.getDaySegmentContainer = function() { return daySegmentContainer };
|
||||
t.getSlotSegmentContainer = function() { return slotSegmentContainer };
|
||||
t.getSlotContainer = function() { return slotContainer };
|
||||
t.getRowCnt = function() { return 1 };
|
||||
t.getColCnt = function() { return colCnt };
|
||||
t.getColWidth = function() { return colWidth };
|
||||
t.getSnapHeight = function() { return snapHeight };
|
||||
t.getSnapDuration = function() { return snapDuration };
|
||||
t.getSlotHeight = function() { return slotHeight };
|
||||
t.getSlotDuration = function() { return slotDuration };
|
||||
t.getMinTime = function() { return minTime };
|
||||
t.getMaxTime = function() { return maxTime };
|
||||
t.getDaySegmentContainer = function() { return daySegmentContainer; };
|
||||
t.getSlotSegmentContainer = function() { return slotSegmentContainer; };
|
||||
t.getSlotContainer = function() { return slotContainer; };
|
||||
t.getRowCnt = function() { return 1; };
|
||||
t.getColCnt = function() { return colCnt; };
|
||||
t.getColWidth = function() { return colWidth; };
|
||||
t.getSnapHeight = function() { return snapHeight; };
|
||||
t.getSnapDuration = function() { return snapDuration; };
|
||||
t.getSlotHeight = function() { return slotHeight; };
|
||||
t.getSlotDuration = function() { return slotDuration; };
|
||||
t.getMinTime = function() { return minTime; };
|
||||
t.getMaxTime = function() { return maxTime; };
|
||||
t.defaultSelectionEnd = defaultSelectionEnd;
|
||||
t.renderDayOverlay = renderDayOverlay;
|
||||
t.renderSelection = renderSelection;
|
||||
@@ -94,7 +94,6 @@ function AgendaView(element, calendar, viewName) {
|
||||
var cellToDate = t.cellToDate;
|
||||
var dateToCell = t.dateToCell;
|
||||
var rangeToSegments = t.rangeToSegments;
|
||||
var calendar = t.calendar;
|
||||
var formatDate = calendar.formatDate;
|
||||
var calculateWeekNumber = calendar.calculateWeekNumber;
|
||||
|
||||
@@ -172,7 +171,7 @@ function AgendaView(element, calendar, viewName) {
|
||||
function updateOptions() {
|
||||
|
||||
tm = opt('theme') ? 'ui' : 'fc';
|
||||
rtl = opt('isRTL')
|
||||
rtl = opt('isRTL');
|
||||
colFormat = opt('columnFormat');
|
||||
|
||||
minTime = moment.duration(opt('minTime'));
|
||||
@@ -196,7 +195,7 @@ function AgendaView(element, calendar, viewName) {
|
||||
var slotTime;
|
||||
var slotDate;
|
||||
var minutes;
|
||||
var slotNormal = slotDuration.asMinutes() % 15 == 0;
|
||||
var slotNormal = slotDuration.asMinutes() % 15 === 0;
|
||||
|
||||
buildDayTable();
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ function BasicView(element, calendar, viewName) {
|
||||
t.reportDayClick = reportDayClick; // for selection (kinda hacky)
|
||||
t.dragStart = dragStart;
|
||||
t.dragStop = dragStop;
|
||||
t.getHoverListener = function() { return hoverListener };
|
||||
t.getHoverListener = function() { return hoverListener; };
|
||||
t.colLeft = colLeft;
|
||||
t.colRight = colRight;
|
||||
t.colContentLeft = colContentLeft;
|
||||
t.colContentRight = colContentRight;
|
||||
t.getIsCellAllDay = function() { return true };
|
||||
t.getIsCellAllDay = function() { return true; };
|
||||
t.allDayRow = allDayRow;
|
||||
t.getRowCnt = function() { return rowCnt };
|
||||
t.getColCnt = function() { return colCnt };
|
||||
t.getColWidth = function() { return colWidth };
|
||||
t.getDaySegmentContainer = function() { return daySegmentContainer };
|
||||
t.getRowCnt = function() { return rowCnt; };
|
||||
t.getColCnt = function() { return colCnt; };
|
||||
t.getColWidth = function() { return colWidth; };
|
||||
t.getDaySegmentContainer = function() { return daySegmentContainer; };
|
||||
|
||||
|
||||
// imports
|
||||
@@ -45,7 +45,6 @@ function BasicView(element, calendar, viewName) {
|
||||
var cellToDate = t.cellToDate;
|
||||
var dateToCell = t.dateToCell;
|
||||
var rangeToSegments = t.rangeToSegments;
|
||||
var calendar = t.calendar;
|
||||
var formatDate = calendar.formatDate;
|
||||
var calculateWeekNumber = calendar.calculateWeekNumber;
|
||||
|
||||
|
||||
@@ -22,13 +22,11 @@ function DayEventRenderer() {
|
||||
var eventResize = t.eventResize;
|
||||
var getRowCnt = t.getRowCnt;
|
||||
var getColCnt = t.getColCnt;
|
||||
var getColWidth = t.getColWidth;
|
||||
var allDayRow = t.allDayRow; // TODO: rename
|
||||
var colLeft = t.colLeft;
|
||||
var colRight = t.colRight;
|
||||
var colContentLeft = t.colContentLeft;
|
||||
var colContentRight = t.colContentRight;
|
||||
var dateToCell = t.dateToCell;
|
||||
var getDaySegmentContainer = t.getDaySegmentContainer;
|
||||
var renderDayOverlay = t.renderDayOverlay;
|
||||
var clearOverlays = t.clearOverlays;
|
||||
@@ -351,17 +349,18 @@ function DayEventRenderer() {
|
||||
var rowContentHeights = calculateVerticals(segments); // also sets segment.top
|
||||
var rowContentElements = getRowContentElements(); // returns 1 inner div per row
|
||||
var rowContentTops = [];
|
||||
var i;
|
||||
|
||||
// Set each row's height by setting height of first inner div
|
||||
if (doRowHeights) {
|
||||
for (var i=0; i<rowContentElements.length; i++) {
|
||||
for (i=0; i<rowContentElements.length; i++) {
|
||||
rowContentElements[i].height(rowContentHeights[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Get each row's top, relative to the views's origin.
|
||||
// Important to do this after setting each row's height.
|
||||
for (var i=0; i<rowContentElements.length; i++) {
|
||||
for (i=0; i<rowContentElements.length; i++) {
|
||||
rowContentTops.push(
|
||||
rowContentElements[i].position().top
|
||||
);
|
||||
@@ -387,6 +386,7 @@ function DayEventRenderer() {
|
||||
var colCnt = getColCnt();
|
||||
var rowContentHeights = []; // content height for each row
|
||||
var segmentRows = buildSegmentRows(segments); // an array of segment arrays, one for each row
|
||||
var colI;
|
||||
|
||||
for (var rowI=0; rowI<rowCnt; rowI++) {
|
||||
var segmentRow = segmentRows[rowI];
|
||||
@@ -394,7 +394,7 @@ function DayEventRenderer() {
|
||||
// an array of running total heights for each column.
|
||||
// initialize with all zeros.
|
||||
var colHeights = [];
|
||||
for (var colI=0; colI<colCnt; colI++) {
|
||||
for (colI=0; colI<colCnt; colI++) {
|
||||
colHeights.push(0);
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ function DayEventRenderer() {
|
||||
);
|
||||
|
||||
// adjust the columns to account for the segment's height
|
||||
for (var colI=segment.leftCol; colI<=segment.rightCol; colI++) {
|
||||
for (colI=segment.leftCol; colI<=segment.rightCol; colI++) {
|
||||
colHeights[colI] = segment.top + segment.outerHeight;
|
||||
}
|
||||
}
|
||||
@@ -643,8 +643,6 @@ function DayEventRenderer() {
|
||||
}
|
||||
isResizing = true;
|
||||
var hoverListener = getHoverListener();
|
||||
var rowCnt = getRowCnt();
|
||||
var colCnt = getColCnt();
|
||||
var elementTop = element.css('top');
|
||||
var dayDelta;
|
||||
var eventEnd;
|
||||
@@ -763,6 +761,6 @@ function compareDaySegments(a, b) {
|
||||
return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first
|
||||
b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)
|
||||
a.event.start - b.event.start || // if a tie, sort by event start date
|
||||
(a.event.title || '').localeCompare(b.event.title) // if a tie, sort by event title
|
||||
(a.event.title || '').localeCompare(b.event.title); // if a tie, sort by event title
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ function HorizontalPositionCache(getElement) {
|
||||
rights = {};
|
||||
|
||||
function e(i) {
|
||||
return elements[i] = elements[i] || getElement(i);
|
||||
return (elements[i] = (elements[i] || getElement(i)));
|
||||
}
|
||||
|
||||
t.left = function(i) {
|
||||
return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i];
|
||||
return (lefts[i] = (lefts[i] === undefined ? e(i).position().left : lefts[i]));
|
||||
};
|
||||
|
||||
t.right = function(i) {
|
||||
return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i];
|
||||
return (rights[i] = (rights[i] === undefined ? t.left(i) + e(i).width() : rights[i]));
|
||||
};
|
||||
|
||||
t.clear = function() {
|
||||
|
||||
@@ -22,7 +22,10 @@ function HoverListener(coordinateGrid) {
|
||||
function mouse(ev) {
|
||||
_fixUIEvent(ev); // see below
|
||||
var newCell = coordinateGrid.cell(ev.pageX, ev.pageY);
|
||||
if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) {
|
||||
if (
|
||||
Boolean(newCell) !== Boolean(cell) ||
|
||||
newCell && (newCell.row != cell.row || newCell.col != cell.col)
|
||||
) {
|
||||
if (newCell) {
|
||||
if (!firstCell) {
|
||||
firstCell = newCell;
|
||||
|
||||
@@ -28,7 +28,7 @@ function OverlayManager() {
|
||||
|
||||
function clearOverlays() {
|
||||
var e;
|
||||
while (e = usedOverlays.shift()) {
|
||||
while ((e = usedOverlays.shift())) {
|
||||
unusedOverlays.push(e.hide().unbind());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ function SelectionManager() {
|
||||
|
||||
if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button
|
||||
unselect(ev);
|
||||
var _mousedownElement = this;
|
||||
var dates;
|
||||
hoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell
|
||||
clearSelection();
|
||||
|
||||
+8
-9
@@ -28,7 +28,6 @@ function View(element, calendar, viewName) {
|
||||
|
||||
// imports
|
||||
var reportEventChange = calendar.reportEventChange;
|
||||
var getEventEnd = calendar.getEventEnd;
|
||||
|
||||
|
||||
// locals
|
||||
@@ -529,11 +528,11 @@ function View(element, calendar, viewName) {
|
||||
function cellOffsetToDayOffset(cellOffset) {
|
||||
var day0 = t.start.day(); // first date's day of week
|
||||
cellOffset += dayToCellMap[day0]; // normlize cellOffset to beginning-of-week
|
||||
return Math.floor(cellOffset / cellsPerWeek) * 7 // # of days from full weeks
|
||||
+ cellToDayMap[ // # of days from partial last week
|
||||
return Math.floor(cellOffset / cellsPerWeek) * 7 + // # of days from full weeks
|
||||
cellToDayMap[ // # of days from partial last week
|
||||
(cellOffset % cellsPerWeek + cellsPerWeek) % cellsPerWeek // crazy math to handle negative cellOffsets
|
||||
]
|
||||
- day0; // adjustment for beginning-of-week normalization
|
||||
] -
|
||||
day0; // adjustment for beginning-of-week normalization
|
||||
}
|
||||
|
||||
// day offset -> date
|
||||
@@ -563,11 +562,11 @@ function View(element, calendar, viewName) {
|
||||
function dayOffsetToCellOffset(dayOffset) {
|
||||
var day0 = t.start.day(); // first date's day of week
|
||||
dayOffset += day0; // normalize dayOffset to beginning-of-week
|
||||
return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks
|
||||
+ dayToCellMap[ // # of cells from partial last week
|
||||
return Math.floor(dayOffset / 7) * cellsPerWeek + // # of cells from full weeks
|
||||
dayToCellMap[ // # of cells from partial last week
|
||||
(dayOffset % 7 + 7) % 7 // crazy math to handle negative dayOffsets
|
||||
]
|
||||
- dayToCellMap[day0]; // adjustment for beginning-of-week normalization
|
||||
] -
|
||||
dayToCellMap[day0]; // adjustment for beginning-of-week normalization
|
||||
}
|
||||
|
||||
// cell offset -> cell (object with row & col keys)
|
||||
|
||||
+11
-10
@@ -216,7 +216,7 @@ moment.fn.format = function() {
|
||||
else {
|
||||
return momentFormatMethod.apply(this, arguments); // pass along all arguments
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
moment.fn.toISOString = function() {
|
||||
if (this._ambigTime) {
|
||||
@@ -254,24 +254,25 @@ $.each([
|
||||
|
||||
moment.fn[methodName] = function() {
|
||||
var newThis;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var i;
|
||||
|
||||
if (this._ambigZone) {
|
||||
for (i=0; i<momentCount; i++) {
|
||||
if (typeof arguments[i] === 'string') {
|
||||
arguments[i] = fc.moment.parseZone(arguments[i]);
|
||||
if (typeof args[i] === 'string') {
|
||||
args[i] = fc.moment.parseZone(args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<momentCount; i++) {
|
||||
if (moment.isMoment(arguments[i]) && arguments[i]._ambigZone !== this._ambigZone) {
|
||||
if (moment.isMoment(args[i]) && args[i]._ambigZone !== this._ambigZone) {
|
||||
newThis = newThis || this.clone().stripZone();
|
||||
arguments[i] = arguments[i].clone().stripZone();
|
||||
args[i] = args[i].clone().stripZone();
|
||||
}
|
||||
}
|
||||
|
||||
return origMethod.apply(newThis || this, arguments);
|
||||
return origMethod.apply(newThis || this, args);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -317,7 +318,7 @@ function formatDateWithChunk(date, chunk) {
|
||||
if (typeof chunk === 'string') { // a literal string
|
||||
return chunk;
|
||||
}
|
||||
else if (token = chunk.token) { // a token, like "YYYY"
|
||||
else if ((token = chunk.token)) { // a token, like "YYYY"
|
||||
if (tokenOverrides[token]) {
|
||||
return tokenOverrides[token](date); // use our custom token
|
||||
}
|
||||
@@ -431,7 +432,7 @@ function formatSimilarChunk(date1, date2, chunk) {
|
||||
if (typeof chunk === 'string') { // a literal string
|
||||
return chunk;
|
||||
}
|
||||
else if (token = chunk.token) {
|
||||
else if ((token = chunk.token)) {
|
||||
unit = similarUnitMap[token.charAt(0)];
|
||||
// are the dates the same for this unit of measurement?
|
||||
if (unit && date1.isSame(date2, unit)) {
|
||||
@@ -456,7 +457,7 @@ function getFormatStringChunks(formatStr) {
|
||||
if (formatStr in formatStringChunkCache) {
|
||||
return formatStringChunkCache[formatStr];
|
||||
}
|
||||
return formatStringChunkCache[formatStr] = chunkFormatString(formatStr);
|
||||
return (formatStringChunkCache[formatStr] = chunkFormatString(formatStr));
|
||||
}
|
||||
|
||||
|
||||
@@ -466,7 +467,7 @@ function chunkFormatString(formatStr) {
|
||||
var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|((\w)\4*o?T?)|([^\w\[\(]+)/g; // TODO: more descrimination
|
||||
var match;
|
||||
|
||||
while (match = chunker.exec(formatStr)) {
|
||||
while ((match = chunker.exec(formatStr))) {
|
||||
if (match[1]) { // a literal string instead [ ... ]
|
||||
chunks.push(match[1]);
|
||||
}
|
||||
|
||||
+6
-6
@@ -68,13 +68,13 @@ function transformOptions(sourceOptions, start, end, timezone) {
|
||||
});
|
||||
|
||||
events.push({
|
||||
id: entry['gCal$uid']['value'],
|
||||
title: entry['title']['$t'],
|
||||
start: entry['gd$when'][0]['startTime'],
|
||||
end: entry['gd$when'][0]['endTime'],
|
||||
id: entry.gCal$uid.value,
|
||||
title: entry.title.$t,
|
||||
start: entry.gd$when[0].startTime,
|
||||
end: entry.gd$when[0].endTime,
|
||||
url: url,
|
||||
location: entry['gd$where'][0]['valueString'],
|
||||
description: entry['content']['$t']
|
||||
location: entry.gd$where[0].valueString,
|
||||
description: entry.content.$t
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ fc.datepickerLang = function(langCode, datepickerLangCode, options) {
|
||||
options;
|
||||
|
||||
// Alias 'en' to the default language data. Do this every time.
|
||||
$.datepicker.regional['en'] = $.datepicker.regional[''];
|
||||
$.datepicker.regional.en = $.datepicker.regional[''];
|
||||
|
||||
// Set as Datepicker's global defaults.
|
||||
$.datepicker.setDefaults(options);
|
||||
|
||||
+14
-10
@@ -49,17 +49,21 @@ function setDefaults(d) {
|
||||
// mergeOptions(target, obj1, obj2, ...)
|
||||
//
|
||||
function mergeOptions(target) {
|
||||
for (var i=1; i<arguments.length; i++) {
|
||||
$.each(arguments[i], function(name, value) {
|
||||
if ($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {
|
||||
// merge into a new object to avoid destruction
|
||||
target[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence
|
||||
}
|
||||
else if (value !== undefined) { // only use values that are set and not undefined
|
||||
target[name] = value;
|
||||
}
|
||||
});
|
||||
|
||||
function mergeIntoTarget(name, value) {
|
||||
if ($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {
|
||||
// merge into a new object to avoid destruction
|
||||
target[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence
|
||||
}
|
||||
else if (value !== undefined) { // only use values that are set and not undefined
|
||||
target[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=1; i<arguments.length; i++) {
|
||||
$.each(arguments[i], mergeIntoTarget);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('aspectRatio', function() {
|
||||
|
||||
describe('when default settings are used', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(675)
|
||||
$('#cal').width(675);
|
||||
$('#cal').fullCalendar();
|
||||
});
|
||||
it('fc-content should use the ratio 1:35 to set height', function() {
|
||||
@@ -24,7 +24,7 @@ describe('aspectRatio', function() {
|
||||
|
||||
describe('to 2', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: 2
|
||||
});
|
||||
@@ -43,7 +43,7 @@ describe('aspectRatio', function() {
|
||||
|
||||
describe('to 1', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: 1
|
||||
});
|
||||
@@ -56,13 +56,13 @@ describe('aspectRatio', function() {
|
||||
var width = $('.fc-content').width();
|
||||
var height = $('.fc-content').height();
|
||||
var ratio = Math.round(width / height * 100);
|
||||
expect(ratio).toEqual(100)
|
||||
expect(ratio).toEqual(100);
|
||||
});
|
||||
});
|
||||
|
||||
describe('to less than 0.5', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: 0.4
|
||||
});
|
||||
@@ -81,7 +81,7 @@ describe('aspectRatio', function() {
|
||||
|
||||
describe('to negative', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: -2
|
||||
});
|
||||
@@ -94,13 +94,13 @@ describe('aspectRatio', function() {
|
||||
var width = $('.fc-content').width();
|
||||
var height = $('.fc-content').height();
|
||||
var ratio = Math.round(width / height * 100);
|
||||
expect(ratio).toEqual(50)
|
||||
expect(ratio).toEqual(50);
|
||||
});
|
||||
});
|
||||
|
||||
describe('to zero', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: 0
|
||||
});
|
||||
@@ -119,7 +119,7 @@ describe('aspectRatio', function() {
|
||||
|
||||
describe('to very large', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').width(1000)
|
||||
$('#cal').width(1000);
|
||||
$('#cal').fullCalendar({
|
||||
aspectRatio: 4000
|
||||
});
|
||||
@@ -132,7 +132,7 @@ describe('aspectRatio', function() {
|
||||
var actualHeight = $('.fc-content').height();
|
||||
$('tr.fc-week td:first-child > div').css('min-height', '').css('background', 'red');
|
||||
var naturalHeight = $('.fc-content').height();
|
||||
expect(actualHeight).toEqual(naturalHeight)
|
||||
expect(actualHeight).toEqual(naturalHeight);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('header testing', function() {
|
||||
header: false
|
||||
};
|
||||
$('#calendar').fullCalendar(options);
|
||||
})
|
||||
});
|
||||
it('should not have header table', function() {
|
||||
var headerTableCount = $('table.fc-header').length;
|
||||
expect(headerTableCount).toEqual(0);
|
||||
|
||||
@@ -4,7 +4,7 @@ describe('when weekends option is set', function() {
|
||||
beforeEach(function() {
|
||||
affix('#calendar');
|
||||
var cal = $('#calendar');
|
||||
})
|
||||
});
|
||||
|
||||
it('should show sat and sun if true', function() {
|
||||
var options = {
|
||||
|
||||
Reference in New Issue
Block a user