diff --git a/src/agenda/AgendaEventRenderer.js b/src/agenda/AgendaEventRenderer.js deleted file mode 100644 index 428156c..0000000 --- a/src/agenda/AgendaEventRenderer.js +++ /dev/null @@ -1,942 +0,0 @@ - -function AgendaEventRenderer() { - var t = this; - - - // exports - t.renderEvents = renderEvents; - t.clearEvents = clearEvents; - t.slotSegHtml = slotSegHtml; - - - // imports - DayEventRenderer.call(t); - var opt = t.opt; - var trigger = t.trigger; - var isEventDraggable = t.isEventDraggable; - var isEventResizable = t.isEventResizable; - var eventElementHandlers = t.eventElementHandlers; - var setHeight = t.setHeight; - var getDaySegmentContainer = t.getDaySegmentContainer; - var getSlotSegmentContainer = t.getSlotSegmentContainer; - var getHoverListener = t.getHoverListener; - var computeDateTop = t.computeDateTop; - var getIsCellAllDay = t.getIsCellAllDay; - var colContentLeft = t.colContentLeft; - var colContentRight = t.colContentRight; - var cellToDate = t.cellToDate; - var getColCnt = t.getColCnt; - var getColWidth = t.getColWidth; - var getSnapHeight = t.getSnapHeight; - var getSnapDuration = t.getSnapDuration; - var getSlotHeight = t.getSlotHeight; - var getSlotDuration = t.getSlotDuration; - var getSlotContainer = t.getSlotContainer; - var reportEventElement = t.reportEventElement; - var showEvents = t.showEvents; - var hideEvents = t.hideEvents; - var eventDrop = t.eventDrop; - var eventResize = t.eventResize; - var renderDayOverlay = t.renderDayOverlay; - var clearOverlays = t.clearOverlays; - var renderDayEvents = t.renderDayEvents; - var getMinTime = t.getMinTime; - var getMaxTime = t.getMaxTime; - var calendar = t.calendar; - var formatDate = calendar.formatDate; - var getEventEnd = calendar.getEventEnd; - - - // overrides - t.draggableDayEvent = draggableDayEvent; - - - - /* Rendering - ----------------------------------------------------------------------------*/ - - - function renderEvents(events, modifiedEventId) { - var i, len=events.length, - dayEvents=[], - slotEvents=[]; - for (i=0; i rangeStart && eventStart < rangeEnd) { - - if (eventStart < rangeStart) { - segStart = rangeStart.clone(); - isStart = false; - } - else { - segStart = eventStart; - isStart = true; - } - - if (eventEnd > rangeEnd) { - segEnd = rangeEnd.clone(); - isEnd = false; - } - else { - segEnd = eventEnd; - isEnd = true; - } - - segs.push({ - event: event, - start: segStart, - end: segEnd, - isStart: isStart, - isEnd: isEnd - }); - } - } - - return segs.sort(compareSlotSegs); - } - - - // renders events in the 'time slots' at the bottom - // TODO: when we refactor this, when user returns `false` eventRender, don't have empty space - // TODO: refactor will include using pixels to detect collisions instead of dates (handy for seg cmp) - - function renderSlotSegs(segs, modifiedEventId) { - - var i, segCnt=segs.length, seg, - event, - top, - bottom, - columnLeft, - columnRight, - columnWidth, - width, - left, - right, - html = '', - eventElements, - eventElement, - triggerRes, - titleElement, - height, - slotSegmentContainer = getSlotSegmentContainer(), - isRTL = opt('isRTL'); - - // calculate position/dimensions, create html - for (i=0; i" + - "
" + - "
" + - htmlEscape(t.getEventTimeText(event)) + - "
" + - "
" + - htmlEscape(event.title || '') + - "
" + - "
" + - "
"; - - if (seg.isEnd && isEventResizable(event)) { - html += - "
=
"; - } - html += - ""; - return html; - } - - - function bindSlotSeg(event, eventElement, seg) { - var timeElement = eventElement.find('div.fc-event-time'); - if (isEventDraggable(event)) { - draggableSlotEvent(event, eventElement, timeElement); - } - if (seg.isEnd && isEventResizable(event)) { - resizableSlotEvent(event, eventElement, timeElement); - } - eventElementHandlers(event, eventElement); - } - - - - /* Dragging - -----------------------------------------------------------------------------------*/ - - - // when event starts out FULL-DAY - // overrides DayEventRenderer's version because it needs to account for dragging elements - // to and from the slot area. - - function draggableDayEvent(event, eventElement, seg) { - var isStart = seg.isStart; - var origWidth; - var revert; - var allDay = true; - var dayDelta; - - var hoverListener = getHoverListener(); - var colWidth = getColWidth(); - var minTime = getMinTime(); - var slotDuration = getSlotDuration(); - var slotHeight = getSlotHeight(); - var snapDuration = getSnapDuration(); - var snapHeight = getSnapHeight(); - - eventElement.draggable({ - opacity: opt('dragOpacity', 'month'), // use whatever the month view was using - revertDuration: opt('dragRevertDuration'), - start: function(ev, ui) { - - trigger('eventDragStart', eventElement[0], event, ev, ui); - hideEvents(event, eventElement); - origWidth = eventElement.width(); - - hoverListener.start(function(cell, origCell) { - clearOverlays(); - if (cell) { - revert = false; - - var origDate = cellToDate(0, origCell.col); - var date = cellToDate(0, cell.col); - dayDelta = date.diff(origDate, 'days'); - - if (!cell.row) { // on full-days - - renderDayOverlay( - event.start.clone().add(dayDelta, 'days'), - getEventEnd(event).add(dayDelta, 'days') - ); - - resetElement(); - } - else { // mouse is over bottom slots - - if (isStart) { - if (allDay) { - // convert event to temporary slot-event - eventElement.width(colWidth - 10); // don't use entire width - setOuterHeight(eventElement, calendar.defaultTimedEventDuration / slotDuration * slotHeight); // the default height - eventElement.draggable('option', 'grid', [ colWidth, 1 ]); - allDay = false; - } - } - else { - revert = true; - } - } - - revert = revert || (allDay && !dayDelta); - } - else { - resetElement(); - revert = true; - } - - eventElement.draggable('option', 'revert', revert); - - }, ev, 'drag'); - }, - stop: function(ev, ui) { - hoverListener.stop(); - clearOverlays(); - trigger('eventDragStop', eventElement[0], event, ev, ui); - - if (revert) { // hasn't moved or is out of bounds (draggable has already reverted) - - resetElement(); - eventElement.css('filter', ''); // clear IE opacity side-effects - showEvents(event, eventElement); - } - else { // changed! - - var eventStart = event.start.clone().add(dayDelta, 'days'); // already assumed to have a stripped time - var snapTime; - var snapIndex; - if (!allDay) { - snapIndex = Math.round((eventElement.offset().top - getSlotContainer().offset().top) / snapHeight); // why not use ui.offset.top? - snapTime = moment.duration(minTime + snapIndex * snapDuration); - eventStart = calendar.rezoneDate(eventStart.clone().time(snapTime)); - } - - eventDrop( - eventElement[0], - event, - eventStart, - ev, - ui - ); - } - } - }); - function resetElement() { - if (!allDay) { - eventElement - .width(origWidth) - .height('') - .draggable('option', 'grid', null); - allDay = true; - } - } - } - - - // when event starts out IN TIMESLOTS - - function draggableSlotEvent(event, eventElement, timeElement) { - var coordinateGrid = t.getCoordinateGrid(); - var colCnt = getColCnt(); - var colWidth = getColWidth(); - var snapHeight = getSnapHeight(); - var snapDuration = getSnapDuration(); - - // states - var origPosition; // original position of the element, not the mouse - var origCell; - var isInBounds, prevIsInBounds; - var isAllDay, prevIsAllDay; - var colDelta, prevColDelta; - var dayDelta; // derived from colDelta - var snapDelta, prevSnapDelta; // the number of snaps away from the original position - - // newly computed - var eventStart, eventEnd; - - eventElement.draggable({ - scroll: false, - grid: [ colWidth, snapHeight ], - axis: colCnt==1 ? 'y' : false, - opacity: opt('dragOpacity'), - revertDuration: opt('dragRevertDuration'), - start: function(ev, ui) { - - trigger('eventDragStart', eventElement[0], event, ev, ui); - hideEvents(event, eventElement); - - coordinateGrid.build(); - - // initialize states - origPosition = eventElement.position(); - origCell = coordinateGrid.cell(ev.pageX, ev.pageY); - isInBounds = prevIsInBounds = true; - isAllDay = prevIsAllDay = getIsCellAllDay(origCell); - colDelta = prevColDelta = 0; - dayDelta = 0; - snapDelta = prevSnapDelta = 0; - - eventStart = null; - eventEnd = null; - }, - drag: function(ev, ui) { - - // NOTE: this `cell` value is only useful for determining in-bounds and all-day. - // Bad for anything else due to the discrepancy between the mouse position and the - // element position while snapping. (problem revealed in PR #55) - // - // PS- the problem exists for draggableDayEvent() when dragging an all-day event to a slot event. - // We should overhaul the dragging system and stop relying on jQuery UI. - var cell = coordinateGrid.cell(ev.pageX, ev.pageY); - - // update states - isInBounds = !!cell; - if (isInBounds) { - isAllDay = getIsCellAllDay(cell); - - // calculate column delta - colDelta = Math.round((ui.position.left - origPosition.left) / colWidth); - if (colDelta != prevColDelta) { - // calculate the day delta based off of the original clicked column and the column delta - var origDate = cellToDate(0, origCell.col); - var col = origCell.col + colDelta; - col = Math.max(0, col); - col = Math.min(colCnt-1, col); - var date = cellToDate(0, col); - dayDelta = date.diff(origDate, 'days'); - } - - // calculate minute delta (only if over slots) - if (!isAllDay) { - snapDelta = Math.round((ui.position.top - origPosition.top) / snapHeight); - } - } - - // any state changes? - if ( - isInBounds != prevIsInBounds || - isAllDay != prevIsAllDay || - colDelta != prevColDelta || - snapDelta != prevSnapDelta - ) { - - // compute new dates - if (isAllDay) { - eventStart = event.start.clone().stripTime().add(dayDelta, 'days'); - eventEnd = eventStart.clone().add(calendar.defaultAllDayEventDuration); - } - else { - eventStart = event.start.clone().add(snapDelta * snapDuration).add(dayDelta, 'days'); - eventEnd = getEventEnd(event).add(snapDelta * snapDuration).add(dayDelta, 'days'); - } - - updateUI(); - - // update previous states for next time - prevIsInBounds = isInBounds; - prevIsAllDay = isAllDay; - prevColDelta = colDelta; - prevSnapDelta = snapDelta; - } - - // if out-of-bounds, revert when done, and vice versa. - eventElement.draggable('option', 'revert', !isInBounds); - - }, - stop: function(ev, ui) { - - clearOverlays(); - trigger('eventDragStop', eventElement[0], event, ev, ui); - - if (isInBounds && (isAllDay || dayDelta || snapDelta)) { // changed! - eventDrop( - eventElement[0], - event, - eventStart, - ev, - ui - ); - } - else { // either no change or out-of-bounds (draggable has already reverted) - - // reset states for next time, and for updateUI() - isInBounds = true; - isAllDay = false; - colDelta = 0; - dayDelta = 0; - snapDelta = 0; - - updateUI(); - eventElement.css('filter', ''); // clear IE opacity side-effects - - // sometimes fast drags make event revert to wrong position, so reset. - // also, if we dragged the element out of the area because of snapping, - // but the *mouse* is still in bounds, we need to reset the position. - eventElement.css(origPosition); - - showEvents(event, eventElement); - } - } - }); - - function updateUI() { - clearOverlays(); - if (isInBounds) { - if (isAllDay) { - timeElement.hide(); - eventElement.draggable('option', 'grid', null); // disable grid snapping - renderDayOverlay(eventStart, eventEnd); - } - else { - updateTimeText(); - timeElement.css('display', ''); // show() was causing display=inline - eventElement.draggable('option', 'grid', [colWidth, snapHeight]); // re-enable grid snapping - } - } - } - - function updateTimeText() { - if (eventStart) { // must of had a state change - timeElement.text( - t.getEventTimeText(eventStart, event.end ? eventEnd : null) - // ^ - // only display the new end if there was an old end - ); - } - } - - } - - - - /* Resizing - --------------------------------------------------------------------------------------*/ - - - function resizableSlotEvent(event, eventElement, timeElement) { - var snapDelta, prevSnapDelta; - var snapHeight = getSnapHeight(); - var snapDuration = getSnapDuration(); - var eventEnd; - - eventElement.resizable({ - handles: { - s: '.ui-resizable-handle' - }, - grid: snapHeight, - start: function(ev, ui) { - snapDelta = prevSnapDelta = 0; - hideEvents(event, eventElement); - trigger('eventResizeStart', eventElement[0], event, ev, ui); - }, - resize: function(ev, ui) { - // don't rely on ui.size.height, doesn't take grid into account - snapDelta = Math.round((Math.max(snapHeight, eventElement.height()) - ui.originalSize.height) / snapHeight); - if (snapDelta != prevSnapDelta) { - eventEnd = getEventEnd(event).add(snapDuration * snapDelta); - var text; - if (snapDelta) { // has there been a change? - text = t.getEventTimeText(event.start, eventEnd); - } - else { - text = t.getEventTimeText(event); // the original time text - } - timeElement.text(text); - prevSnapDelta = snapDelta; - } - }, - stop: function(ev, ui) { - trigger('eventResizeStop', eventElement[0], event, ev, ui); - if (snapDelta) { - eventResize( - eventElement[0], - event, - eventEnd, - ev, - ui - ); - } - else { - showEvents(event, eventElement); - // BUG: if event was really short, need to put title back in span - } - } - }); - } - - -} - - - -/* Agenda Event Segment Utilities ------------------------------------------------------------------------------*/ - - -// Sets the seg.backwardCoord and seg.forwardCoord on each segment and returns a new -// list in the order they should be placed into the DOM (an implicit z-index). -function placeSlotSegs(segs) { - var levels = buildSlotSegLevels(segs); - var level0 = levels[0]; - var i; - - computeForwardSlotSegs(levels); - - if (level0) { - - for (i=0; i seg2.start && seg1.start < seg2.end; -} - - -// A cmp function for determining which forward segment to rely on more when computing coordinates. -function compareForwardSlotSegs(seg1, seg2) { - // put higher-pressure first - return seg2.forwardPressure - seg1.forwardPressure || - // put segments that are closer to initial edge first (and favor ones with no coords yet) - (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) || - // do normal sorting... - compareSlotSegs(seg1, seg2); -} - - -// A cmp function for determining which segment should be closer to the initial edge -// (the left edge on a left-to-right calendar). -function compareSlotSegs(seg1, seg2) { - return seg1.start - seg2.start || // earlier start time goes first - (seg2.end - seg2.start) - (seg1.end - seg1.start) || // tie? longer-duration goes first - (seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title -} - diff --git a/src/basic/BasicEventRenderer.js b/src/basic/BasicEventRenderer.js deleted file mode 100644 index 5fc5ec8..0000000 --- a/src/basic/BasicEventRenderer.js +++ /dev/null @@ -1,27 +0,0 @@ - -function BasicEventRenderer() { - var t = this; - - - // exports - t.renderEvents = renderEvents; - t.clearEvents = clearEvents; - - - // imports - DayEventRenderer.call(t); - - - function renderEvents(events, modifiedEventId) { - t.renderDayEvents(events, modifiedEventId); - } - - - function clearEvents() { - t.getDaySegmentContainer().empty(); - } - - - // TODO: have this class (and AgendaEventRenderer) be responsible for creating the event container div - -} diff --git a/src/common/CoordinateGrid.js b/src/common/CoordinateGrid.js deleted file mode 100644 index e200873..0000000 --- a/src/common/CoordinateGrid.js +++ /dev/null @@ -1,46 +0,0 @@ - -function CoordinateGrid(buildFunc) { - - var t = this; - var rows; - var cols; - - - t.build = function() { - rows = []; - cols = []; - buildFunc(rows, cols); - }; - - - t.cell = function(x, y) { - var rowCnt = rows.length; - var colCnt = cols.length; - var i, r=-1, c=-1; - for (i=0; i= rows[i][0] && y < rows[i][1]) { - r = i; - break; - } - } - for (i=0; i= cols[i][0] && x < cols[i][1]) { - c = i; - break; - } - } - return (r>=0 && c>=0) ? { row: r, col: c } : null; - }; - - - t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive - var origin = originElement.offset(); - return { - top: rows[row0][0] - origin.top, - left: cols[col0][0] - origin.left, - width: cols[col1][1] - cols[col0][0], - height: rows[row1][1] - rows[row0][0] - }; - }; - -} diff --git a/src/common/DayEventRenderer.js b/src/common/DayEventRenderer.js deleted file mode 100644 index a32488c..0000000 --- a/src/common/DayEventRenderer.js +++ /dev/null @@ -1,798 +0,0 @@ - -function DayEventRenderer() { - var t = this; - - - // exports - t.renderDayEvents = renderDayEvents; - t.draggableDayEvent = draggableDayEvent; // made public so that subclasses can override - t.resizableDayEvent = resizableDayEvent; // " - - - // imports - var opt = t.opt; - var trigger = t.trigger; - var isEventDraggable = t.isEventDraggable; - var isEventResizable = t.isEventResizable; - var reportEventElement = t.reportEventElement; - var eventElementHandlers = t.eventElementHandlers; - var showEvents = t.showEvents; - var hideEvents = t.hideEvents; - var eventDrop = t.eventDrop; - var eventResize = t.eventResize; - var getRowCnt = t.getRowCnt; - var getColCnt = t.getColCnt; - var allDayRow = t.allDayRow; // TODO: rename - var colLeft = t.colLeft; - var colRight = t.colRight; - var colContentLeft = t.colContentLeft; - var colContentRight = t.colContentRight; - var getDaySegmentContainer = t.getDaySegmentContainer; - var renderDayOverlay = t.renderDayOverlay; - var clearOverlays = t.clearOverlays; - var clearSelection = t.clearSelection; - var getHoverListener = t.getHoverListener; - var rangeToSegments = t.rangeToSegments; - var cellToDate = t.cellToDate; - var cellToCellOffset = t.cellToCellOffset; - var cellOffsetToDayOffset = t.cellOffsetToDayOffset; - var dateToDayOffset = t.dateToDayOffset; - var dayOffsetToCellOffset = t.dayOffsetToCellOffset; - var calendar = t.calendar; - var getEventEnd = calendar.getEventEnd; - - - // Render `events` onto the calendar, attach mouse event handlers, and call the `eventAfterRender` callback for each. - // Mouse event will be lazily applied, except if the event has an ID of `modifiedEventId`. - // Can only be called when the event container is empty (because it wipes out all innerHTML). - function renderDayEvents(events, modifiedEventId) { - - // do the actual rendering. Receive the intermediate "segment" data structures. - var segments = _renderDayEvents( - events, - false, // don't append event elements - true // set the heights of the rows - ); - - // report the elements to the View, for general drag/resize utilities - segmentElementEach(segments, function(segment, element) { - reportEventElement(segment.event, element); - }); - - // attach mouse handlers - attachHandlers(segments, modifiedEventId); - - // call `eventAfterRender` callback for each event - segmentElementEach(segments, function(segment, element) { - trigger('eventAfterRender', segment.event, segment.event, element); - }); - } - - - // Render an event on the calendar, but don't report them anywhere, and don't attach mouse handlers. - // Append this event element to the event container, which might already be populated with events. - // If an event's segment will have row equal to `adjustRow`, then explicitly set its top coordinate to `adjustTop`. - // This hack is used to maintain continuity when user is manually resizing an event. - // Returns an array of DOM elements for the event. - function renderTempDayEvent(event, adjustRow, adjustTop) { - - // actually render the event. `true` for appending element to container. - // Recieve the intermediate "segment" data structures. - var segments = _renderDayEvents( - [ event ], - true, // append event elements - false // don't set the heights of the rows - ); - - var elements = []; - - // Adjust certain elements' top coordinates - segmentElementEach(segments, function(segment, element) { - if (segment.row === adjustRow) { - element.css('top', adjustTop); - } - elements.push(element[0]); // accumulate DOM nodes - }); - - return elements; - } - - - // Render events onto the calendar. Only responsible for the VISUAL aspect. - // Not responsible for attaching handlers or calling callbacks. - // Set `doAppend` to `true` for rendering elements without clearing the existing container. - // Set `doRowHeights` to allow setting the height of each row, to compensate for vertical event overflow. - function _renderDayEvents(events, doAppend, doRowHeights) { - - // where the DOM nodes will eventually end up - var finalContainer = getDaySegmentContainer(); - - // the container where the initial HTML will be rendered. - // If `doAppend`==true, uses a temporary container. - var renderContainer = doAppend ? $("
") : finalContainer; - - var segments = buildSegments(events); - var html; - var elements; - - // calculate the desired `left` and `width` properties on each segment object - calculateHorizontals(segments); - - // build the HTML string. relies on `left` property - html = buildHTML(segments); - - // render the HTML. innerHTML is considerably faster than jQuery's .html() - renderContainer[0].innerHTML = html; - - // retrieve the individual elements - elements = renderContainer.children(); - - // if we were appending, and thus using a temporary container, - // re-attach elements to the real container. - if (doAppend) { - finalContainer.append(elements); - } - - // assigns each element to `segment.event`, after filtering them through user callbacks - resolveElements(segments, elements); - - // Calculate the left and right padding+margin for each element. - // We need this for setting each element's desired outer width, because of the W3C box model. - // It's important we do this in a separate pass from acually setting the width on the DOM elements - // because alternating reading/writing dimensions causes reflow for every iteration. - segmentElementEach(segments, function(segment, element) { - segment.hsides = hsides(element, true); // include margins = `true` - }); - - // Set the width of each element - segmentElementEach(segments, function(segment, element) { - element.width( - Math.max(0, segment.outerWidth - segment.hsides) - ); - }); - - // Grab each element's outerHeight (setVerticals uses this). - // To get an accurate reading, it's important to have each element's width explicitly set already. - segmentElementEach(segments, function(segment, element) { - segment.outerHeight = element.outerHeight(true); // include margins = `true` - }); - - // Set the top coordinate on each element (requires segment.outerHeight) - setVerticals(segments, doRowHeights); - - return segments; - } - - - // Generate an array of "segments" for all events. - function buildSegments(events) { - var resources = t.getResources; - var segments = []; - var i, eventSegments; - - if (typeof resources === 'undefined'){ - for (i=0; i" + - "
"; - if (!event.allDay && segment.isStart) { - html += - "" + - htmlEscape(t.getEventTimeText(event)) + - ""; - } - html += - "" + - htmlEscape(event.title || '') + - "" + - "
"; - if (event.allDay && segment.isEnd && isEventResizable(event)) { - html += - "
" + - "   " + // makes hit area a lot better for IE6/7 - "
"; - } - html += ""; - - // TODO: - // When these elements are initially rendered, they will be briefly visibile on the screen, - // even though their widths/heights are not set. - // SOLUTION: initially set them as visibility:hidden ? - - return html; - } - - - // Associate each segment (an object) with an element (a jQuery object), - // by setting each `segment.element`. - // Run each element through the `eventRender` filter, which allows developers to - // modify an existing element, supply a new one, or cancel rendering. - function resolveElements(segments, elements) { - for (var i=0; i div'); - } - return rowDivs; - } - - - - /* Mouse Handlers - ---------------------------------------------------------------------------------------------------*/ - // TODO: better documentation! - - - function attachHandlers(segments, modifiedEventId) { - var segmentContainer = getDaySegmentContainer(); - - segmentElementEach(segments, function(segment, element, i) { - var event = segment.event; - if (event._id === modifiedEventId) { - bindDaySeg(event, element, segment); - }else{ - element[0]._fci = i; // for lazySegBind - } - }); - - lazySegBind(segmentContainer, segments, bindDaySeg); - } - - - function bindDaySeg(event, eventElement, segment) { - - if (isEventDraggable(event)) { - t.draggableDayEvent(event, eventElement, segment); // use `t` so subclasses can override - } - - if ( - event.allDay && - segment.isEnd && // only allow resizing on the final segment for an event - isEventResizable(event) - ) { - t.resizableDayEvent(event, eventElement, segment); // use `t` so subclasses can override - } - - // attach all other handlers. - // needs to be after, because resizableDayEvent might stopImmediatePropagation on click - eventElementHandlers(event, eventElement); - } - - - function draggableDayEvent(event, eventElement) { - var hoverListener = getHoverListener(); - var dayDelta; - var eventStart; - eventElement.draggable({ - delay: 50, - opacity: opt('dragOpacity'), - revertDuration: opt('dragRevertDuration'), - start: function(ev, ui) { - trigger('eventDragStart', eventElement[0], event, ev, ui); - hideEvents(event, eventElement); - hoverListener.start(function(cell, origCell, rowDelta, colDelta) { - eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta); - clearOverlays(); - if (cell) { - var origCellDate = cellToDate(origCell); - var cellDate = cellToDate(cell); - dayDelta = cellDate.diff(origCellDate, 'days'); - eventStart = event.start.clone().add(dayDelta, 'days'); - renderDayOverlay( - eventStart, - getEventEnd(event).add(dayDelta, 'days') - ); - } - else { - dayDelta = 0; - } - }, ev, 'drag'); - }, - stop: function(ev, ui) { - hoverListener.stop(); - clearOverlays(); - trigger('eventDragStop', eventElement[0], event, ev, ui); - if (dayDelta) { - eventDrop( - eventElement[0], - event, - eventStart, - ev, - ui - ); - } - else { - eventElement.css('filter', ''); // clear IE opacity side-effects - showEvents(event, eventElement); - } - } - }); - } - - - function resizableDayEvent(event, element, segment) { - var isRTL = opt('isRTL'); - var direction = isRTL ? 'w' : 'e'; - var handle = element.find('.ui-resizable-' + direction); // TODO: stop using this class because we aren't using jqui for this - var isResizing = false; - - // TODO: look into using jquery-ui mouse widget for this stuff - disableTextSelection(element); // prevent native selection for IE - element - .mousedown(function(ev) { // prevent native selection for others - ev.preventDefault(); - }) - .click(function(ev) { - if (isResizing) { - ev.preventDefault(); // prevent link from being visited (only method that worked in IE6) - ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called - // (eventElementHandlers needs to be bound after resizableDayEvent) - } - }); - - handle.mousedown(function(ev) { - if (ev.which != 1) { - return; // needs to be left mouse button - } - isResizing = true; - var hoverListener = getHoverListener(); - var elementTop = element.css('top'); - var dayDelta; - var eventEnd; - var helpers; - var eventCopy = $.extend({}, event); - var minCellOffset = dayOffsetToCellOffset(dateToDayOffset(event.start)); - clearSelection(); - $('body') - .css('cursor', direction + '-resize') - .one('mouseup', mouseup); - trigger('eventResizeStart', element[0], event, ev, {}); // {} is dummy jqui event - hoverListener.start(function(cell, origCell) { - if (cell) { - - var origCellOffset = cellToCellOffset(origCell); - var cellOffset = cellToCellOffset(cell); - - // don't let resizing move earlier than start date cell - cellOffset = Math.max(cellOffset, minCellOffset); - - dayDelta = - cellOffsetToDayOffset(cellOffset) - - cellOffsetToDayOffset(origCellOffset); - - eventEnd = getEventEnd(event).add(dayDelta, 'days'); // assumed to already have a stripped time - - if (dayDelta) { - eventCopy.end = eventEnd; - var oldHelpers = helpers; - helpers = renderTempDayEvent(eventCopy, segment.row, elementTop); - helpers = $(helpers); // turn array into a jQuery object - helpers.find('*').css('cursor', direction + '-resize'); - if (oldHelpers) { - oldHelpers.remove(); - } - hideEvents(event); - } - else { - if (helpers) { - showEvents(event); - helpers.remove(); - helpers = null; - } - } - - clearOverlays(); - renderDayOverlay( // coordinate grid already rebuilt with hoverListener.start() - event.start, - eventEnd - // TODO: instead of calling renderDayOverlay() with dates, - // call _renderDayOverlay (or whatever) with cell offsets. - ); - } - }, ev); - - function mouseup(ev) { - trigger('eventResizeStop', element[0], event, ev, {}); // {} is dummy jqui event - $('body').css('cursor', ''); - hoverListener.stop(); - clearOverlays(); - - if (dayDelta) { - eventResize( - element[0], - event, - eventEnd, - ev, - {} // dummy jqui event - ); - // event redraw will clear helpers - } - // otherwise, the drag handler already restored the old events - - setTimeout(function() { // make this happen after the element's click event - isResizing = false; - },0); - } - }); - } - - -} - - - -/* Generalized Segment Utilities --------------------------------------------------------------------------------------------------*/ - - -function isDaySegmentCollision(segment, otherSegments) { - for (var i=0; i= segment.leftCol - ) { - return true; - } - } - return false; -} - - -function segmentElementEach(segments, callback) { // TODO: use in AgendaView? - for (var i=0; i"); - } - if (e[0].parentNode != parent[0]) { - e.appendTo(parent); - } - usedOverlays.push(e.css(rect).show()); - return e; - } - - - function clearOverlays() { - var e; - while ((e = usedOverlays.shift())) { - unusedOverlays.push(e.hide().unbind()); - } - } - - -} diff --git a/src/common/SelectionManager.js b/src/common/SelectionManager.js deleted file mode 100644 index 46453e2..0000000 --- a/src/common/SelectionManager.js +++ /dev/null @@ -1,122 +0,0 @@ - -//BUG: unselect needs to be triggered when events are dragged+dropped - -function SelectionManager() { - var t = this; - - - // exports - t.select = select; - t.unselect = unselect; - t.reportSelection = reportSelection; - t.daySelectionMousedown = daySelectionMousedown; - t.selectionManagerDestroy = destroy; - - - // imports - var calendar = t.calendar; - var opt = t.opt; - var trigger = t.trigger; - var defaultSelectionEnd = t.defaultSelectionEnd; - var renderSelection = t.renderSelection; - var clearSelection = t.clearSelection; - - - // locals - var selected = false; - - - - // unselectAuto - if (opt('selectable') && opt('unselectAuto')) { - $(document).on('mousedown', documentMousedown); - } - - - function documentMousedown(ev) { - var ignore = opt('unselectCancel'); - if (ignore) { - if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match - return; - } - } - unselect(ev); - } - - - function select(start, end) { - unselect(); - - start = calendar.moment(start); - if (end) { - end = calendar.moment(end); - } - else { - end = defaultSelectionEnd(start); - } - - renderSelection(start, end); - reportSelection(start, end); - } - // TODO: better date normalization. see notes in automated test - - - function unselect(ev) { - if (selected) { - selected = false; - clearSelection(); - trigger('unselect', null, ev); - } - } - - - function reportSelection(start, end, ev) { - selected = true; - trigger('select', null, start, end, ev); - } - - - function daySelectionMousedown(ev) { // not really a generic manager method, oh well - var cellToDate = t.cellToDate; - var getIsCellAllDay = t.getIsCellAllDay; - var hoverListener = t.getHoverListener(); - var reportDayClick = t.reportDayClick; // this is hacky and sort of weird - - if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button - unselect(ev); - var dates; - hoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell - clearSelection(); - if (cell && getIsCellAllDay(cell)) { - dates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare); - renderSelection( - dates[0], - dates[1].clone().add(1, 'days') // make exclusive - ); - }else{ - dates = null; - } - }, ev); - $(document).one('mouseup', function(ev) { - hoverListener.stop(); - if (dates) { - if (+dates[0] == +dates[1]) { - reportDayClick(dates[0], ev); - } - reportSelection( - dates[0], - dates[1].clone().add(1, 'days'), // make exclusive - ev - ); - } - }); - } - } - - - function destroy() { - $(document).off('mousedown', documentMousedown); - } - - -} diff --git a/tests/Issue16ClickEventDates.html b/tests/Issue16ClickEventDates.html deleted file mode 100644 index 5195afb..0000000 --- a/tests/Issue16ClickEventDates.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - -

Calendar demo

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/automated/agenda-view.js b/tests/automated/agenda-view.js deleted file mode 100644 index 68662fc..0000000 --- a/tests/automated/agenda-view.js +++ /dev/null @@ -1,52 +0,0 @@ - -describe('agenda view rendering', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when isRTL is false', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultView: 'agendaWeek', - isRTL: false - }); - }); - - it('should have have days ordered sun to sat', function() { - var fc = $('#cal').find('.fc-view > table > thead th'); - expect(fc[0]).toHaveClass('fc-axis'); - expect(fc[1]).toHaveClass('fc-sun'); - expect(fc[2]).toHaveClass('fc-mon'); - expect(fc[3]).toHaveClass('fc-tue'); - expect(fc[4]).toHaveClass('fc-wed'); - expect(fc[5]).toHaveClass('fc-thu'); - expect(fc[6]).toHaveClass('fc-fri'); - expect(fc[7]).toHaveClass('fc-sat'); - }); - }); - - describe('when isRTL is true', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultView: 'agendaWeek', - isRTL: true - }); - }); - - it('should have have days ordered sat to sun', function() { - var fc = $('#cal').find('.fc-view > table > thead th'); - expect(fc[0]).toHaveClass('fc-sat'); - expect(fc[1]).toHaveClass('fc-fri'); - expect(fc[2]).toHaveClass('fc-thu'); - expect(fc[3]).toHaveClass('fc-wed'); - expect(fc[4]).toHaveClass('fc-tue'); - expect(fc[5]).toHaveClass('fc-mon'); - expect(fc[6]).toHaveClass('fc-sun'); - expect(fc[7]).toHaveClass('fc-axis'); - }); - }); - -}); \ No newline at end of file diff --git a/tests/automated/allDayDefault.js b/tests/automated/allDayDefault.js deleted file mode 100644 index 87f7515..0000000 --- a/tests/automated/allDayDefault.js +++ /dev/null @@ -1,210 +0,0 @@ - -describe('allDayDefault', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when undefined', function() { - - it('guesses false if T in ISO8601 start date', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: '2014-05-01T06:00:00' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('guesses false if T in ISO8601 end date', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: '2014-05-01', - end: '2014-05-01T08:00:00' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('guesses true if ISO8601 start date with no time and unspecified end date', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: '2014-05-01' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(true); - }); - - it('guesses true if ISO8601 start and end date with no times', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: '2014-05-01', - end: '2014-05-03' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(true); - }); - - it('guesses false if start is a unix timestamp (which implies it has a time)', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: 1398902400000, - end: '2014-05-03' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('guesses false if end is a unix timestamp (which implies it has a time)', function() { - $('#cal').fullCalendar({ - events: [ - { - id: '1', - start: '2014-05-01', - end: 1399075200000 - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - }); - - describe('when specified', function() { - - it('has an effect when an event\'s allDay is not specified', function() { - $('#cal').fullCalendar({ - allDayDefault: false, - events: [ - { - id: '1', - start: '2014-05-01' - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('has no effect when an event\'s allDay is specified', function() { - $('#cal').fullCalendar({ - allDayDefault: false, - events: [ - { - id: '1', - start: '2014-05-01T00:00:00', - allDay: true - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(true); - }); - - }); - -}); - -describe('source.allDayDefault', function() { - - beforeEach(function() { - affix('#cal'); - }); - - it('has an effect when an event\'s allDay is not specified', function() { - $('#cal').fullCalendar({ - eventSources: [ - { - allDayDefault: false, - events: [ - { - id: '1', - start: '2014-05-01' - } - ] - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('a true value can override the global allDayDefault', function() { - $('#cal').fullCalendar({ - allDayDefault: false, - eventSources: [ - { - allDayDefault: true, - events: [ - { - id: '1', - start: '2014-05-01T06:00:00' - } - ] - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(true); - }); - - it('a false value can override the global allDayDefault', function() { - $('#cal').fullCalendar({ - allDayDefault: true, - eventSources: [ - { - allDayDefault: false, - events: [ - { - id: '1', - start: '2014-05-01' - } - ] - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - - it('has no effect when an event\'s allDay is specified', function() { - $('#cal').fullCalendar({ - eventSources: [ - { - allDayDefault: true, - events: [ - { - id: '1', - start: '2014-05-01', - allDay: false - } - ] - } - ] - }); - var eventObj = $('#cal').fullCalendar('clientEvents', '1')[0]; - expect(eventObj.allDay).toEqual(false); - }); - -}); diff --git a/tests/automated/allDaySlot.js b/tests/automated/allDaySlot.js deleted file mode 100644 index 21aef33..0000000 --- a/tests/automated/allDaySlot.js +++ /dev/null @@ -1,80 +0,0 @@ - -describe('allDaySlots', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when allDaySlots is not set', function() { - describe('in agendaWeek', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(1); - }); - }); - describe('in agendaDay', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(1); - }); - }); - }); - - describe('when allDaySlots is set true', function() { - describe('in agendaWeek', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaWeek', - allDaySlot: true - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(1); - }); - }); - describe('in agendaDay', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaDay', - allDaySlot: true - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(1); - }); - }); - }); - - describe('when allDaySlots is set false', function() { - describe('in agendaWeek', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaWeek', - allDaySlot: false - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(0); - }); - }); - describe('in agendaDay', function() { - it('should default to having an allDaySlots table', function() { - var options = { - defaultView: 'agendaDay', - allDaySlot: false - }; - $('#cal').fullCalendar(options); - var allDaySlotCount = $('.fc-day-grid').length; - expect(allDaySlotCount).toEqual(0); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/allDayText.js b/tests/automated/allDayText.js deleted file mode 100644 index f2711e1..0000000 --- a/tests/automated/allDayText.js +++ /dev/null @@ -1,108 +0,0 @@ - -describe('allDayText', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when allDaySlots is not set', function() { - describe('in agendaWeek', function() { - it('should default allDayText to using \'all-day\'', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('all-day'); - }); - }); - describe('in agendaDay', function() { - it('should default allDayText to using \'all-day\'', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('all-day'); - }); - }); - }); - - describe('when allDaySlots is set true', function() { - describe('in agendaWeek', function() { - it('should default allDayText to using \'all-day\'', function() { - var options = { - defaultView: 'agendaWeek', - allDaySlot: true - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('all-day'); - }); - }); - describe('in agendaDay', function() { - it('should default allDayText to using \'all-day\'', function() { - var options = { - defaultView: 'agendaDay', - allDaySlot: true - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('all-day'); - }); - }); - }); - - describe('when allDaySlots is set true and language is not default', function() { - describe('in agendaWeek', function() { - it('should use the language\'s all-day value', function() { - var options = { - defaultView: 'agendaWeek', - allDaySlot: true, - lang: 'pt-br' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('dia inteiro'); - }); - }); - describe('in agendaDay', function() { - it('should use the language\'s all-day value', function() { - var options = { - defaultView: 'agendaDay', - allDaySlot: true, - lang: 'pt-br' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('dia inteiro'); - }); - }); - }); - - describe('when allDaySlots is set true and allDayText is specified', function() { - describe('in agendaWeek', function() { - it('should show specified all day text', function() { - var options = { - defaultView: 'agendaWeek', - allDaySlot: true, - allDayText: 'axis-phosy' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('axis-phosy'); - }); - }); - describe('in agendaDay', function() { - it('should show specified all day text', function() { - var options = { - defaultView: 'agendaDay', - allDayText: 'axis-phosy' - }; - $('#cal').fullCalendar(options); - var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); - expect(allDayText).toEqual('axis-phosy'); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/aspectRatio.js b/tests/automated/aspectRatio.js deleted file mode 100644 index ced7f0a..0000000 --- a/tests/automated/aspectRatio.js +++ /dev/null @@ -1,139 +0,0 @@ - -describe('aspectRatio', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when default settings are used', function() { - beforeEach(function() { - $('#cal').width(675); - $('#cal').fullCalendar(); - }); - it('fc-content should use the ratio 1:35 to set height', function() { - var height = $('.fc-view-container').height(); - expect(height).toEqual(500); - }); - it('fc-content should have width of div', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(675); - }); - }); - - describe('when initializing the aspectRatio', function() { - - describe('to 2', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: 2 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should set the height to width sizes very close to ratio of 2', function() { - var width = $('.fc-view-container').width(); - var height = $('.fc-view-container').height(); - var ratio = Math.round(width / height * 100); - expect(ratio).toEqual(200); - }); - }); - - describe('to 1', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: 1 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should set the height to width sizes very close to ratio of 2', function() { - var width = $('.fc-view-container').width(); - var height = $('.fc-view-container').height(); - var ratio = Math.round(width / height * 100); - expect(ratio).toEqual(100); - }); - }); - - describe('to less than 0.5', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: 0.4 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-view-container').width(); - var height = $('.fc-view-container').height(); - var ratio = Math.round(width / height * 100); - expect(ratio).toEqual(50); - }); - }); - - describe('to negative', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: -2 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-view-container').width(); - var height = $('.fc-view-container').height(); - var ratio = Math.round(width / height * 100); - expect(ratio).toEqual(50); - }); - }); - - describe('to zero', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: 0 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-view-container').width(); - var height = $('.fc-view-container').height(); - var ratio = Math.round(width / height * 100); - expect(ratio).toEqual(50); - }); - }); - - describe('to very large', function() { - beforeEach(function() { - $('#cal').width(1000); - $('#cal').fullCalendar({ - aspectRatio: 4000 - }); - }); - it('should not change the width', function() { - var width = $('.fc-view-container').width(); - expect(width).toEqual(1000); - }); - it('should cause rows to be natural height', function() { - var actualHeight = $('.fc-view-container').height(); - $('tr.fc-week td:first-child > div').css('min-height', '').css('background', 'red'); - var naturalHeight = $('.fc-view-container').height(); - expect(actualHeight).toEqual(naturalHeight); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/axisFormat.js b/tests/automated/axisFormat.js deleted file mode 100644 index 78b9489..0000000 --- a/tests/automated/axisFormat.js +++ /dev/null @@ -1,33 +0,0 @@ -describe('axisFormat', function() { - - var options; - - function getAxisText() { - return $('.fc-slats tr:first-child .fc-time').text(); - } - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-06-04', - defaultView: 'agendaWeek' - }; - }); - - it('renders correctly when default', function() { - $('#cal').fullCalendar(options); - expect(getAxisText()).toBe('12am'); - }); - - it('renders correctly when default and the language is customized', function() { - options.lang = 'en-gb'; - $('#cal').fullCalendar(options); - expect(getAxisText()).toBe('00'); - }); - - it('renders correctly when customized', function() { - options.axisFormat = 'H:mm:mm[!]'; - $('#cal').fullCalendar(options); - expect(getAxisText()).toBe('0:00:00!'); - }); -}); \ No newline at end of file diff --git a/tests/automated/basic-view.js b/tests/automated/basic-view.js deleted file mode 100644 index c2c525a..0000000 --- a/tests/automated/basic-view.js +++ /dev/null @@ -1,50 +0,0 @@ - -describe('basic view rendering', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when isRTL is false', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultView: 'month', - isRTL: false - }); - }); - - it('should have have days ordered sun to sat', function() { - var fc = $('#cal').find('.fc-day-header'); - expect(fc[0]).toHaveClass('fc-sun'); - expect(fc[1]).toHaveClass('fc-mon'); - expect(fc[2]).toHaveClass('fc-tue'); - expect(fc[3]).toHaveClass('fc-wed'); - expect(fc[4]).toHaveClass('fc-thu'); - expect(fc[5]).toHaveClass('fc-fri'); - expect(fc[6]).toHaveClass('fc-sat'); - }); - }); - - describe('when isRTL is true', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultView: 'month', - isRTL: true - }); - }); - - it('should have have days ordered sat to sun', function() { - var fc = $('#cal').find('.fc-day-header'); - expect(fc[0]).toHaveClass('fc-sat'); - expect(fc[1]).toHaveClass('fc-fri'); - expect(fc[2]).toHaveClass('fc-thu'); - expect(fc[3]).toHaveClass('fc-wed'); - expect(fc[4]).toHaveClass('fc-tue'); - expect(fc[5]).toHaveClass('fc-mon'); - expect(fc[6]).toHaveClass('fc-sun'); - }); - }); - -}); \ No newline at end of file diff --git a/tests/automated/buttonIcons.js b/tests/automated/buttonIcons.js deleted file mode 100644 index ff70afa..0000000 --- a/tests/automated/buttonIcons.js +++ /dev/null @@ -1,92 +0,0 @@ -describe('buttonIcons', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when buttonIcons is not set', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'prevYear, nextYear' - } - }); - }); - - it('should have default values', function() { - var prevBtn = $('#cal').find('.fc-prev-button'); - var nextBtn = $('#cal').find('.fc-next-button'); - var nextYearBtn = $('#cal').find('.fc-nextYear-button'); - var prevYearBtn = $('#cal').find('.fc-prevYear-button'); - - expect(prevBtn.find('span:first')).toHaveClass('fc-icon-left-single-arrow'); - expect(nextBtn.find('span:first')).toHaveClass('fc-icon-right-single-arrow'); - expect(nextYearBtn.find('span:first')).toHaveClass('fc-icon-right-double-arrow'); - expect(prevYearBtn.find('span:first')).toHaveClass('fc-icon-left-double-arrow'); - }); - }); - - describe('when buttonIcons is set and theme is falsy', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - buttonIcons: { - prev: 'some-icon-left', - next: 'some-icon-right', - prevYear: 'some-icon-leftYear', - nextYear: 'some-icon-rightYear' - }, - header: { - left: 'prev,next today', - center: 'title', - right: 'prevYear, nextYear' - } - }); - }); - - it('should have the set values', function() { - var prevBtn = $('#cal').find('.fc-prev-button'); - var nextBtn = $('#cal').find('.fc-next-button'); - var prevYearBtn = $('#cal').find('.fc-prevYear-button'); - var nextYearBtn = $('#cal').find('.fc-nextYear-button'); - - - expect(prevBtn.find('span:first')).toHaveClass('fc-icon-some-icon-left'); - expect(prevBtn.find('span:first')).toHaveClass('fc-icon-some-icon-left'); - expect(prevYearBtn.find('span:first')).toHaveClass('fc-icon-some-icon-leftYear'); - expect(nextYearBtn.find('span:first')).toHaveClass('fc-icon-some-icon-rightYear'); - }); - }); - - describe('when theme is true', function() { - - beforeEach(function() { - $('#cal').fullCalendar({ - theme: true, - header: { - left: 'prev,next today', - center: 'title', - right: 'prevYear, nextYear' - } - }); - }); - - it('buttonIcons is ignored', function() { - var prevBtn = $('#cal').find('.fc-prev-button'); - var nextBtn = $('#cal').find('.fc-next-button'); - var prevYearBtn = $('#cal').find('.fc-prevYear-button'); - var nextYearBtn = $('#cal').find('.fc-nextYear-button'); - - var classesToSearch = [ '.fc-icon-left-single-arrow', '.fc-icon-right-double-arrow', - '.fc-icon-right-single-arrow', '.fc-icon-left-double-arrow' ]; - - for (var i = 0; i < classesToSearch.length; i++) { - var cls = classesToSearch[i]; - expect($('#cal').find(cls).length).toBe(0); - }; - }); - }); -}); diff --git a/tests/automated/buttonText.js b/tests/automated/buttonText.js deleted file mode 100644 index 4835d0c..0000000 --- a/tests/automated/buttonText.js +++ /dev/null @@ -1,225 +0,0 @@ -describe('button text', function() { - - var settings; - - beforeEach(function() { - affix('#cal'); - settings = { - header: { - left: 'prevYear,prev,today,next,nextYear', - center: '', - right: 'month,basicWeek,basicDay,agendaWeek,agendaDay' - } - }; - }); - - describe('with default language', function() { - - describe('with default buttonIcons', function() { - - it('should contain default text values', function() { - $('#cal').fullCalendar(settings); - - // will have button icons, to text will be empty - expect($('.fc-next-button')).toHaveText(''); - expect($('.fc-nextYear-button')).toHaveText(''); - expect($('.fc-prev-button')).toHaveText(''); - expect($('.fc-prevYear-button')).toHaveText(''); - - expect($('.fc-today-button')).toHaveText('today'); - expect($('.fc-month-button')).toHaveText('month'); - expect($('.fc-basicWeek-button')).toHaveText('week'); - expect($('.fc-agendaWeek-button')).toHaveText('week'); - expect($('.fc-basicDay-button')).toHaveText('day'); - expect($('.fc-agendaDay-button')).toHaveText('day'); - }); - - it('should contain specified text values', function() { - settings.buttonText = { - prev: '<-', - next: '->', - prevYear: '<--', - nextYear: '-->', - today: 'tidei', - month: 'mun', - week: 'wiki', - day: 'dei' - }; - $('#cal').fullCalendar(settings); - - expect($('.fc-next-button')).toHaveText('->'); - expect($('.fc-nextYear-button')).toHaveText('-->'); - expect($('.fc-prev-button')).toHaveText('<-'); - expect($('.fc-prevYear-button')).toHaveText('<--'); - - expect($('.fc-today-button')).toHaveText('tidei'); - expect($('.fc-month-button')).toHaveText('mun'); - expect($('.fc-agendaDay-button')).toHaveText('dei'); - expect($('.fc-agendaWeek-button')).toHaveText('wiki'); - expect($('.fc-basicDay-button')).toHaveText('dei'); - expect($('.fc-basicWeek-button')).toHaveText('wiki'); - }); - - }); - - describe('with buttonIcons turned off', function() { - - beforeEach(function() { - settings.buttonIcons = false; - }); - - it('should contain default text values', function() { - $('#cal').fullCalendar(settings); - - // will have actual text now - expect($('.fc-next-button')).toHaveText('next'); - expect($('.fc-nextYear-button')).toHaveText('next year'); - expect($('.fc-prev-button')).toHaveText('prev'); - expect($('.fc-prevYear-button')).toHaveText('prev year'); - - expect($('.fc-today-button')).toHaveText('today'); - expect($('.fc-month-button')).toHaveText('month'); - expect($('.fc-basicWeek-button')).toHaveText('week'); - expect($('.fc-agendaWeek-button')).toHaveText('week'); - expect($('.fc-basicDay-button')).toHaveText('day'); - expect($('.fc-agendaDay-button')).toHaveText('day'); - }); - - it('should contain specified text values', function() { - settings.buttonText = { - prev: '<-', - next: '->', - prevYear: '<--', - nextYear: '-->', - today: 'tidei', - month: 'mun', - week: 'wiki', - day: 'dei' - }; - $('#cal').fullCalendar(settings); - - expect($('.fc-next-button')).toHaveText('->'); - expect($('.fc-nextYear-button')).toHaveText('-->'); - expect($('.fc-prev-button')).toHaveText('<-'); - expect($('.fc-prevYear-button')).toHaveText('<--'); - - expect($('.fc-today-button')).toHaveText('tidei'); - expect($('.fc-month-button')).toHaveText('mun'); - expect($('.fc-agendaDay-button')).toHaveText('dei'); - expect($('.fc-agendaWeek-button')).toHaveText('wiki'); - expect($('.fc-basicDay-button')).toHaveText('dei'); - expect($('.fc-basicWeek-button')).toHaveText('wiki'); - }); - - }); - - }); - - describe('when lang is not default', function() { - - beforeEach(function() { - settings.lang = 'fr'; - }); - - describe('with default buttonIcons', function() { - - it('should contain default text values', function() { - $('#cal').fullCalendar(settings); - - // will contain icons, so will contain no text - expect($('.fc-next-button')).toHaveText(''); - expect($('.fc-nextYear-button')).toHaveText(''); - expect($('.fc-prev-button')).toHaveText(''); - expect($('.fc-prevYear-button')).toHaveText(''); - - expect($('.fc-today-button')).toHaveText('Aujourd\'hui'); - expect($('.fc-month-button')).toHaveText('Mois'); - expect($('.fc-basicWeek-button')).toHaveText('Semaine'); - expect($('.fc-agendaWeek-button')).toHaveText('Semaine'); - expect($('.fc-basicDay-button')).toHaveText('Jour'); - expect($('.fc-agendaDay-button')).toHaveText('Jour'); - }); - - it('should contain specified text values', function() { - settings.buttonText = { - prev: '<-', - next: '->', - prevYear: '<--', - nextYear: '-->', - today: 'tidei', - month: 'mun', - week: 'wiki', - day: 'dei' - }; - $('#cal').fullCalendar(settings); - - expect($('.fc-next-button')).toHaveText('->'); - expect($('.fc-nextYear-button')).toHaveText('-->'); - expect($('.fc-prev-button')).toHaveText('<-'); - expect($('.fc-prevYear-button')).toHaveText('<--'); - - expect($('.fc-today-button')).toHaveText('tidei'); - expect($('.fc-month-button')).toHaveText('mun'); - expect($('.fc-agendaDay-button')).toHaveText('dei'); - expect($('.fc-agendaWeek-button')).toHaveText('wiki'); - expect($('.fc-basicDay-button')).toHaveText('dei'); - expect($('.fc-basicWeek-button')).toHaveText('wiki'); - }); - - }); - - describe('with buttonIcons turned off', function() { - - beforeEach(function() { - settings.buttonIcons = false; - }); - - it('should contain default text values', function() { - $('#cal').fullCalendar(settings); - - // will have the language's actual text now - expect($('.fc-next-button')).toHaveText('Suivant'); - expect($('.fc-prev-button')).toHaveText('PrĆ©cĆ©dent'); - //// languages files don't have data for prev/next *year* - //expect($('.fc-nextYear-button')).toHaveText('Suivant'); - //expect($('.fc-prevYear-button')).toHaveText('PrĆ©cĆ©dent'); - - expect($('.fc-today-button')).toHaveText('Aujourd\'hui'); - expect($('.fc-month-button')).toHaveText('Mois'); - expect($('.fc-basicWeek-button')).toHaveText('Semaine'); - expect($('.fc-agendaWeek-button')).toHaveText('Semaine'); - expect($('.fc-basicDay-button')).toHaveText('Jour'); - expect($('.fc-agendaDay-button')).toHaveText('Jour'); - }); - - it('should contain specified text values', function() { - settings.buttonText = { - prev: '<-', - next: '->', - prevYear: '<--', - nextYear: '-->', - today: 'tidei', - month: 'mun', - week: 'wiki', - day: 'dei' - }; - $('#cal').fullCalendar(settings); - - expect($('.fc-next-button')).toHaveText('->'); - expect($('.fc-nextYear-button')).toHaveText('-->'); - expect($('.fc-prev-button')).toHaveText('<-'); - expect($('.fc-prevYear-button')).toHaveText('<--'); - - expect($('.fc-today-button')).toHaveText('tidei'); - expect($('.fc-month-button')).toHaveText('mun'); - expect($('.fc-agendaDay-button')).toHaveText('dei'); - expect($('.fc-agendaWeek-button')).toHaveText('wiki'); - expect($('.fc-basicDay-button')).toHaveText('dei'); - expect($('.fc-basicWeek-button')).toHaveText('wiki'); - }); - - }); - - }); - -}); diff --git a/tests/automated/columnFormat.js b/tests/automated/columnFormat.js deleted file mode 100644 index e13d8d5..0000000 --- a/tests/automated/columnFormat.js +++ /dev/null @@ -1,115 +0,0 @@ -describe('columnFormat', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when columnFormat is not set', function() { - - var viewWithFormat = [ { view: 'month', expected: 'Sun', selector: 'th.fc-day-header.fc-sun' }, - { view: 'basicWeek', expected: 'Sun 5/11', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaWeek', expected: 'Sun 5/11', selector: 'th.fc-widget-header.fc-sun' }, - { view: 'basicDay', expected: 'Sunday', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaDay', expected: 'Sunday', selector: 'th.fc-widget-header.fc-sun' } ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-05-11' - }); - }); - - it('should have default values', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(crtView.selector).text()).toBe(crtView.expected); - }; - }); - }); - - describe('when columnFormat is set on a per-view basis', function() { - - var viewWithFormat = [ { view: 'month', expected: 'Sunday', selector: 'th.fc-day-header.fc-sun' }, - { view: 'basicWeek', expected: 'Sunday 11 - 5', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaWeek', expected: 'Sunday 11 , 5', selector: 'th.fc-widget-header.fc-sun' }, - { view: 'basicDay', expected: 'Sunday 11 | 5', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaDay', expected: 'Sunday 5/11', selector: 'th.fc-widget-header.fc-sun' } ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-05-11', - columnFormat: { - month: 'dddd', - agendaDay: 'dddd M/D', - agendaWeek: 'dddd D , M', - basicDay: 'dddd D | M', - basicWeek: 'dddd D - M' - } - }); - }); - - it('should have the correct values', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(crtView.selector).text()).toBe(crtView.expected); - }; - }); - }); - - describe('when lang is French', function() { - - var viewWithFormat = [ { view: 'month', expected: 'dim.', selector: 'th.fc-day-header.fc-sun' }, - { view: 'basicWeek', expected: 'dim. 11/05', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaWeek', expected: 'dim. 11/05', selector: 'th.fc-widget-header.fc-sun' }, - { view: 'basicDay', expected: 'dimanche', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaDay', expected: 'dimanche', selector: 'th.fc-widget-header.fc-sun' } ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-05-11', - lang: 'fr' - }); - }); - - it('should have the translated dates', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(crtView.selector).text()).toBe(crtView.expected); - }; - }); - }); - - describe('when lang is Korean', function() { - - var viewWithFormat = [ { view: 'month', expected: 'ģ¼', selector: 'th.fc-day-header.fc-sun' }, - { view: 'basicWeek', expected: 'ģ¼ 05.11', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaWeek', expected: 'ģ¼ 05.11', selector: 'th.fc-widget-header.fc-sun' }, - { view: 'basicDay', expected: 'ģ¼ģš”ģ¼', selector: 'th.fc-day-header.fc-sun' }, - { view: 'agendaDay', expected: 'ģ¼ģš”ģ¼', selector: 'th.fc-widget-header.fc-sun' } ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-05-11', - lang: 'ko' - }); - }); - - it('should have the translated dates and columnFormat should be computed differently', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(crtView.selector).text()).toBe(crtView.expected); - }; - }); - }); -}); diff --git a/tests/automated/constructor.js b/tests/automated/constructor.js deleted file mode 100644 index 552e48d..0000000 --- a/tests/automated/constructor.js +++ /dev/null @@ -1,87 +0,0 @@ - -describe('constructor', function() { - - beforeEach(function() { - affix('#calendar'); - }); - - it('should return a jQuery object for chaining', function() { - var res = $('#calendar').fullCalendar(); - expect(res instanceof jQuery).toBe(true); - }); - - it('should not modify the options object', function() { - var options = { - defaultView: 'agendaWeek', - scrollTime: '09:00:00', - slotDuration: { minutes: 45 } - }; - var optionsCopy = $.extend({}, options, true); - $('#calendar').fullCalendar(options); - expect(options).toEqual(optionsCopy); - }); - - it('should not modify the events array', function() { - var options = { - defaultView: 'month', - defaultDate: '2014-05-27', - events: [ - { - title: 'mytitle', - start: '2014-05-27' - } - ] - }; - var optionsCopy = $.extend(true, {}, options); // recursive copy - $('#calendar').fullCalendar(options); - expect(options).toEqual(optionsCopy); - }); - - it('should not modify the eventSources array', function() { - var options = { - defaultView: 'month', - defaultDate: '2014-05-27', - eventSources: [ - { events: [ - { - title: 'mytitle', - start: '2014-05-27' - } - ] } - ] - }; - var optionsCopy = $.extend(true, {}, options); // recursive copy - $('#calendar').fullCalendar(options); - expect(options).toEqual(optionsCopy); - }); - - describe('when called on a div', function() { - - beforeEach(function() { - $('#calendar').fullCalendar(); - }); - - it('should contain a table fc-toolbar', function() { - var header = $('#calendar > .fc-toolbar'); - expect(header[0]).not.toBeUndefined(); - }); - - it('should contain a div fc-view-container', function() { - var content = ($('#calendar > .fc-view-container')); - expect(content[0]).not.toBeUndefined(); - }); - - it('should only contain 2 elements', function() { - var calenderNodeCount = $('#calendar >').length; - expect(calenderNodeCount).toEqual(2); - }); - - describe('and then called again', function() { - it('should still only have a single set of calendar [header,content]', function() { - $('#calendar').fullCalendar(); - var count = $('#calendar >').length; - expect(count).toEqual(2); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/contentHeight.js b/tests/automated/contentHeight.js deleted file mode 100644 index 590b399..0000000 --- a/tests/automated/contentHeight.js +++ /dev/null @@ -1,49 +0,0 @@ - -describe('contentHeight', function() { - - beforeEach(function() { - affix('#cal'); - $('#cal').width(900); - }); - - describe('when the default options are used', function() { - it('should set the height', function() { - $('#cal').width(1350); - $('#cal').fullCalendar(); - var height = $('.fc-content').height(); - expect(height).toEqual(1000); - }); - }); - - describe('when the content height is set', function() { - it('should set the content height', function() { - $('#cal').fullCalendar({ - contentHeight: 1000 - }); - var height = $('.fc-content').height(); - expect(height).toEqual(1000); - }); - it('should not change the container width', function() { - $('#cal').fullCalendar({ - contentHeight: 1000 - }); - var width = $('#cal').width(); - expect(width).toEqual(900); - }); - }); - - describe('when the content height setter is used', function() { - it('should set the content height', function() { - $('#cal').fullCalendar(); - $('#cal').fullCalendar('option', 'contentHeight', 1137); - var height = $('.fc-content').height(); - expect(height).toEqual(1137); - }); - it('should not change the container width', function() { - $('#cal').fullCalendar(); - $('#cal').fullCalendar('option', 'contentHeight', 1137); - var width = $('#cal').width(); - expect(width).toEqual(900); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/current-date.js b/tests/automated/current-date.js deleted file mode 100644 index a6e9f29..0000000 --- a/tests/automated/current-date.js +++ /dev/null @@ -1,290 +0,0 @@ -describe('current date', function() { - - var TITLE_FORMAT = 'MMMM D YYYY'; - var options; - - beforeEach(function() { - affix('#cal'); - options = { - titleFormat: TITLE_FORMAT, - defaultDate: '2014-06-01' - }; - }); - - describe('defaultDate & getDate', function() { - describeWhenInMonth(function() { - it('should initialize at the date', function() { - options.defaultDate = '2011-03-10'; - $('#cal').fullCalendar(options); - expectViewDates('2011-02-27', '2011-04-10', '2011-03-01'); - var currentDate = $('#cal').fullCalendar('getDate'); - expect(moment.isMoment(currentDate)).toEqual(true); // test the type, but only here - expect(currentDate).toEqualMoment('2011-03-10'); - }); - }); - describeWhenInWeek(function() { - it('should initialize at the date, given a date string', function() { - options.defaultDate = '2011-03-10'; - $('#cal').fullCalendar(options); - expectViewDates('2011-03-06', '2011-03-13'); - expect($('#cal').fullCalendar('getDate')).toEqualMoment('2011-03-10'); - }); - it('should initialize at the date, given a Moment object', function() { - options.defaultDate = $.fullCalendar.moment('2011-03-10'); - $('#cal').fullCalendar(options); - expectViewDates('2011-03-06', '2011-03-13'); - expect($('#cal').fullCalendar('getDate')).toEqualMoment('2011-03-10'); - }); - }); - describeWhenInDay(function() { - it('should initialize at the date', function() { - options.defaultDate = '2011-03-10'; - $('#cal').fullCalendar(options); - expectViewDates('2011-03-10'); - expect($('#cal').fullCalendar('getDate')).toEqualMoment('2011-03-10'); - }); - }); - }); - - describe('gotoDate', function() { - describeWhenInMonth(function() { - it('should go to a date when given a date string', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('gotoDate', '2015-04-01'); - expectViewDates('2015-03-29', '2015-05-10', '2015-04-01'); - }); - }); - describeWhenInWeek(function() { - it('should go to a date when given a date string', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('gotoDate', '2015-04-01'); - expectViewDates('2015-03-29', '2015-04-05'); - }); - it('should go to a date when given a date string with a time', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('gotoDate', '2015-04-01T12:00:00'); - expectViewDates('2015-03-29', '2015-04-05'); - }); - it('should go to a date when given a moment object', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('gotoDate', $.fullCalendar.moment('2015-04-01')); - expectViewDates('2015-03-29', '2015-04-05'); - }); - }); - describeWhenInDay(function() { - it('should go to a date when given a date string', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('gotoDate', '2015-04-01'); - expectViewDates('2015-04-01'); - }); - }); - }); - - describe('incrementDate', function() { - describeWhenInMonth(function() { - it('should increment the date when given a Duration object', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('incrementDate', { months: -1 }); - expectViewDates('2014-04-27', '2014-06-08', '2014-05-01'); - }); - }); - describeWhenInWeek(function() { - it('should increment the date when given a Duration object', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('incrementDate', { weeks: -2 }); - expectViewDates('2014-05-18', '2014-05-25'); - }); - }); - describeWhenInDay(function() { - it('should increment the date when given a Duration object', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('incrementDate', { days: 2 }); - expectViewDates('2014-06-03'); - }); - it('should increment the date when given a Duration string', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('incrementDate', '2.00:00:00'); - expectViewDates('2014-06-03'); - }); - it('should increment the date when given a Duration string with a time', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('incrementDate', '2.05:30:00'); - expectViewDates('2014-06-03'); - }); - }); - }); - - describe('prev', function() { - describeWhenInMonth(function() { - it('should move the calendar back a month', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prev'); - expectViewDates('2014-04-27', '2014-06-08', '2014-05-01'); - }); - }); - describeWhenInWeek(function() { - it('should move the calendar back a week', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prev'); - expectViewDates('2014-05-25', '2014-06-01'); - }); - }); - describeWhenInDay(function() { - it('should move the calendar back a week', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prev'); - expectViewDates('2014-05-31'); - }); - }); - }); - - describe('next', function() { - describeWhenInMonth(function() { - it('should move the calendar forward a month', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('next'); - expectViewDates('2014-06-29', '2014-08-10', '2014-07-01'); - }); - }); - describeWhenInWeek(function() { - it('should move the calendar forward a week', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('next'); - expectViewDates('2014-06-08', '2014-06-15'); - }); - }); - describeWhenInDay(function() { - it('should move the calendar forward a week', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('next'); - expectViewDates('2014-06-02'); - }); - }); - }); - - describe('prevYear', function() { - describeWhenInMonth(function() { - it('should move the calendar back a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prevYear'); - expectViewDates('2013-05-26', '2013-07-07', '2013-06-01'); - }); - }); - describeWhenInWeek(function() { - it('should move the calendar back a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prevYear'); - expectViewDates('2013-05-26', '2013-06-02'); - }); - }); - describeWhenInDay(function() { - it('should move the calendar back a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('prevYear'); - expectViewDates('2013-06-01'); - }); - }); - }); - - describe('nextYear', function() { - describeWhenInMonth(function() { - it('should move the calendar forward a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('nextYear'); - expectViewDates('2015-05-31', '2015-07-12', '2015-06-01'); - }); - }); - describeWhenInWeek(function() { - it('should move the calendar forward a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('nextYear'); - expectViewDates('2015-05-31', '2015-06-07'); - }); - }); - describeWhenInDay(function() { - it('should move the calendar forward a year', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('nextYear'); - expectViewDates('2015-06-01'); - }); - }); - }); - - describe('today', function() { - beforeEach(function() { - options.now = '2016-03-15'; // the "today" date - }); - describeWhenInMonth(function() { - it('should move the calendar to now', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('today'); - expectViewDates('2016-02-28', '2016-04-10', '2016-03-01'); - }); - }); - describeWhenInWeek(function() { - it('should move the calendar to now', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('today'); - expectViewDates('2016-03-13', '2016-03-20'); - }); - }); - describeWhenInDay(function() { - it('should move the calendar to now', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('today'); - expectViewDates('2016-03-15'); - }); - }); - }); - - - // UTILS - // ----- - - function describeWhenInMonth(func) { - describeWhenIn('month', func); - } - - function describeWhenInWeek(func) { - describeWhenIn('basicWeek', func); - describeWhenIn('agendaWeek', func); - } - - function describeWhenInDay(func) { - describeWhenIn('basicDay', func); - describeWhenIn('agendaDay', func); - } - - function describeWhenIn(viewName, func) { - describe('when in ' + viewName, function() { - beforeEach(function() { - options.defaultView = viewName; - }); - func(); - }); - } - - function expectViewDates(start, end, titleDate) { - var view = $('#cal').fullCalendar('getView'); - var calculatedEnd; - var title; - - start = $.fullCalendar.moment(start); - calculatedEnd = end ? $.fullCalendar.moment(end) : start.clone().add(1, 'days'); - expect(start).toEqualMoment(view.start); - expect(calculatedEnd).toEqualMoment(view.end); - - if (titleDate || !end) { - title = $.fullCalendar.moment(titleDate || start).format(TITLE_FORMAT); - } - else { - title = $.fullCalendar.formatRange( - start, - calculatedEnd.clone().add(-1, 'ms'), - TITLE_FORMAT - ); - } - expect($('.fc-toolbar h2')).toContainText(title); - } - -}); diff --git a/tests/automated/dayClick.js b/tests/automated/dayClick.js deleted file mode 100644 index 99d3c3e..0000000 --- a/tests/automated/dayClick.js +++ /dev/null @@ -1,144 +0,0 @@ -describe('dayClick', function() { - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-05-27', - selectable: false - }; - }); - - afterEach(function() { - $('#cal').fullCalendar('destroy'); - }); - - [ false, true ].forEach(function(isRTL) { - describe('when isRTL is ' + isRTL, function() { - beforeEach(function() { - options.isRTL = isRTL; - }); - [ false, true ].forEach(function(selectable) { - describe('when selectable is ' + selectable, function() { - beforeEach(function() { - options.selectable = selectable; - }); - - describe('when in month view', function() { - beforeEach(function() { - options.defaultView = 'month'; - }); - it('fires correctly when clicking on a cell', function(done) { - options.dayClick = function(date, jsEvent, view) { - expect(moment.isMoment(date)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(date.hasTime()).toEqual(false); - expect(date).toEqualMoment('2014-05-07'); - }; - spyOn(options, 'dayClick').and.callThrough(); - $('#cal').fullCalendar(options); - - var dayCell = $('.fc-day:eq(10)'); // 2014-05-07 (regardless of isRTL) - - // for simulating the mousedown/mouseup/click (relevant for selectable) - dayCell.simulate('drag-n-drop', { - callback: function() { - dayCell.simulate('click'); - expect(options.dayClick).toHaveBeenCalled(); - done(); - } - }); - }); - }); - - describe('when in agendaWeek view', function() { - beforeEach(function() { - options.defaultView = 'agendaWeek'; - }); - it('fires correctly when clicking on an all-day slot', function(done) { - options.dayClick = function(date, jsEvent, view) { - expect(moment.isMoment(date)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(date.hasTime()).toEqual(false); - expect(date).toEqualMoment('2014-05-28'); - }; - spyOn(options, 'dayClick').and.callThrough(); - $('#cal').fullCalendar(options); - - // 2014-05-28 (regardless of isRTL) - var dayContent = $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)'); - - // for simulating the mousedown/mouseup/click (relevant for selectable) - dayContent.simulate('drag-n-drop', { - callback: function() { - dayContent.simulate('click'); - expect(options.dayClick).toHaveBeenCalled(); - done(); - } - }); - }); - it('fires correctly when clicking on a timed slot', function(done) { - - // make sure the click slot will be in scroll view - options.contentHeight = 500; - options.scrollTime = '07:00:00'; - - options.dayClick = function(date, jsEvent, view) { - expect(moment.isMoment(date)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(date.hasTime()).toEqual(true); - expect(date).toEqualMoment('2014-05-28T09:00:00'); - }; - spyOn(options, 'dayClick').and.callThrough(); - $('#cal').fullCalendar(options); - - // the middle is 2014-05-28T09:00:00 (regardless of isRTL) - var slotRow = $('.fc-slats tr:eq(18) td:not(.fc-time)'); - - // for simulating the mousedown/mouseup/click (relevant for selectable) - slotRow.simulate('drag-n-drop', { - callback: function() { - expect(options.dayClick).toHaveBeenCalled(); - done(); - } - }); - }); - - // issue 2217 - it('fires correctly when clicking on a timed slot, with minTime set', function(done) { - - // make sure the click slot will be in scroll view - options.contentHeight = 500; - options.scrollTime = '07:00:00'; - options.minTime = '02:00:00'; - - options.dayClick = function(date, jsEvent, view) { - expect(moment.isMoment(date)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(date.hasTime()).toEqual(true); - expect(date).toEqualMoment('2014-05-28T11:00:00'); - }; - spyOn(options, 'dayClick').and.callThrough(); - $('#cal').fullCalendar(options); - - // the middle is 2014-05-28T11:00:00 (regardless of isRTL) - var slotRow = $('.fc-slats tr:eq(18) td:not(.fc-time)'); - - // for simulating the mousedown/mouseup/click (relevant for selectable) - slotRow.simulate('drag-n-drop', { - callback: function() { - expect(options.dayClick).toHaveBeenCalled(); - done(); - } - }); - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/dayNames.js b/tests/automated/dayNames.js deleted file mode 100644 index b68d439..0000000 --- a/tests/automated/dayNames.js +++ /dev/null @@ -1,94 +0,0 @@ -describe('day names', function() { - var settings = {}; - var testableClasses = [ - 'basicDay', - 'agendaDay' - ]; - var dayClasses = [ - '.fc-sun', - '.fc-mon', - '.fc-tue', - '.fc-wed', - '.fc-thu', - '.fc-fri', - '.fc-sat' - ]; - var referenceDate = '2014-05-25 06:00'; // A sunday - var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]; - - beforeEach(function() { - affix('#cal'); - settings = { - now: moment(referenceDate).toISOString() - }; - }); - - afterEach(function() { - moment.lang('en'); // reset moment's global language - }); - - testableClasses.forEach(function(viewClass, index, viewClasses) { - describe('when view is basicDay', function() { - beforeEach(function() { - settings.defaultView = 'basicDay'; - }); - - describe('when lang is default', function() { - beforeEach(function() { - settings.lang = 'en'; - }); - - dayClasses.forEach(function(cls, index, classes) { - var weekdays = moment.weekdays(); - it('should be ' + weekdays[index], function() { - settings.now = moment(referenceDate).add(index, 'days'); - $('#cal').fullCalendar(settings); - - expect($('.fc-view thead ' + dayClasses[index])).toHaveText(weekdays[index]); - }); - }); - }); - - $.each(languages, function(index, language) { - describe('when lang is ' + language, function() { - beforeEach(function() { - moment.lang(language); - }); - - dayClasses.forEach(function(cls, index, classes) { - it('should be the translation for ' + moment.weekdays()[index], function() { - settings.lang = language; - settings.now = moment(referenceDate).add(index, 'days'); - $('#cal').fullCalendar(settings); - - expect($('.fc-view thead ' + dayClasses[index])).toHaveText(moment.weekdays()[index]); - }); - }); - }); - }); - - describe('when daynames are specified', function() { - var weekdays = [ - 'Hovjaj', - 'maSjaj', - 'veSjaj', - 'mechjaj', - 'jevjaj', - 'parmaqjaj', - 'HoSjaj' - ]; - - dayClasses.forEach(function(cls, idx, classes) { - it('should be ' + weekdays[idx], function() { - settings.dayNames = [].slice.call(weekdays); // copy. in case there is a mutation - settings.now = moment(referenceDate).add(idx, 'days'); - - $('#cal').fullCalendar(settings); - - expect($('.fc-view thead ' + cls)).toHaveText(weekdays[idx]); - }); - }); - }); - }); - }); -}); diff --git a/tests/automated/dayNamesShort.js b/tests/automated/dayNamesShort.js deleted file mode 100644 index a17805d..0000000 --- a/tests/automated/dayNamesShort.js +++ /dev/null @@ -1,78 +0,0 @@ -describe('short day names', function() { - var settings = {}; - var testableClasses = [ - 'month', - 'agendaWeek', - 'basicWeek' - ]; - var dayClasses = [ - '.fc-sun', - '.fc-mon', - '.fc-tue', - '.fc-wed', - '.fc-thu', - '.fc-fri', - '.fc-sat' - ]; - var languages = [ 'es', 'fr', 'de', 'zh-cn', 'es' ]; - - beforeEach(function() { - affix('#cal'); - settings = { }; - }); - - afterEach(function() { - moment.lang('en'); // reset moment's global language - }); - - testableClasses.forEach(function(viewClass, index, viewClasses) { - describe('when view is ' + viewClass, function() { - beforeEach(function() { - settings.defaultView = viewClass; - }); - - describe('when lang is default', function() { - it('should be in English', function() { - moment.lang('en'); - $('#cal').fullCalendar(settings); - var weekdays = moment.weekdaysShort(); - - dayClasses.forEach(function(cls, index, classes) { - expect($('.fc-view thead ' + cls)[0]).toContainText(weekdays[index]); - }); - }); - }); - - describe('when lang is not default', function() { - languages.forEach(function(language, index, languages) { - it('should be in the selected language', function() { - settings.lang = language; - $('#cal').fullCalendar(settings); - - moment.lang(language); - var dow = moment.langData(language)._week.dow; - var weekdays = moment.weekdaysShort(); - - dayClasses.forEach(function(cls, index, classes) { - expect($('.fc-view thead ' + cls)[0]).toContainText(weekdays[index]); - }); - }); - }); - }); - - describe('when specified', function() { - it('should contain the specified names in the given order', function() { - var days = [ - 'Hov.', 'maS.', 'veS.', 'mech.', 'parmaq.', 'HoS.' - ]; - settings.dayNamesShort = days; - $('#cal').fullCalendar(settings); - - dayClasses.forEach(function(cls, index, classes) { - expect($('.fc-view thead ' + cls)[0]).toContainText(days[index]); - }); - }); - }); - }); - }); -}); diff --git a/tests/automated/dayRender.js b/tests/automated/dayRender.js deleted file mode 100644 index 35b4371..0000000 --- a/tests/automated/dayRender.js +++ /dev/null @@ -1,86 +0,0 @@ - -describe('dayRender', function() { - - beforeEach(function() { - affix('#cal'); - }); - - it('is triggered upon initialization of a view, with correct parameters', function() { - var options = { - defaultView: 'month', - weekMode: 'fixed', - defaultDate: '2014-05-01', - dayRender: function(date, cell) { - expect(moment.isMoment(date)).toEqual(true); - expect(date.hasTime()).toEqual(false); - expect(date.format()).toEqual(cell.data('date')); - expect(cell).toBeInDOM(); - } - }; - - spyOn(options, 'dayRender').and.callThrough(); - $('#cal').fullCalendar(options); - expect(options.dayRender.calls.count()).toEqual(42); - }); - - it('is called when view is changed', function() { - var options = { - defaultView: 'month', - weekMode: 'fixed', - defaultDate: '2014-05-01', - dayRender: function(date, cell) { } - }; - - spyOn(options, 'dayRender').and.callThrough(); - $('#cal').fullCalendar(options); - options.dayRender.calls.reset(); - $('#cal').fullCalendar('changeView', 'basicWeek'); - expect(options.dayRender.calls.count()).toEqual(7); - }); - - // called if the date is navigated to a different visible range - it('is called when view is changed', function() { - var options = { - defaultView: 'basicWeek', - defaultDate: '2014-05-01', - dayRender: function(date, cell) { } - }; - - spyOn(options, 'dayRender').and.callThrough(); - $('#cal').fullCalendar(options); - options.dayRender.calls.reset(); - $('#cal').fullCalendar('gotoDate', '2014-05-04'); // a day in the next week - expect(options.dayRender.calls.count()).toEqual(7); - }); - - it('won\'t be called when date is navigated but remains in the current visible range', function() { - var options = { - defaultView: 'basicWeek', - defaultDate: '2014-05-01', - dayRender: function(date, cell) { } - }; - - spyOn(options, 'dayRender').and.callThrough(); - $('#cal').fullCalendar(options); - options.dayRender.calls.reset(); - $('#cal').fullCalendar('gotoDate', '2014-05-02'); // a day in the same week - expect(options.dayRender.calls.count()).toEqual(0); - }); - - it('allows you to modify the element', function() { - var options = { - defaultView: 'month', - weekMode: 'fixed', - defaultDate: '2014-05-01', - dayRender: function(date, cell) { - if (date.isSame('2014-05-01')) { - cell.addClass('mycustomclass'); - } - } - }; - - $('#cal').fullCalendar(options); - expect($('#cal td[data-date="2014-05-01"]')).toHaveClass('mycustomclass'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/defaultAllDayEventDuration.js b/tests/automated/defaultAllDayEventDuration.js deleted file mode 100644 index c2914e9..0000000 --- a/tests/automated/defaultAllDayEventDuration.js +++ /dev/null @@ -1,87 +0,0 @@ -describe('defaultAllDayEventDuration', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - }); - - describe('when forceEventDuration is on', function() { - - beforeEach(function() { - options.forceEventDuration = true; - }); - - it('correctly calculates an unspecified end when using a Duration object input', function() { - options.defaultAllDayEventDuration = { days: 2 }; - options.events = [ - { - allDay: true, - start: '2014-05-05' - } - ]; - $('#cal').fullCalendar(options); - var event = $('#cal').fullCalendar('clientEvents')[0]; - expect(event.end).toEqualMoment('2014-05-07'); - }); - - it('correctly calculates an unspecified end when using a string Duration input', function() { - options.defaultAllDayEventDuration = '3.00:00:00'; - options.events = [ - { - allDay: true, - start: '2014-05-05' - } - ]; - $('#cal').fullCalendar(options); - var event = $('#cal').fullCalendar('clientEvents')[0]; - expect(event.end).toEqualMoment('2014-05-08'); - }); - }); - - describe('when forceEventDuration is off', function() { - - beforeEach(function() { - options.forceEventDuration = false; - }); - - [ 'basicWeek', 'agendaWeek' ].forEach(function(viewName) { // because they render all-day events in similar ways - describe('with ' + viewName + ' view', function() { - beforeEach(function() { - options.defaultView = viewName; - }); - it('renders an all-day event with no `end` to appear to have the default duration', function(done) { - options.defaultAllDayEventDuration = { days: 2 }; - options.events = [ - { - // a control. so we know how wide it should be - title: 'control event', - allDay: true, - start: '2014-04-28', - end: '2014-04-30' - }, - { - // one day after the control. no specified end - title: 'test event', - allDay: true, - start: '2014-04-28' - } - ]; - options.eventAfterAllRender = function() { - var eventElms = $('#cal .fc-event'); - var width0 = eventElms.eq(0).outerWidth(); - var width1 = eventElms.eq(1).outerWidth(); - expect(width0).toEqual(width1); - done(); - }; - $('#cal').fullCalendar(options); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/defaultTimedEventDuration.js b/tests/automated/defaultTimedEventDuration.js deleted file mode 100644 index 5c2484c..0000000 --- a/tests/automated/defaultTimedEventDuration.js +++ /dev/null @@ -1,117 +0,0 @@ -describe('defaultTimedEventDuration', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - }); - - describe('when forceEventDuration is on', function() { - - beforeEach(function() { - options.forceEventDuration = true; - }); - - it('correctly calculates an unspecified end when using a Duration object input', function() { - options.defaultTimedEventDuration = { hours: 2, minutes: 30 }; - options.events = [ - { - allDay: false, - start: '2014-05-05T04:00:00' - } - ]; - $('#cal').fullCalendar(options); - var event = $('#cal').fullCalendar('clientEvents')[0]; - expect(event.end).toEqualMoment('2014-05-05T06:30:00'); - }); - - it('correctly calculates an unspecified end when using a string Duration input', function() { - options.defaultTimedEventDuration = '03:15:00'; - options.events = [ - { - allDay: false, - start: '2014-05-05T04:00:00' - } - ]; - $('#cal').fullCalendar(options); - var event = $('#cal').fullCalendar('clientEvents')[0]; - expect(event.end).toEqualMoment('2014-05-05T07:15:00'); - }); - }); - - describe('when forceEventDuration is off', function() { - - beforeEach(function() { - options.forceEventDuration = false; - }); - - describe('with agendaWeek view', function() { - beforeEach(function() { - options.defaultView = 'agendaWeek'; - }); - it('renders a timed event with no `end` to appear to have the default duration', function(done) { - options.defaultTimedEventDuration = '01:15:00'; - options.events = [ - { - // a control. so we know how tall it should be - title: 'control event', - allDay: false, - start: '2014-05-01T04:00:00', - end: '2014-05-01T05:15:00' - }, - { - // one day after the control. no specified end - title: 'test event', - allDay: false, - start: '2014-05-02T04:00:00' - } - ]; - options.eventAfterAllRender = function() { - var eventElms = $('#cal .fc-event'); - var height0 = eventElms.eq(0).outerHeight(); - var height1 = eventElms.eq(1).outerHeight(); - expect(height0).toEqual(height1); - done(); - }; - $('#cal').fullCalendar(options); - }); - }); - - describe('with basicWeek view', function() { - beforeEach(function() { - options.defaultView = 'basicWeek'; - }); - it('renders a timed event with no `end` to appear to have the default duration', function(done) { - options.defaultTimedEventDuration = { days: 2 }; - options.events = [ - { - // a control. so we know how wide it should be - title: 'control event', - allDay: false, - start: '2014-04-28T04:00:00', - end: '2014-04-30T00:00:00' - }, - { - // one day after the control. no specified end - title: 'test event', - allDay: false, - start: '2014-04-28T04:00:00' - } - ]; - options.eventAfterAllRender = function() { - var eventElms = $('#cal .fc-event'); - var width0 = eventElms.eq(0).outerWidth(); - var width1 = eventElms.eq(1).outerWidth(); - expect(width0).toEqual(width1); - done(); - }; - $('#cal').fullCalendar(options); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/event-dnd.js b/tests/automated/event-dnd.js deleted file mode 100644 index facbbf7..0000000 --- a/tests/automated/event-dnd.js +++ /dev/null @@ -1,32 +0,0 @@ - -// can't do event dragging yet. -// need to work out how fullCalendar is intercepting events. -/* -xdescribe('when event is dragged from one cell to another', function() { - it('should move to the new cell', function() { - var eventName = 'xyzAllDayEvent'; - $('#calendar').fullCalendar({ - editable: true - }); - $('#calendar').fullCalendar('addEventSource', { - events: [ - { - title: eventName, - start: new Date() - } - ] - }); - var el = $('div .fc-event'); - var offsetBefore = el.offset(); - dump(offsetBefore); - var options = { - dx: 200, - dy: 0, - moves: 10, - handle: 'corner' - }; - el.simulate('drag', options); - dump(el.offset()); - }); -}); -*/ \ No newline at end of file diff --git a/tests/automated/event-feed-param.js b/tests/automated/event-feed-param.js deleted file mode 100644 index f04b76a..0000000 --- a/tests/automated/event-feed-param.js +++ /dev/null @@ -1,72 +0,0 @@ -describe('event feed params', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - - $.mockjax({ - url: '*', - contentType: 'text/json', - responseText: [ - { - title: 'my event', - start: '2014-05-21' - } - ] - }); - $.mockjaxSettings.log = function() { }; // don't console.log - }); - - afterEach(function() { - $.mockjaxClear(); - }); - - it('utilizes custom startParam, endParam, and timezoneParam names', function() { - options.events = 'my-feed.php'; - options.timezone = 'America/Los_Angeles'; - options.startParam = 'mystart'; - options.endParam = 'myend'; - options.timezoneParam = 'currtz'; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toBeUndefined(); - expect(request.data.end).toBeUndefined(); - expect(request.data.timezone).toBeUndefined(); - expect(request.data.mystart).toEqual('2014-04-27'); - expect(request.data.myend).toEqual('2014-06-08'); - expect(request.data.currtz).toEqual('America/Los_Angeles'); - }); - - it('utilizes event-source-specific startParam, endParam, and timezoneParam names', function() { - options.timezone = 'America/Los_Angeles'; - options.startParam = 'mystart'; - options.endParam = 'myend'; - options.timezoneParam = 'currtz'; - options.eventSources = [ - { - url: 'my-feed.php', - startParam: 'feedstart', - endParam: 'feedend', - timezoneParam: 'feedctz' - } - ]; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toBeUndefined(); - expect(request.data.end).toBeUndefined(); - expect(request.data.timezone).toBeUndefined(); - expect(request.data.mystart).toBeUndefined(); - expect(request.data.myend).toBeUndefined(); - expect(request.data.currtz).toBeUndefined(); - expect(request.data.feedstart).toEqual('2014-04-27'); - expect(request.data.feedend).toEqual('2014-06-08'); - expect(request.data.feedctz).toEqual('America/Los_Angeles'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/event-obj.js b/tests/automated/event-obj.js deleted file mode 100644 index 7715aef..0000000 --- a/tests/automated/event-obj.js +++ /dev/null @@ -1,109 +0,0 @@ -describe('event object creation', function() { - - /* - - NOTE: Where possible, if there is a specific option that affects event object creation - behavior, write your tests in the individual file for that option, instead of here. - Examples of this: - allDayDefault (tests allDay guessing behavior too) - eventDataTransform - forceEventDuration - - */ - - var event; - - beforeEach(function() { - affix('#cal'); - event = null; - }); - - function init(singleEventData) { - $('#cal').fullCalendar({ - events: [ singleEventData ] - }); - event = $('#cal').fullCalendar('clientEvents')[0]; - } - - it('accepts `date` property as alias for `start`', function() { - init({ - date: '2014-05-05' - }); - expect(moment.isMoment(event.start)).toEqual(true); - expect(event.start).toEqualMoment('2014-05-05'); - }); - - it('doesn\'t produce an event when an invalid start', function() { - init({ - start: new Date('asdf') // we use Date constructor to avoid annoying momentjs warning - }); - expect(event).toBeUndefined(); - }); - - it('doesn\'t produce an event when an invalid end', function() { - init({ - end: new Date('asdf') // we use Date constructor to avoid annoying momentjs warning - }); - expect(event).toBeUndefined(); - }); - - it('strips times of dates when event is all-day', function() { - init({ - start: '2014-05-01T01:00:00-12:00', - end: '2014-05-02T01:00:00+12:00', - allDay: true - }); - expect(event.start.hasTime()).toEqual(false); - expect(event.start).toEqualMoment('2014-05-01'); - expect(event.end.hasTime()).toEqual(false); - expect(event.end).toEqualMoment('2014-05-02'); - }); - - it('gives 00:00 times to ambiguously-timed dates when event is timed', function() { - init({ - start: '2014-05-01', - end: '2014-05-03', - allDay: false - }); - expect(event.start.hasTime()).toEqual(true); - expect(event.start).toEqualMoment('2014-05-01T00:00:00'); - expect(event.end.hasTime()).toEqual(true); - expect(event.end).toEqualMoment('2014-05-03T00:00:00'); - }); - - it('sets the source', function() { - init({ - start: '2014-05-01' - }); - expect(typeof event.source).toEqual('object'); - }); - - it('accepts an array `className`', function() { - init({ - start: '2014-05-01', - className: [ 'class1', 'class2' ] - }); - expect($.isArray(event.className)).toEqual(true); - expect(event.className).toEqual([ 'class1', 'class2' ]); - }); - - it('accepts a string `className`', function() { - init({ - start: '2014-05-01', - className: 'class1 class2' - }); - expect($.isArray(event.className)).toEqual(true); - expect(event.className).toEqual([ 'class1', 'class2' ]); - }); - - it('copies over custom properties', function() { - init({ - start: '2014-05-01', - prop1: 'prop1val', - prop2: [ 'a', 'b' ] - }); - expect(event.prop1).toEqual('prop1val'); - expect(event.prop2).toEqual([ 'a', 'b' ]); - }); - -}); \ No newline at end of file diff --git a/tests/automated/events-array.js b/tests/automated/events-array.js deleted file mode 100644 index be4b933..0000000 --- a/tests/automated/events-array.js +++ /dev/null @@ -1,57 +0,0 @@ - -describe('events as an array', function() { - - var options; - var eventArray; - - beforeEach(function() { - affix('#cal'); - options = { - defaultView: 'month', - defaultDate: '2014-05-01' - }; - eventArray = [ - { - title: 'my event', - start: '2014-05-21' - } - ]; - }); - - it('accepts an event using basic form', function(done) { - options.events = eventArray; - options.eventRender = function(eventObj, eventElm) { - expect(eventObj.title).toEqual('my event'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('accepts an event using extended form', function(done) { - options.eventSources = [ - { - className: 'customeventclass', - events: eventArray - } - ]; - options.eventRender = function(eventObj, eventElm) { - expect(eventObj.title).toEqual('my event'); - expect(eventElm).toHaveClass('customeventclass'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('doesn\'t mutate the original array', function(done) { - var origArray = eventArray; - var origEvent = eventArray[0]; - options.events = eventArray; - options.eventRender = function(eventObj, eventElm) { - expect(origArray).toEqual(eventArray); - expect(origEvent).toEqual(eventArray[0]); - done(); - }; - $('#cal').fullCalendar(options); - }); - -}); diff --git a/tests/automated/events-function.js b/tests/automated/events-function.js deleted file mode 100644 index b1cc459..0000000 --- a/tests/automated/events-function.js +++ /dev/null @@ -1,134 +0,0 @@ - -describe('events as a function', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultView: 'month', - defaultDate: '2014-05-01' - }; - }); - - it('requests correctly when no timezone', function(done) { - options.events = function(start, end, timezone, callback) { - expect(moment.isMoment(start)).toEqual(true); - expect(start.hasTime()).toEqual(false); - expect(start.hasZone()).toEqual(false); - expect(start.format()).toEqual('2014-04-27'); - expect(moment.isMoment(end)).toEqual(true); - expect(end.hasTime()).toEqual(false); - expect(end.hasZone()).toEqual(false); - expect(end.format()).toEqual('2014-06-08'); - expect(timezone).toEqual(false); - expect(typeof callback).toEqual('function'); - callback([]); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('requests correctly when local timezone', function(done) { - options.timezone = 'local'; - options.events = function(start, end, timezone, callback) { - expect(moment.isMoment(start)).toEqual(true); - expect(start.hasTime()).toEqual(false); - expect(start.hasZone()).toEqual(false); - expect(start.format()).toEqual('2014-04-27'); - expect(moment.isMoment(end)).toEqual(true); - expect(end.hasTime()).toEqual(false); - expect(end.hasZone()).toEqual(false); - expect(end.format()).toEqual('2014-06-08'); - expect(timezone).toEqual('local'); - expect(typeof callback).toEqual('function'); - callback([]); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('requests correctly when UTC timezone', function(done) { - options.timezone = 'UTC'; - options.events = function(start, end, timezone, callback) { - expect(moment.isMoment(start)).toEqual(true); - expect(start.hasTime()).toEqual(false); - expect(start.hasZone()).toEqual(false); - expect(start.format()).toEqual('2014-04-27'); - expect(moment.isMoment(end)).toEqual(true); - expect(end.hasTime()).toEqual(false); - expect(end.hasZone()).toEqual(false); - expect(end.format()).toEqual('2014-06-08'); - expect(timezone).toEqual('UTC'); - expect(typeof callback).toEqual('function'); - callback([]); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('requests correctly when custom timezone', function(done) { - options.timezone = 'America/Chicago'; - options.events = function(start, end, timezone, callback) { - expect(moment.isMoment(start)).toEqual(true); - expect(start.hasTime()).toEqual(false); - expect(start.hasZone()).toEqual(false); - expect(start.format()).toEqual('2014-04-27'); - expect(moment.isMoment(end)).toEqual(true); - expect(end.hasTime()).toEqual(false); - expect(end.hasZone()).toEqual(false); - expect(end.format()).toEqual('2014-06-08'); - expect(timezone).toEqual('America/Chicago'); - expect(typeof callback).toEqual('function'); - callback([]); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('requests correctly with event source extended form', function(done) { - var eventSource = { - className: 'customeventclass', - events: function(start, end, timezone, callback) { - expect(moment.isMoment(start)).toEqual(true); - expect(start.hasTime()).toEqual(false); - expect(start.hasZone()).toEqual(false); - expect(start.format()).toEqual('2014-04-27'); - expect(moment.isMoment(end)).toEqual(true); - expect(end.hasTime()).toEqual(false); - expect(end.hasZone()).toEqual(false); - expect(end.format()).toEqual('2014-06-08'); - expect(timezone).toEqual(false); - expect(typeof callback).toEqual('function'); - callback([ - { - title: 'event1', - start: '2014-05-10' - } - ]); - } - }; - spyOn(eventSource, 'events').and.callThrough(); - options.eventSources = [ eventSource ]; - options.eventRender = function(eventObj, eventElm) { - expect(eventSource.events.calls.count()).toEqual(1); - expect(eventElm).toHaveClass('customeventclass'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('requests the correct dates when days at the start/end of the month are hidden', function(done) { - options.currentView = 'month'; - options.defaultDate = '2013-06-01'; // June 2013 has first day as Saturday, and last as Sunday! - options.weekends = false; - options.weekMode = 'variable'; - options.events = function(start, end, timezone, callback) { - expect(start).toEqualMoment('2013-06-03'); - expect(end).toEqualMoment('2013-06-29'); - done(); - }; - $('#cal').fullCalendar(options); - }); - -}); diff --git a/tests/automated/events-gcal.js b/tests/automated/events-gcal.js deleted file mode 100644 index ea2b329..0000000 --- a/tests/automated/events-gcal.js +++ /dev/null @@ -1,117 +0,0 @@ - -describe('Google Calendar plugin', function() { - - var options; - var currentRequest; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultView: 'month', - defaultDate: '2014-05-01', - events: 'http://www.google.com/calendar/feeds/notarealfeed/public/basic' - }; - - // workaround. wanted to use mockedAjaxCalls(), but JSONP requests get mangled later on - currentRequest = null; - $.mockjaxSettings.log = function(mockHandler, request) { - currentRequest = currentRequest || $.extend({}, request); // copy - }; - - // fake the JSONP call (which actually calls to /full) - $.mockjax({ - url: 'http://www.google.com/calendar/feeds/notarealfeed/public/*', - responseText: JSON.parse( - '{"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch"' + - ':"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gCal":"http://schemas.google.com/gCal/2005","xmlns' + - '$gd":"http://schemas.google.com/g/2005","id":{"$t":"http://www.google.com/calendar/feeds/usa__en%40h' + - 'oliday.calendar.google.com/public/full"},"updated":{"$t":"2014-05-22T13:00:40.000Z"},"category":[{"s' + - 'cheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"ti' + - 'tle":{"$t":"Holidays in United States","type":"text"},"subtitle":{"$t":"Holidays and Observances in ' + - 'United States","type":"text"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.googl' + - 'e.com/calendar/embed?src=usa__en%40holiday.calendar.google.com"},{"rel":"http://schemas.google.com/g' + - '/2005#feed","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/usa__en%40hol' + - 'iday.calendar.google.com/public/full"},{"rel":"http://schemas.google.com/g/2005#batch","type":"appli' + - 'cation/atom+xml","href":"http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/' + - 'public/full/batch"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calend' + - 'ar/feeds/usa__en%40holiday.calendar.google.com/public/full?alt=json-in-script&max-results=9999&start' + - '-min=2014-04-27T00%3A00%3A00Z&singleevents=true&start-max=2014-06-08T00%3A00%3A00Z"}],"author":[{"na' + - 'me":{"$t":"Holidays in United States"}}],"generator":{"$t":"Google Calendar","version":"1.0","uri":"' + - 'http://www.google.com/calendar"},"openSearch$totalResults":{"$t":2},"openSearch$startIndex":{"$t":1}' + - ',"openSearch$itemsPerPage":{"$t":9999},"gCal$timezone":{"value":"UTC"},"gCal$timesCleaned":{"value":' + - '0},"entry":[{"id":{"$t":"http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/' + - 'public/full/20140511_60o30dr560o30e1g60o30dr4ck"},"published":{"$t":"2014-05-22T13:00:40.000Z"},"upd' + - 'ated":{"$t":"2014-05-22T13:00:40.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind' + - '","term":"http://schemas.google.com/g/2005#event"}],"title":{"$t":"Mothers Day","type":"text"},"cont' + - 'ent":{"$t":"","type":"text"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google' + - '.com/calendar/event?eid=MjAxNDA1MTFfNjBvMzBkcjU2MG8zMGUxZzYwbzMwZHI0Y2sgdXNhX19lbkBo","title":"alter' + - 'nate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/usa_' + - '_en%40holiday.calendar.google.com/public/full/20140511_60o30dr560o30e1g60o30dr4ck"}],"author":[{"nam' + - 'e":{"$t":"Holidays in United States"}}],"gd$comments":{"gd$feedLink":{"href":"http://www.google.com/' + - 'calendar/feeds/usa__en%40holiday.calendar.google.com/public/full/20140511_60o30dr560o30e1g60o30dr4ck' + - '/comments"}},"gd$eventStatus":{"value":"http://schemas.google.com/g/2005#event.confirmed"},"gd$where' + - '":[{}],"gd$who":[{"email":"usa__en@holiday.calendar.google.com","rel":"http://schemas.google.com/g/2' + - '005#event.organizer","valueString":"Holidays in United States"}],"gd$when":[{"endTime":"2014-05-12",' + - '"startTime":"2014-05-11"}],"gd$transparency":{"value":"http://schemas.google.com/g/2005#event.transp' + - 'arent"},"gCal$anyoneCanAddSelf":{"value":"false"},"gCal$guestsCanInviteOthers":{"value":"true"},"gCa' + - 'l$guestsCanModify":{"value":"false"},"gCal$guestsCanSeeGuests":{"value":"true"},"gCal$sequence":{"va' + - 'lue":0},"gCal$uid":{"value":"20140511_60o30dr560o30e1g60o30dr4ck@google.com"}},{"id":{"$t":"http://w' + - 'ww.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/full/20140526_60o30dr56co3' + - '0e1g60o30dr4ck"},"published":{"$t":"2014-05-22T13:00:40.000Z"},"updated":{"$t":"2014-05-22T13:00:40.' + - '000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.c' + - 'om/g/2005#event"}],"title":{"$t":"Memorial Day","type":"text"},"content":{"$t":"","type":"text"},"li' + - 'nk":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid=MjAxNDA1' + - 'MjZfNjBvMzBkcjU2Y28zMGUxZzYwbzMwZHI0Y2sgdXNhX19lbkBo","title":"alternate"},{"rel":"self","type":"app' + - 'lication/atom+xml","href":"http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.co' + - 'm/public/full/20140526_60o30dr56co30e1g60o30dr4ck"}],"author":[{"name":{"$t":"Holidays in United Sta' + - 'tes"}}],"gd$comments":{"gd$feedLink":{"href":"http://www.google.com/calendar/feeds/usa__en%40holiday' + - '.calendar.google.com/public/full/20140526_60o30dr56co30e1g60o30dr4ck/comments"}},"gd$eventStatus":{"' + - 'value":"http://schemas.google.com/g/2005#event.confirmed"},"gd$where":[{}],"gd$who":[{"email":"usa__' + - 'en@holiday.calendar.google.com","rel":"http://schemas.google.com/g/2005#event.organizer","valueStrin' + - 'g":"Holidays in United States"}],"gd$when":[{"endTime":"2014-05-27","startTime":"2014-05-26"}],"gd$t' + - 'ransparency":{"value":"http://schemas.google.com/g/2005#event.transparent"},"gCal$anyoneCanAddSelf":' + - '{"value":"false"},"gCal$guestsCanInviteOthers":{"value":"true"},"gCal$guestsCanModify":{"value":"fal' + - 'se"},"gCal$guestsCanSeeGuests":{"value":"true"},"gCal$sequence":{"value":0},"gCal$uid":{"value":"201' + - '40526_60o30dr56co30e1g60o30dr4ck@google.com"}}]}}' - ) - }); - }); - - afterEach(function() { - $.mockjaxClear(); - $.mockjaxSettings.log = function() { }; - }); - - it('sends request correctly when no timezone', function() { - $('#cal').fullCalendar(options); - expect(currentRequest.data['start-min']).toEqual('2014-04-27'); - expect(currentRequest.data['start-max']).toEqual('2014-06-08'); - expect(currentRequest.data.ctz).toBeUndefined(); - }); - - it('sends request correctly when local timezone', function() { - options.timezone = 'local'; - $('#cal').fullCalendar(options); - expect(currentRequest.data['start-min']).toEqual('2014-04-27'); - expect(currentRequest.data['start-max']).toEqual('2014-06-08'); - expect(currentRequest.data.ctz).toBeUndefined(); - }); - - it('sends request correctly when UTC timezone', function() { - options.timezone = 'UTC'; - $('#cal').fullCalendar(options); - expect(currentRequest.data['start-min']).toEqual('2014-04-27'); - expect(currentRequest.data['start-max']).toEqual('2014-06-08'); - expect(currentRequest.data.ctz).toEqual('UTC'); - }); - - it('sends request correctly when custom timezone', function() { - options.timezone = 'America/Chicago'; - $('#cal').fullCalendar(options); - expect(currentRequest.data['start-min']).toEqual('2014-04-27'); - expect(currentRequest.data['start-max']).toEqual('2014-06-08'); - expect(currentRequest.data.ctz).toEqual('America/Chicago'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/events-json-feed.js b/tests/automated/events-json-feed.js deleted file mode 100644 index 86e056a..0000000 --- a/tests/automated/events-json-feed.js +++ /dev/null @@ -1,122 +0,0 @@ - -describe('events as a json feed', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - - $.mockjax({ - url: '*', - contentType: 'text/json', - responseText: [ - { - title: 'my event', - start: '2014-05-21' - } - ] - }); - $.mockjaxSettings.log = function() { }; // don't console.log - }); - - afterEach(function() { - $.mockjaxClear(); - }); - - it('requests correctly when no timezone', function() { - options.events = 'my-feed.php'; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toEqual('2014-04-27'); - expect(request.data.end).toEqual('2014-06-08'); - expect(request.data.timezone).toBeUndefined(); - }); - - it('requests correctly when local timezone', function() { - options.events = 'my-feed.php'; - options.timezone = 'local'; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toEqual('2014-04-27'); - expect(request.data.end).toEqual('2014-06-08'); - expect(request.data.timezone).toBeUndefined(); - }); - - it('requests correctly when UTC timezone', function() { - options.events = 'my-feed.php'; - options.timezone = 'UTC'; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toEqual('2014-04-27'); - expect(request.data.end).toEqual('2014-06-08'); - expect(request.data.timezone).toEqual('UTC'); - }); - - it('requests correctly when custom timezone', function() { - options.events = 'my-feed.php'; - options.timezone = 'America/Chicago'; - $('#cal').fullCalendar(options); - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toEqual('2014-04-27'); - expect(request.data.end).toEqual('2014-06-08'); - expect(request.data.timezone).toEqual('America/Chicago'); - }); - - it('requests correctly with event source extended form', function(done) { - var eventSource = { - url: 'my-feed.php', - className: 'customeventclass' - }; - options.eventSources = [ eventSource ]; - options.timezone = 'America/Chicago'; - options.eventRender = function(eventObj, eventElm) { - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.start).toEqual('2014-04-27'); - expect(request.data.end).toEqual('2014-06-08'); - expect(request.data.timezone).toEqual('America/Chicago'); - expect(eventElm).toHaveClass('customeventclass'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('accepts jQuery.ajax params', function(done) { - var eventSource = { - url: 'my-feed.php', - data: { - customParam: 'yes' - }, - success: function() { - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.customParam).toMatch('yes'); - done(); - } - }; - options.eventSources = [ eventSource ]; - $('#cal').fullCalendar(options); - }); - - it('accepts a dynamic data function', function(done) { - var eventSource = { - url: 'my-feed.php', - data: function() { - return { - customParam: 'heckyeah' - }; - } - }; - options.eventSources = [ eventSource ]; - options.eventAfterAllRender = function() { - var request = $.mockjax.mockedAjaxCalls()[0]; - expect(request.data.customParam).toMatch('heckyeah'); - done(); - }; - $('#cal').fullCalendar(options); - }); - -}); diff --git a/tests/automated/firstDay.js b/tests/automated/firstDay.js deleted file mode 100644 index 0773fe7..0000000 --- a/tests/automated/firstDay.js +++ /dev/null @@ -1,201 +0,0 @@ - -describe('First Day', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when using default settings', function() { - beforeEach(function() { - $('#cal').fullCalendar(); - }); - it('should make Sunday the first day of the week', function() { - var dayFirst = $('.fc-day-header')[0]; - expect(dayFirst).toHaveClass('fc-sun'); - }); - }); - - describe('when setting firstDay to 0', function() { - beforeEach(function() { - var options = { - firstDay: 0 - }; - $('#cal').fullCalendar(options); - }); - it('should make Sunday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-sun'); - expect(daysOfWeek[1]).toHaveClass('fc-mon'); - expect(daysOfWeek[2]).toHaveClass('fc-tue'); - expect(daysOfWeek[3]).toHaveClass('fc-wed'); - expect(daysOfWeek[4]).toHaveClass('fc-thu'); - expect(daysOfWeek[5]).toHaveClass('fc-fri'); - expect(daysOfWeek[6]).toHaveClass('fc-sat'); - }); - }); - - describe('when setting firstDay to 1', function() { - beforeEach(function() { - var options = { - firstDay: 1 - }; - $('#cal').fullCalendar(options); - }); - it('should make Monday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-mon'); - expect(daysOfWeek[1]).toHaveClass('fc-tue'); - expect(daysOfWeek[2]).toHaveClass('fc-wed'); - expect(daysOfWeek[3]).toHaveClass('fc-thu'); - expect(daysOfWeek[4]).toHaveClass('fc-fri'); - expect(daysOfWeek[5]).toHaveClass('fc-sat'); - expect(daysOfWeek[6]).toHaveClass('fc-sun'); - }); - }); - - describe('when setting firstDay to 2', function() { - beforeEach(function() { - var options = { - firstDay: 2 - }; - $('#cal').fullCalendar(options); - }); - it('should make Tuesday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-tue'); - expect(daysOfWeek[1]).toHaveClass('fc-wed'); - expect(daysOfWeek[2]).toHaveClass('fc-thu'); - expect(daysOfWeek[3]).toHaveClass('fc-fri'); - expect(daysOfWeek[4]).toHaveClass('fc-sat'); - expect(daysOfWeek[5]).toHaveClass('fc-sun'); - expect(daysOfWeek[6]).toHaveClass('fc-mon'); - }); - }); - - describe('when setting firstDay to 3', function() { - beforeEach(function() { - var options = { - firstDay: 3 - }; - $('#cal').fullCalendar(options); - }); - it('should make Wednesday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-wed'); - expect(daysOfWeek[1]).toHaveClass('fc-thu'); - expect(daysOfWeek[2]).toHaveClass('fc-fri'); - expect(daysOfWeek[3]).toHaveClass('fc-sat'); - expect(daysOfWeek[4]).toHaveClass('fc-sun'); - expect(daysOfWeek[5]).toHaveClass('fc-mon'); - expect(daysOfWeek[6]).toHaveClass('fc-tue'); - }); - }); - - describe('when setting firstDay to 4', function() { - beforeEach(function() { - var options = { - firstDay: 4 - }; - $('#cal').fullCalendar(options); - }); - it('should make Thursday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-thu'); - expect(daysOfWeek[1]).toHaveClass('fc-fri'); - expect(daysOfWeek[2]).toHaveClass('fc-sat'); - expect(daysOfWeek[3]).toHaveClass('fc-sun'); - expect(daysOfWeek[4]).toHaveClass('fc-mon'); - expect(daysOfWeek[5]).toHaveClass('fc-tue'); - expect(daysOfWeek[6]).toHaveClass('fc-wed'); - }); - }); - - describe('when setting firstDay to 5', function() { - beforeEach(function() { - var options = { - firstDay: 5 - }; - $('#cal').fullCalendar(options); - }); - it('should make Friday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-fri'); - expect(daysOfWeek[1]).toHaveClass('fc-sat'); - expect(daysOfWeek[2]).toHaveClass('fc-sun'); - expect(daysOfWeek[3]).toHaveClass('fc-mon'); - expect(daysOfWeek[4]).toHaveClass('fc-tue'); - expect(daysOfWeek[5]).toHaveClass('fc-wed'); - expect(daysOfWeek[6]).toHaveClass('fc-thu'); - }); - }); - - describe('when setting firstDay to 6', function() { - beforeEach(function() { - var options = { - firstDay: 6 - }; - $('#cal').fullCalendar(options); - }); - it('should make Saturday the first day of the week', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-sat'); - expect(daysOfWeek[1]).toHaveClass('fc-sun'); - expect(daysOfWeek[2]).toHaveClass('fc-mon'); - expect(daysOfWeek[3]).toHaveClass('fc-tue'); - expect(daysOfWeek[4]).toHaveClass('fc-wed'); - expect(daysOfWeek[5]).toHaveClass('fc-thu'); - expect(daysOfWeek[6]).toHaveClass('fc-fri'); - }); - }); - - describe('when new firstDay options are set', function() { - it('should change the first day of week to Monday', function() { - $('#cal').fullCalendar({ - firstDay: 1 - }); - expect($('.fc-day-header')[0]).toHaveClass('fc-mon'); - }); - it('shoule change the first day of week to Thursday', function() { - $('#cal').fullCalendar({ - firstDay: 4 - }); - expect($('.fc-day-header')[0]).toHaveClass('fc-thu'); - }); - }); - - describe('when first day is set to Tuesday and isRTL is true', function() { - beforeEach(function() { - var options = { - firstDay: 2, - isRTL: true - }; - $('#cal').fullCalendar(options); - }); - it('should put days mon, sun, sat ...', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-mon'); - expect(daysOfWeek[1]).toHaveClass('fc-sun'); - expect(daysOfWeek[2]).toHaveClass('fc-sat'); - expect(daysOfWeek[3]).toHaveClass('fc-fri'); - expect(daysOfWeek[4]).toHaveClass('fc-thu'); - expect(daysOfWeek[5]).toHaveClass('fc-wed'); - expect(daysOfWeek[6]).toHaveClass('fc-tue'); - }); - }); - - it('should have a different default value based on the language', function() { - $('#cal').fullCalendar({ - lang: 'en-gb' - }); - // firstDay will be 1 (Monday) in Great Britain - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-mon'); - expect(daysOfWeek[1]).toHaveClass('fc-tue'); - expect(daysOfWeek[2]).toHaveClass('fc-wed'); - expect(daysOfWeek[3]).toHaveClass('fc-thu'); - expect(daysOfWeek[4]).toHaveClass('fc-fri'); - expect(daysOfWeek[5]).toHaveClass('fc-sat'); - expect(daysOfWeek[6]).toHaveClass('fc-sun'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/forceEventDuration.js b/tests/automated/forceEventDuration.js deleted file mode 100644 index ea52e62..0000000 --- a/tests/automated/forceEventDuration.js +++ /dev/null @@ -1,64 +0,0 @@ -describe('forceEventDuration', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - }); - - describe('when turned off', function() { - beforeEach(function() { - options.forceEventDuration = false; - }); - it('allows a null end date for all-day and timed events', function() { - options.events = [ - { - id: '1', - start: '2014-05-10' - }, - { - id: '2', - start: '2014-05-10T14:00:00' - } - ]; - $('#cal').fullCalendar(options); - var events = $('#cal').fullCalendar('clientEvents'); - expect(events[0].end).toBeNull(); - expect(events[1].end).toBeNull(); - }); - }); - - describe('when turned on', function() { - beforeEach(function() { - options.forceEventDuration = true; - }); - it('allows a null end date for all-day and timed events', function() { - options.events = [ - { - id: '1', - start: '2014-05-10' - }, - { - id: '2', - start: '2014-05-10T14:00:00' - } - ]; - $('#cal').fullCalendar(options); - var events = $('#cal').fullCalendar('clientEvents'); - expect(events[0].id).toEqual('1'); - expect(moment.isMoment(events[0].end)).toEqual(true); - expect(events[1].id).toEqual('2'); - expect(moment.isMoment(events[1].end)).toEqual(true); - }); - }); - - // NOTE: the actual verification of the correct calculation of the end - // (using defaultTimedEventDuration and defaultAllDayEventDuration) - // is done in those test files. - -}); \ No newline at end of file diff --git a/tests/automated/formatRange.js b/tests/automated/formatRange.js deleted file mode 100644 index 2796566..0000000 --- a/tests/automated/formatRange.js +++ /dev/null @@ -1,148 +0,0 @@ - -describe('formatRange', function() { - - it('doesn\'t do any splitting when dates have different years', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2015-01-01', 'MMMM Do YYYY'); - expect(s).toEqual('January 1st 2014 - January 1st 2015'); - }); - - it('splits correctly on day when dates have same month', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-05', 'MMMM Do YYYY'); - expect(s).toEqual('January 1st - 5th 2014'); - }); - - it('splits correctly on day when dates have same month and smaller unit in front', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-05', 'dddd MMMM Do YYYY'); - expect(s).toEqual('Wednesday January 1st - Sunday January 5th 2014'); - }); - - it('splits correctly on the time when dates have the same day', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T08:00:00', 'MMMM Do YYYY h:mma'); - expect(s).toEqual('January 1st 2014 6:00am - 8:00am'); - }); - - it('splits correctly on the time when dates have the same day and hour but different am/pm', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T18:00:00', 'MMMM Do YYYY h:mma'); - expect(s).toEqual('January 1st 2014 6:00am - 6:00pm'); - }); - - it('splits correctly on the time when the dates have the same hour', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T06:30:00', 'MMMM Do YYYY h:mma'); - expect(s).toEqual('January 1st 2014 6:00am - 6:30am'); - }); - - it('outputs the single date when the dates have the same day and time', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T06:00:00', 'MMMM Do YYYY h:mma'); - expect(s).toEqual('January 1st 2014 6:00am'); - }); - - it('outputs the single date when the dates have the same day and the format string is vague', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-01', 'MMMM Do YYYY'); - expect(s).toEqual('January 1st 2014'); - }); - - it('uses a custom separator', function() { - var s = $.fullCalendar.formatRange( - '2014-01-01T06:00:00', - '2014-01-01T06:30:00', - 'MMMM Do YYYY h:mma', - '<...>' - ); - expect(s).toEqual('January 1st 2014 6:00am<...>6:30am'); - }); - - describe('when called with isRTL', function() { - - it('doesn\'t do any splitting when dates have different years', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2015-01-01', 'MMMM Do YYYY', null, true); - expect(s).toEqual('January 1st 2015 - January 1st 2014'); - }); - - it('splits correctly on day when dates have same month', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-05', 'MMMM Do YYYY', null, true); - expect(s).toEqual('January 5th - 1st 2014'); - }); - - it('splits correctly on day when dates have same month and smaller unit in front', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-05', 'dddd MMMM Do YYYY', null, true); - expect(s).toEqual('Sunday January 5th - Wednesday January 1st 2014'); - }); - - it('splits correctly on the time when dates have the same day', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T08:00:00', 'MMMM Do YYYY h:mma', null, true); - expect(s).toEqual('January 1st 2014 8:00am - 6:00am'); - }); - - it('splits correctly on the time when dates have the same day and hour but different am/pm', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T18:00:00', 'MMMM Do YYYY h:mma', null, true); - expect(s).toEqual('January 1st 2014 6:00pm - 6:00am'); - }); - - it('splits correctly on the time when the dates have the same hour', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T06:30:00', 'MMMM Do YYYY h:mma', null, true); - expect(s).toEqual('January 1st 2014 6:30am - 6:00am'); - }); - - it('outputs the single date when the dates have the same day and time', function() { - var s = $.fullCalendar.formatRange('2014-01-01T06:00:00', '2014-01-01T06:00:00', 'MMMM Do YYYY h:mma', null, true); - expect(s).toEqual('January 1st 2014 6:00am'); - }); - - it('outputs the single date when the dates have the same day and the format string is vague', function() { - var s = $.fullCalendar.formatRange('2014-01-01', '2014-01-01', 'MMMM Do YYYY', null, true); - expect(s).toEqual('January 1st 2014'); - }); - - it('uses a custom separator', function() { - var s = $.fullCalendar.formatRange( - '2014-01-01T06:00:00', - '2014-01-01T06:30:00', - 'MMMM Do YYYY h:mma', - '<...>', - true - ); - expect(s).toEqual('January 1st 2014 6:30am<...>6:00am'); - }); - - }); - - describe('when calendar has isRTL', function() { - - it('splits correctly on day when dates have same month', function() { - affix('#cal'); - $('#cal').fullCalendar({ - defaultView: 'basicWeek', - defaultDate: '2014-05-20', - isRTL: true, - titleFormat: 'MMMM Do YYYY' - }); - expect($('.fc-toolbar h2')).toHaveText('May 24th - 18th 2014'); - }); - - }); - - describe('when calendar has a customized lang', function() { - - it('uses language and splits correctly on day when dates have same month', function() { - affix('#cal'); - $('#cal').fullCalendar({ - defaultView: 'basicWeek', - defaultDate: '2014-05-20', - lang: 'fr', - titleFormat: 'dddd MMMM D YYYY' - }); - expect($('.fc-toolbar h2')).toHaveText('lundi mai 19 - dimanche mai 25 2014'); - }); - - }); - - it('splits correctly on day when dates have same month, when given real moments', function() { - var s = $.fullCalendar.formatRange( - moment.utc('2014-01-01'), - moment.utc('2015-01-01'), - 'MMMM Do YYYY' - ); - expect(s).toEqual('January 1st 2014 - January 1st 2015'); - }); - -}); diff --git a/tests/automated/handleWindowResize.js b/tests/automated/handleWindowResize.js deleted file mode 100644 index 8059d1a..0000000 --- a/tests/automated/handleWindowResize.js +++ /dev/null @@ -1,22 +0,0 @@ - -describe('handleWindowResize', function() { - - beforeEach(function() { - affix('#cal'); - }); - - // not true - /* - xdescribe('When default is used, should fire resize event', function() { - it('should fire resize', function() { - var resized = 0; - $('#cal').fullCalendar({ - windowResize: function(view) { - resized++; - } - }); - expect(resized).toEqual(1); - }); - }); - */ -}); \ No newline at end of file diff --git a/tests/automated/header-navigation.js b/tests/automated/header-navigation.js deleted file mode 100644 index 5e8fc79..0000000 --- a/tests/automated/header-navigation.js +++ /dev/null @@ -1,60 +0,0 @@ - -describe('header navigation', function() { - - beforeEach(function() { - affix('#calendar'); - var options = { - header: { - left: 'next,prev,prevYear,nextYear today', - center: '', - right: 'title' - } - }; - $('#calendar').fullCalendar(options); - }); - - describe('and click next', function() { - it('should change view to next month', function() { - $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-next-button').simulate('click'); - var newDate = $('#calendar').fullCalendar('getDate'); - expect(newDate).toEqualMoment('2010-03-01'); - }); - }); - - describe('and click prev', function() { - it('should change view to prev month', function() { - $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-prev-button').simulate('click'); - var newDate = $('#calendar').fullCalendar('getDate'); - expect(newDate).toEqualMoment('2010-01-01'); - }); - }); - - describe('and click prevYear', function() { - it('should change view to prev month', function() { - $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-prevYear-button').simulate('click'); - var newDate = $('#calendar').fullCalendar('getDate'); - expect(newDate).toEqualMoment('2009-02-01'); - }); - }); - - describe('and click nextYear', function() { - it('should change view to prev month', function() { - $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-nextYear-button').simulate('click'); - var newDate = $('#calendar').fullCalendar('getDate'); - expect(newDate).toEqualMoment('2011-02-01'); - }); - }); - - describe('and click today', function() { - it('should change view to prev month', function() { - $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-today-button').simulate('click'); - var newDate = $('#calendar').fullCalendar('getDate'); - expect(newDate).toEqualNow(); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/header-rendering.js b/tests/automated/header-rendering.js deleted file mode 100644 index 827eb5d..0000000 --- a/tests/automated/header-rendering.js +++ /dev/null @@ -1,136 +0,0 @@ - -describe('header rendering', function() { - - beforeEach(function() { - affix('#calendar'); - }); - - describe('when using default header options', function() { - it('should have title as default on left', function() { - $('#calendar').fullCalendar(); - expect($('#calendar > .fc-toolbar > .fc-left > *')).toBeMatchedBy('h2'); - }); - it('should have empty center', function() { - $('#calendar').fullCalendar(); - var center = $('#calendar > .fc-toolbar > .fc-center'); - expect(center).toBeEmpty(); - }); - it('should have right with today|space|left|right', function() { - $('#calendar').fullCalendar(); - var rightChildren = $('#calendar > .fc-toolbar > .fc-right > *'); - var todayButton = rightChildren.eq(0); - var buttonGroup = rightChildren.eq(1); - var prevNextButtons = buttonGroup.children(); - expect(todayButton).toHaveClass('fc-today-button'); - expect(buttonGroup).toHaveClass('fc-button-group'); - expect(prevNextButtons.eq(0)).toHaveClass('fc-prev-button'); - expect(prevNextButtons.eq(1)).toHaveClass('fc-next-button'); - }); - }); - - describe('when supplying header options', function() { - beforeEach(function() { - var options = { - header: { - left: 'next,prev', - center: 'prevYear today nextYear agendaView,dayView', - right: 'title' - } - }; - $('#calendar').fullCalendar(options); - }); - it('should have title on the right', function() { - expect($('#calendar > .fc-toolbar > .fc-right > *')).toBeMatchedBy('h2'); - }); - it('should have next|prev on left', function() { - var buttonGroup = $('#calendar > .fc-toolbar > .fc-left > *'); - var prevNextButtons = buttonGroup.children(); - expect(prevNextButtons.eq(0)).toHaveClass('fc-next-button'); - expect(prevNextButtons.eq(1)).toHaveClass('fc-prev-button'); - }); - it('should have prevYear|space|today|space|nextYear in center', function() { - var items = $('#calendar > .fc-toolbar > .fc-center > *'); - expect(items.eq(0)).toHaveClass('fc-prevYear-button'); - expect(items.eq(1)).toHaveClass('fc-today-button'); - expect(items.eq(2)).toHaveClass('fc-nextYear-button'); - }); - }); - - describe('when setting header to false', function() { - beforeEach(function() { - var options = { - header: false - }; - $('#calendar').fullCalendar(options); - }); - it('should not have header table', function() { - expect($('.fc-toolbar')).not.toBeInDOM(); - }); - }); - - describe('renders left and right literally', function() { - [ true, false ].forEach(function(isRTL) { - describe('when isRTL is ' + isRTL, function() { - beforeEach(function() { - var options = {}; - $('#calendar').fullCalendar({ - header: { - left: 'prev', - center: 'today', - right: 'next' - }, - isRTL: isRTL - }); - }); - it('should have prev in left', function() { - var fcHeaderLeft = $('#calendar .fc-toolbar > .fc-left'); - expect(fcHeaderLeft).toContainElement('.fc-prev-button'); - }); - it('should have today in center', function() { - var fcHeaderCenter = $('#calendar .fc-toolbar > .fc-center'); - expect(fcHeaderCenter).toContainElement('.fc-today-button'); - }); - it('should have next in right', function() { - var fcHeaderRight = $('#calendar .fc-toolbar > .fc-right'); - expect(fcHeaderRight).toContainElement('.fc-next-button'); - }); - }); - }); - }); - - describe('when calendar is within a form', function() { - beforeEach(function() { - $('#calendar').wrap('
'); - }); - it('should not submit the form when clicking the button', function(done) { - var options = { - header: { - left: 'prev,next', - right: 'title' - } - }; - var unloadCalled = false; - - function beforeUnloadHandler() { - console.log('when calendar is within a form, it submits!!!'); - unloadCalled = true; - cleanup(); - return 'click stay on this page'; - } - $(window).on('beforeunload', beforeUnloadHandler); - - function cleanup() { - $(window).off('beforeunload', beforeUnloadHandler); - } - - $('#calendar').fullCalendar(options); - $('.fc-next-button').simulate('click'); - - setTimeout(function() { // wait to see if handler was called - expect(unloadCalled).toBe(false); - cleanup(); - done(); - }, 100); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/height.js b/tests/automated/height.js deleted file mode 100644 index 620de1c..0000000 --- a/tests/automated/height.js +++ /dev/null @@ -1,49 +0,0 @@ - -describe('height', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when using default height', function() { - it('should use default height based on default aspect ratio of 1:35', function() { - $('#cal').width(1350); - $('#cal').fullCalendar(); - var height = $('.fc-content').height(); - expect(height).toEqual(1000); - }); - }); - - describe('when setting height with the setter', function() { - beforeEach(function() { - $('#cal').width(673); - $('#cal').fullCalendar(); - $('#cal').fullCalendar('option', 'height', 751); - }); - it('should not change the width of the block level container', function() { - var width = $('#cal').width(); - expect(width).toEqual(673); - }); - it('should set the size of the block level container to the height', function() { - var height = $('#cal').height(); - expect(height).toEqual(751); - }); - }); - - describe('when setting height at instantiation', function() { - beforeEach(function() { - $('#cal').width(673); - $('#cal').fullCalendar({ - height: 751 - }); - }); - it('should not change the width of the block level container', function() { - var width = $('#cal').width(); - expect(width).toEqual(673); - }); - it('should set the size of the block level container to the height', function() { - var height = $('#cal').height(); - expect(height).toEqual(751); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/hiddenDays.js b/tests/automated/hiddenDays.js deleted file mode 100644 index 9b2ae74..0000000 --- a/tests/automated/hiddenDays.js +++ /dev/null @@ -1,88 +0,0 @@ - -describe('hiddenDays', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when using default', function() { - beforeEach(function() { - $('#cal').fullCalendar(); - }); - it('should show 7 days of the week', function() { - var daysCount = $('.fc-day-header').length; - expect(daysCount).toEqual(7); - }); - }); - - describe('when setting an empty hiddenDays', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - hiddenDays: [] - }); - }); - it('should return 7 days of the week', function() { - var daysCount = $('.fc-day-header').length; - expect(daysCount).toEqual(7); - }); - }); - - describe('when setting hiddenDays with 1', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - hiddenDays: [ 1 ] - }); - }); - it('should return 6 days', function() { - var daysCount = $('.fc-day-header').length; - expect(daysCount).toEqual(6); - }); - it('should return sun,tue,wed..sat days', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-sun'); - expect(daysOfWeek[1]).toHaveClass('fc-tue'); - expect(daysOfWeek[5]).toHaveClass('fc-sat'); - }); - it('should expect 7th day to be undefined', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[6]).toBeUndefined(); - }); - }); - - describe('when setting hiddenDays with 3,5', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - hiddenDays: [ 3, 5 ] - }); - }); - it('should return 6 days', function() { - var daysCount = $('.fc-day-header').length; - expect(daysCount).toEqual(5); - }); - it('should return s,m,t,t,s ', function() { - var daysOfWeek = $('.fc-day-header'); - expect(daysOfWeek[0]).toHaveClass('fc-sun'); - expect(daysOfWeek[1]).toHaveClass('fc-mon'); - expect(daysOfWeek[2]).toHaveClass('fc-tue'); - expect(daysOfWeek[3]).toHaveClass('fc-thu'); - expect(daysOfWeek[4]).toHaveClass('fc-sat'); - }); - it('should expect wed and fri be undefined', function() { - var fri = $('.fc-day-header.fc-fri')[0]; - var wed = $('.fc-day-header.fc-wed')[0]; - expect(fri).toBeUndefined(); - expect(wed).toBeUndefined(); - }); - }); - - describe('when setting all hiddenDays', function() { - it('should expect to throw an exception', function() { - var options = { - hiddenDays: [ 0, 1, 2, 3, 4, 5, 6 ] - }; - expect(function() { - $('#cal').fullCalendar(options); - }).toThrow('invalid hiddenDays'); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/isRTL.js b/tests/automated/isRTL.js deleted file mode 100644 index 435a236..0000000 --- a/tests/automated/isRTL.js +++ /dev/null @@ -1,15 +0,0 @@ -describe('isRTL', function() { - - it('has it\'s default value computed differently based off of the language', function() { - affix('#cal'); - $('#cal').fullCalendar({ - lang: 'ar' // Arabic is RTL - }); - var isRTL = $('#cal').fullCalendar('option', 'isRTL'); - expect(isRTL).toEqual(true); - }); - - // NOTE: don't put tests related to other options in here! - // Put them in the test file for the individual option! - -}); \ No newline at end of file diff --git a/tests/automated/lang.js b/tests/automated/lang.js deleted file mode 100644 index 2ed6928..0000000 --- a/tests/automated/lang.js +++ /dev/null @@ -1,53 +0,0 @@ - -describe('lang', function() { - - afterEach(function() { - moment.lang('en'); - }); - - it('is not affected by global moment lang when unset', function() { - moment.lang('fr'); - affix('#cal'); - $('#cal').fullCalendar(); - var calendar = $('#cal').fullCalendar('getCalendar'); - var mom = calendar.moment('2014-05-01'); - var s = mom.format('dddd MMMM Do YYYY'); - expect(s).toEqual('Thursday May 1st 2014'); - }); - - it('is not affected by global moment lang when unset', function() { - moment.lang('fr'); - affix('#cal'); - $('#cal').fullCalendar({ - lang: 'es' - }); - var calendar = $('#cal').fullCalendar('getCalendar'); - var mom = calendar.moment('2014-05-01'); - var s = mom.format('dddd MMMM Do YYYY'); - expect(s).toEqual('jueves mayo 1Āŗ 2014'); - }); - - it('doesn\'t side-effect the global moment lang when customized', function() { - moment.lang('fr'); - affix('#cal'); - $('#cal').fullCalendar({ - lang: 'es' - }); - var mom = moment.utc('2014-05-01'); - var s = mom.format('dddd MMMM Do YYYY'); - expect(s).toEqual('jeudi mai 1er 2014'); - expect(moment.lang()).toEqual('fr'); - }); - - it('defaults to English when configured to language that isn\'t loaded', function() { - affix('#cal'); - $('#cal').fullCalendar({ - lang: 'zz' - }); - var calendar = $('#cal').fullCalendar('getCalendar'); - var mom = calendar.moment('2014-05-01'); - var s = mom.format('dddd MMMM Do YYYY'); - expect(s).toEqual('Thursday May 1st 2014'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/maxTime.js b/tests/automated/maxTime.js deleted file mode 100644 index c0eb550..0000000 --- a/tests/automated/maxTime.js +++ /dev/null @@ -1,124 +0,0 @@ -describe('maxTime', function() { - - beforeEach(function() { - affix('#cal'); - }); - - var numToStringConverter = function(timeIn) { - var time = (timeIn % 12) || 12; - var amPm = 'am'; - if ((timeIn % 24) > 11) { - amPm = 'pm'; - } - return time + amPm; - }; - - describe('when using the default settings', function() { - - describe('in agendaWeek', function() { - it('should start at 12am', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - expect(lastSlotText).toEqual('11pm'); - }); - }); - - describe('in agendaDay', function() { - it('should start at 12am', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - expect(lastSlotText).toEqual('11pm'); - }); - }); - }); - - describe('when using a whole number', function() { - - var hourNumbers = [ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ]; - - describe('in agendaWeek', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should end at ' + hourNumber, function() { - var options = { - defaultView: 'agendaWeek', - maxTime: { hours: hourNumber } - }; - $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - var expected = numToStringConverter(hourNumber - 1); - expect(lastSlotText).toEqual(expected); - }); - }); - }); - - describe('in agendaDay', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should end at ' + hourNumber, function() { - var options = { - defaultView: 'agendaDay', - maxTime: hourNumber + ':00' // in addition, test string duration input - }; - $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - var expected = numToStringConverter(hourNumber - 1); - expect(lastSlotText).toEqual(expected); - }); - }); - }); - }); - - describe('when using default slotInterval and \'uneven\' maxTime', function() { - - var hourNumbers = [ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ]; - - describe('in agendaWeek', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should end at ' + hourNumber + ':20', function() { - var options = { - defaultView: 'agendaWeek', - maxTime: { hours: hourNumber, minutes: 20 } - }; - $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - // since exclusive end is :20, last slot will be on the current hour's 00:00 - var expected = numToStringConverter(hourNumber); - expect(lastSlotText).toEqual(expected); - }); - }); - }); - - describe('in agendaDay', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should end at ' + hourNumber + ':20', function() { - var options = { - defaultView: 'agendaDay', - maxTime: { hours: hourNumber, minutes: 20 } - }; - $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); - // since exclusive end is :20, last slot will be on the current hour's 00:00 - var expected = numToStringConverter(hourNumber); - expect(lastSlotText).toEqual(expected); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/minTime.js b/tests/automated/minTime.js deleted file mode 100644 index 76c7593..0000000 --- a/tests/automated/minTime.js +++ /dev/null @@ -1,126 +0,0 @@ -describe('minTime', function() { - - beforeEach(function() { - affix('#cal'); - }); - - var numToStringConverter = function(timeIn, mins) { - var time = (timeIn % 12) || 12; - var amPm = 'am'; - if ((timeIn % 24) > 11) { - amPm = 'pm'; - } - return time + (mins != null ? ':' + mins : '') + amPm; - }; - - describe('when using the default settings', function() { - - describe('in agendaWeek', function() { - it('should start at 12am', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); - expect(firstSlotText).toEqual('12am'); - }); - }); - - describe('in agendaDay', function() { - it('should start at 12am', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); - expect(firstSlotText).toEqual('12am'); - }); - }); - }); - - describe('when using a whole number', function() { - - var hourNumbers = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]; - - describe('in agendaWeek', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should start at ' + hourNumber, function() { - var options = { - defaultView: 'agendaWeek', - minTime: { hours: hourNumber } - }; - $('#cal2').fullCalendar(options); - var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); - var expected = numToStringConverter(hourNumber); - expect(firstSlotText).toEqual(expected); - }); - }); - }); - - describe('in agendaDay', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should start at ' + hourNumber, function() { - var options = { - defaultView: 'agendaDay', - minTime: hourNumber + ':00' // in addition, test string duration input - }; - $('#cal2').fullCalendar(options); - var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); - var expected = numToStringConverter(hourNumber); - expect(firstSlotText).toEqual(expected); - }); - }); - }); - }); - - describe('when using default slotInterval and \'uneven\' minTime', function() { - - var hourNumbers = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]; - - describe('in agendaWeek', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should start at ' + hourNumber + ':20', function() { - var options = { - defaultView: 'agendaWeek', - minTime: { hours: hourNumber, minutes: 20 } - }; - $('#cal2').fullCalendar(options); - var slatRows = $('.fc-slats tr'); - expect(slatRows.eq(0)).toHaveClass('fc-minor'); - expect(slatRows.eq(1)).toHaveClass('fc-minor'); - expect(slatRows.eq(2)).toHaveClass('fc-minor'); - // TODO: fix bad behavior in src where no slots have text - }); - }); - }); - - describe('in agendaDay', function() { - beforeEach(function() { - affix('#cal2'); - }); - hourNumbers.forEach(function(hourNumber) { - it('should start at ' + hourNumber + ':20', function() { - var options = { - defaultView: 'agendaDay', - minTime: { hours: hourNumber, minutes: 20 } - }; - $('#cal2').fullCalendar(options); - var slatRows = $('.fc-slats tr'); - expect(slatRows.eq(0)).toHaveClass('fc-minor'); - expect(slatRows.eq(1)).toHaveClass('fc-minor'); - expect(slatRows.eq(2)).toHaveClass('fc-minor'); - // TODO: fix bad behavior in src where no slots have text - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/moment-ambig.js b/tests/automated/moment-ambig.js deleted file mode 100644 index 6b686d6..0000000 --- a/tests/automated/moment-ambig.js +++ /dev/null @@ -1,184 +0,0 @@ - -describe('ambiguously-zoned moment', function() { - - it('has a false hasZone', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.hasZone()).toBe(false); - }); - - it('has a true hasTime', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.hasTime()).toBe(true); - }); - - it('has a zero zone', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.zone()).toBe(0); - }); - - it('formats without a zone part', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.format()).toBe('2014-06-08T10:00:00'); - }); - - it('formats via toISOString without a zone part', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.toISOString()).toBe('2014-06-08T10:00:00'); - }); - - it('is correctly cloned', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - var clone = mom.clone(); - expect(clone.hasZone()).toBe(false); - expect(clone.format()).toBe('2014-06-08T10:00:00'); - expect(clone).not.toBe(mom); - clone.add(1, 'months'); - expect(+clone).not.toBe(+mom); - }); - - it('can be given a zone via utc', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.utc(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('can be given a zone via local', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - var equivDate = new Date(Date.UTC(2014, 5, 8, 10, 0, 0)); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 10, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.local(); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 10, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(equivDate.getTimezoneOffset()); - }); - - it('can be given a zone via zone', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08T10:00:00'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.zone(-420); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(-420); - }); - -}); - -describe('ambiguously-timed moment', function() { - - it('has a false hasTime', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.hasTime()).toBe(false); - }); - - it('has a false hasZone', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.hasZone()).toBe(false); - }); - - it('has a zero time', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - var time = mom.time(); - expect(+time).toBe(0); - }); - - it('formats without a zone part', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.format()).toBe('2014-06-08'); - }); - - it('formats via toISOString without a time part', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.toISOString()).toBe('2014-06-08'); - }); - - it('is correctly cloned', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - var clone = mom.clone(); - expect(clone.hasTime()).toBe(false); - expect(clone.format()).toBe('2014-06-08'); - expect(clone).not.toBe(mom); - clone.add(1, 'months'); - expect(+clone).not.toBe(+mom); - }); - - it('can be given a time', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.hasTime()).toBe(false); - var time = moment.duration({ hours: 1, minutes: 25 }); - mom.time(time); - expect(mom.hasTime()).toBe(true); - expect(+mom.time()).toBe(+time); - }); - - it('can be given a time and zone via utc', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.utc(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('can be given a time and zone via local', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - var equivDate = new Date(2014, 5, 8, 10, 0, 0); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.local(); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(equivDate.getTimezoneOffset()); - }); - - it('can be given a time and zone via zone', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-08'); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - expect(mom.zone()).toBe(0); - mom.zone(-420); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(-420); - }); - -}); - -describe('unambiguous moment', function() { - - it('can be made ambiguously-zoned via stripZone', function() { - var mom = $.fullCalendar.moment.utc('2014-06-08T10:00:00-0000'); - expect(mom.hasZone()).toBe(true); - expect(mom.hasTime()).toBe(true); - mom.stripZone(); - expect(mom.format()).toBe('2014-06-08T10:00:00'); - expect(mom.hasZone()).toBe(false); - expect(mom.hasTime()).toBe(true); - }); - - it('can be made ambigously-timed via stripTime', function() { - var mom = $.fullCalendar.moment.utc('2014-06-08T10:00:00-0000'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - mom.stripTime(); - expect(mom.format()).toBe('2014-06-08'); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - -}); diff --git a/tests/automated/moment-construct.js b/tests/automated/moment-construct.js deleted file mode 100644 index c7585c0..0000000 --- a/tests/automated/moment-construct.js +++ /dev/null @@ -1,646 +0,0 @@ -(function() { - -describe('$.fullCalendar.moment', function() { - testDefaultProcessing($.fullCalendar.moment); -}); - -describe('$.fullCalendar.moment.utc', function() { - testForcedUTCProcessing($.fullCalendar.moment.utc); -}); - -describe('$.fullCalendar.moment.parseZone', function() { - testLiteralProcessing($.fullCalendar.moment.parseZone); -}); - -describe('Calendar::moment', function() { - [ - { - description: 'when there is no timezone', - timezone: false, - testMethod: testLiteralProcessing - }, - { - description: 'when timezone is local', - timezone: 'local', - testMethod: testForcedLocalProcessing - }, - { - description: 'when timezone is UTC', - timezone: 'UTC', - testMethod: testForcedUTCProcessing - }, - { - description: 'when timezone is custom', - timezone: 'America/Unknown', - testMethod: testLiteralProcessing - } - ] - .forEach(function(scenario) { - describe(scenario.description, function() { - var calendarObj; - - beforeEach(function() { - affix('#cal'); - $('#cal').fullCalendar({ - timezone: scenario.timezone - }); - calendarObj = $('#cal').fullCalendar('getCalendar'); - }); - - scenario.testMethod(function() { - return calendarObj.moment.apply(calendarObj, arguments); - }); - }); - }); -}); - -function testDefaultProcessing(construct) { - - describe('when given an ISO8601 string', function() { - - it('is local regardless of inputted zone', function() { - var mom = construct('2014-06-08T10:00:00+0130'); - var simpleMoment = moment('2014-06-08T10:00:00+0130'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(simpleMoment.zone()); - }); - - it('parses as local when no zone', function() { - var mom = construct('2014-06-08T10:00:00'); - var dateEquiv = new Date(2014, 5, 8, 10); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 10, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('accepts an ambiguous time', function() { - var mom = construct('2014-06-08'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - - it('assumes first-of-month and ambiguous time when no date-of-month', function() { - var mom = construct('2014-06'); - expect(mom.toArray()).toEqual([ 2014, 5, 1, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - }); - - it('parses string/format combo as local', function() { - var mom = construct('12-25-1995', 'MM-DD-YYYY'); - var dateEquiv = new Date(1995, 11, 25); - expect(mom.toArray()).toEqual([ 1995, 11, 25, 0, 0, 0, 0 ]); - expect(mom.hasZone()).toBe(true); - expect(mom.hasTime()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local when given no arguments', function() { - var mom = construct(); - var dateEquiv = new Date(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local when given a native Date', function() { - var date = new Date(); - var mom = construct(date); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(date.getTimezoneOffset()); - }); - - describe('when given an array', function() { - - it('is local and has a time when given hours/minutes/seconds', function() { - var a = [ 2014, 5, 8, 11, 0, 0 ]; - var dateEquiv = new Date(2014, 5, 8, 11, 0, 0); - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local and has a time even when no hours/minutes/seconds', function() { - var a = [ 2014, 5, 8 ]; - var dateEquiv = new Date(2014, 5, 8); - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - }); - - describe('when given an existing FullCalendar moment', function() { - - it('remains ambiguously-zoned', function() { - var noTzMoment = $.fullCalendar.moment.parseZone('2014-05-28T00:00:00'); - var newMoment = construct(noTzMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(false); - }); - - it('remains ambiguously-timed', function() { - var noTimeMoment = $.fullCalendar.moment('2014-05-28'); - var newMoment = construct(noTimeMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(false); - expect(newMoment.hasZone()).toBe(false); - }); - }); - - [ - { description: 'when given an existing FullCalendar moment', moment: $.fullCalendar.moment }, - { description: 'when given an existing basic moment', moment: moment } - ] - .forEach(function(scenario) { - describe(scenario.description, function() { - - it('remains local', function() { - var localMoment = scenario.moment('2014-05-28T00:00:00'); - var newMoment = construct(localMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(localMoment.zone()); - }); - - it('remains UTC', function() { - var utcMoment = scenario.moment.utc('2014-05-28T00:00:00'); - var newMoment = construct(utcMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('remains in a custom timezone', function() { - var tzMoment = scenario.moment.parseZone('2014-05-28T00:00:00+13:00'); - var newMoment = construct(tzMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(-780); - }); - - it('produces a new moment that is in no way bound to the old', function() { - var oldMoment = scenario.moment(); - var newMoment = construct(oldMoment); - expect(newMoment).not.toBe(oldMoment); - expect(+newMoment).toBe(+oldMoment); - newMoment.add(1, 'months'); - expect(+newMoment).not.toBe(+oldMoment); - }); - }); - }); -} - -function testForcedLocalProcessing(construct) { - - describe('when given an ISO8601 string', function() { - - it('is local regardless of inputted zone', function() { - var mom = construct('2014-06-08T10:00:00+0130'); - var simpleMoment = moment('2014-06-08T10:00:00+0130'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(simpleMoment.zone()); - }); - - it('parses as local when no zone', function() { - var mom = construct('2014-06-08T10:00:00'); - var dateEquiv = new Date(2014, 5, 8, 10); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 10, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('accepts an ambiguous time', function() { - var mom = construct('2014-06-08'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - - it('assumes first-of-month and ambiguous time when no date-of-month', function() { - var mom = construct('2014-06'); - expect(mom.toArray()).toEqual([ 2014, 5, 1, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - }); - - it('parses string/format combo as local', function() { - var mom = construct('12-25-1995', 'MM-DD-YYYY'); - var dateEquiv = new Date(1995, 11, 25); - expect(mom.toArray()).toEqual([ 1995, 11, 25, 0, 0, 0, 0 ]); - expect(mom.hasZone()).toBe(true); - expect(mom.hasTime()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local when given no arguments', function() { - var mom = construct(); - var dateEquiv = new Date(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local when given a native Date', function() { - var date = new Date(); - var mom = construct(date); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(date.getTimezoneOffset()); - }); - - describe('when given an array', function() { - - it('is local and has a time when given hours/minutes/seconds', function() { - var a = [ 2014, 5, 8, 11, 0, 0 ]; - var dateEquiv = new Date(2014, 5, 8, 11, 0, 0); - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local and has a time even when no hours/minutes/seconds', function() { - var a = [ 2014, 5, 8 ]; - var dateEquiv = new Date(2014, 5, 8); - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - }); - - describe('when given an existing FullCalendar moment', function() { - - it('converts to local when ambiguously-zoned', function() { - var noTzMoment = $.fullCalendar.moment.parseZone('2014-05-28T00:00:00'); - var newMoment = construct(noTzMoment); - var dateEquiv = new Date(2014, 4, 28); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('remains ambiguously-timed', function() { - var noTimeMoment = $.fullCalendar.moment('2014-05-28'); - var newMoment = construct(noTimeMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(false); - expect(newMoment.hasZone()).toBe(false); - }); - }); - - [ - { description: 'when given an existing FullCalendar moment', moment: $.fullCalendar.moment }, - { description: 'when given an existing basic moment', moment: moment } - ] - .forEach(function(scenario) { - describe(scenario.description, function() { - - it('remains local', function() { - var localMoment = scenario.moment('2014-05-28T00:00:00'); - var newMoment = construct(localMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(localMoment.zone()); - }); - - it('converts to local when UTC', function() { - var utcMoment = scenario.moment.utc('2014-05-28T00:00:00'); - var newMoment = construct(utcMoment); - var dateEquiv = new Date(Date.UTC(2014, 4, 28)); - expect(+newMoment).toBe(+dateEquiv); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('converts to local when in a custom zone', function() { - var tzMoment = scenario.moment.parseZone('2014-05-28T00:00:00+13:00'); - var dateEquiv = tzMoment.toDate(); - var newMoment = construct(tzMoment); - expect(+newMoment).toBe(+dateEquiv); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('produces a new moment that is in no way bound to the old', function() { - var oldMoment = scenario.moment(); - var newMoment = construct(oldMoment); - expect(newMoment).not.toBe(oldMoment); - expect(+newMoment).toBe(+oldMoment); - newMoment.add(1, 'months'); - expect(+newMoment).not.toBe(+oldMoment); - }); - }); - }); -} - -function testForcedUTCProcessing(construct) { - - describe('when given an ISO8601 string', function() { - - it('is UTC regardless of inputted zone', function() { - var mom = construct('2014-06-08T10:00:00+0130'); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('parses as UTC when no zone', function() { - var mom = construct('2014-06-08T10:00:00'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 10, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('accepts an ambiguous time', function() { - var mom = construct('2014-06-08'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - - it('assumes first-of-month and ambiguous time when no date-of-month', function() { - var mom = construct('2014-06'); - expect(mom.toArray()).toEqual([ 2014, 5, 1, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - }); - - it('parses string/format combo as UTC', function() { - var mom = construct('12-25-1995', 'MM-DD-YYYY'); - expect(mom.toArray()).toEqual([ 1995, 11, 25, 0, 0, 0, 0 ]); - expect(mom.hasZone()).toBe(true); - expect(mom.hasTime()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('is UTC when given no arguments', function() { - var mom = construct(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('is UTC when given a native Date', function() { - var date = new Date(); - var mom = construct(date); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - describe('when given an array', function() { - - it('is UTC and has a time when given hours/minutes/seconds', function() { - var a = [ 2014, 5, 8, 11, 0, 0 ]; - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('is UTC and has a time even when no hours/minutes/seconds', function() { - var a = [ 2014, 5, 8 ]; - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(0); - }); - }); - - describe('when given an existing FullCalendar moment', function() { - - it('converts to UTC when ambiguously-zoned', function() { - var noTzMoment = $.fullCalendar.moment.utc('2014-05-28T00:00:00'); - var newMoment = construct(noTzMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('remains ambiguously-timed', function() { - var noTimeMoment = $.fullCalendar.moment('2014-05-28'); - var newMoment = construct(noTimeMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(false); - expect(newMoment.hasZone()).toBe(false); - }); - }); - - [ - { description: 'when given an existing FullCalendar moment', moment: $.fullCalendar.moment }, - { description: 'when given an existing basic moment', moment: moment } - ] - .forEach(function(scenario) { - describe(scenario.description, function() { - - it('converts to UTC when local', function() { - var localMoment = scenario.moment('2014-05-28T00:00:00'); - var newMoment = construct(localMoment); - expect(+newMoment).toBe(+localMoment); // same point in time - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('remains UTC', function() { - var utcMoment = scenario.moment.utc('2014-05-28T00:00:00'); - var newMoment = construct(utcMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('converts to UTC when in a custom zone', function() { - var tzMoment = scenario.moment.parseZone('2014-05-28T00:00:00+13:00'); - var newMoment = construct(tzMoment); - expect(+newMoment).toBe(+tzMoment); // same point in time - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('produces a new moment that is in no way bound to the old', function() { - var oldMoment = scenario.moment.utc(); - var newMoment = construct(oldMoment); - expect(newMoment).not.toBe(oldMoment); - expect(+newMoment).toBe(+oldMoment); - newMoment.add(1, 'months'); - expect(+newMoment).not.toBe(+oldMoment); - }); - }); - }); -} - -function testLiteralProcessing(construct) { - - describe('when given an ISO8601 string', function() { - - it('retains the inputted zone', function() { - var mom = construct('2014-06-08T11:00:00+0130'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(-90); - }); - - it('accepts an ambiguous zone', function() { - var mom = construct('2014-06-08T11:00:00'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - }); - - it('accepts an ambiguous time', function() { - var mom = construct('2014-06-08'); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - - it('assumes first-of-month and ambiguous time when no date-of-month', function() { - var mom = construct('2014-06'); - expect(mom.toArray()).toEqual([ 2014, 5, 1, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(false); - expect(mom.hasZone()).toBe(false); - }); - }); - - it('parses string/format combo as UTC', function() { - var mom = construct('12-25-1995', 'MM-DD-YYYY'); - expect(mom.toArray()).toEqual([ 1995, 11, 25, 0, 0, 0, 0 ]); - expect(mom.hasZone()).toBe(true); - expect(mom.hasTime()).toBe(true); - expect(mom.zone()).toBe(0); - }); - - it('is local when given no arguments', function() { - var mom = construct(); - var dateEquiv = new Date(); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(dateEquiv.getTimezoneOffset()); - }); - - it('is local when given a native Date', function() { - var date = new Date(); - var mom = construct(date); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(true); - expect(mom.zone()).toBe(date.getTimezoneOffset()); - }); - - describe('when given an array', function() { - - it('is ambiguously-zoned and has a time when given hours/minutes/seconds', function() { - var a = [ 2014, 5, 8, 11, 0, 0 ]; - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 11, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - }); - - it('is ambiguously-zoned and has a time even when no hours/minutes/seconds', function() { - var a = [ 2014, 5, 8 ]; - var mom = construct(a); - expect(mom.toArray()).toEqual([ 2014, 5, 8, 0, 0, 0, 0 ]); - expect(mom.hasTime()).toBe(true); - expect(mom.hasZone()).toBe(false); - }); - }); - - describe('when given an existing FullCalendar moment', function() { - - it('remains ambiguously-zoned', function() { - var noTzMoment = $.fullCalendar.moment.parseZone('2014-05-28T00:00:00'); - var newMoment = construct(noTzMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(false); - }); - - it('remains ambiguously-timed', function() { - var noTimeMoment = $.fullCalendar.moment('2014-05-28'); - var newMoment = construct(noTimeMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(false); - expect(newMoment.hasZone()).toBe(false); - }); - }); - - [ - { description: 'when given an existing FullCalendar moment', moment: $.fullCalendar.moment }, - { description: 'when given an existing basic moment', moment: moment } - ] - .forEach(function(scenario) { - describe(scenario.description, function() { - - it('remains local', function() { - var localMoment = scenario.moment('2014-05-28T00:00:00'); - var newMoment = construct(localMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(localMoment.zone()); - }); - - it('remains UTC', function() { - var utcMoment = scenario.moment.utc('2014-05-28T00:00:00'); - var newMoment = construct(utcMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(0); - }); - - it('remains in a custom timezone', function() { - var tzMoment = scenario.moment.parseZone('2014-05-28T00:00:00+13:00'); - var newMoment = construct(tzMoment); - expect(newMoment.toArray()).toEqual([ 2014, 4, 28, 0, 0, 0, 0 ]); - expect(newMoment.hasTime()).toBe(true); - expect(newMoment.hasZone()).toBe(true); - expect(newMoment.zone()).toBe(-780); - }); - - it('produces a new moment that is in no way bound to the old', function() { - var oldMoment = scenario.moment(); - var newMoment = construct(oldMoment); - expect(newMoment).not.toBe(oldMoment); - expect(+newMoment).toBe(+oldMoment); - newMoment.add(1, 'months'); - expect(+newMoment).not.toBe(+oldMoment); - }); - - }); - }); -} - -})(); \ No newline at end of file diff --git a/tests/automated/moment-formatting.js b/tests/automated/moment-formatting.js deleted file mode 100644 index 85f09c3..0000000 --- a/tests/automated/moment-formatting.js +++ /dev/null @@ -1,68 +0,0 @@ - -describe('moment date formatting', function() { - - it('should let vanilla momentjs formatting to work correctly', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T14:00:00'); - var s1 = mom.format('dddd, MMMM Do YYYY, h:mm:ss a'); - var s2 = mom.format('ddd, hA Z'); - expect(s1).toEqual('Tuesday, May 20th 2014, 2:00:00 pm'); - expect(s2).toEqual('Tue, 2PM +00:00'); - }); - - it('should allow momentjs text escaping', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T14:00:00'); - var s = mom.format('MMMM Do YYYY [TIME:] h:mm:ss a'); - expect(s).toEqual('May 20th 2014 TIME: 2:00:00 pm'); - }); - - it('should correctly output LT (regression)', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var s = mom.format('ddd, LT'); - expect(s).toEqual('Tue, 6:00 AM'); - }); - - it('should correctly output hT (regression)', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var s = mom.format('ddd, hT'); - expect(s).toEqual('Tue, 6A'); - }); - - it('should output A/P with the \'T\' formatting character', function() { - var mom1 = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var mom2 = $.fullCalendar.moment.utc('2014-05-20T14:00:00'); - var s1 = mom1.format('ddd, h T'); - var s2 = mom2.format('ddd, h T'); - expect(s1).toEqual('Tue, 6 A'); - expect(s2).toEqual('Tue, 2 P'); - }); - - it('should output A/P with the \'t\' formatting character', function() { - var mom1 = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var mom2 = $.fullCalendar.moment.utc('2014-05-20T14:00:00'); - var s1 = mom1.format('ddd, h t'); - var s2 = mom2.format('ddd, h t'); - expect(s1).toEqual('Tue, 6 a'); - expect(s2).toEqual('Tue, 2 p'); - }); - - it('should output non-zero numbers enclosed in parenthesis', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T06:30:00'); - var s = mom.format('ddd h(:mm)a'); - expect(s).toEqual('Tue 6:30am'); - }); - - it('should not output zero numbers enclosed in parenthesis', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var s = mom.format('ddd h(:mm)a'); - expect(s).toEqual('Tue 6am'); - }); - - it('should allow escaping of parenthesis as literal text', function() { - var mom = $.fullCalendar.moment.utc('2014-05-20T06:00:00'); - var s1 = mom.format('ddd h[(]:mm)a'); - //var s2 = mom.format('ddd h(:mm[)]a'); // we currently cant nest [] inside () - expect(s1).toEqual('Tue 6(:00)am'); - //expect(s2).toEqual('Tue 6(:00)am'); - }); - -}); diff --git a/tests/automated/moment-query.js b/tests/automated/moment-query.js deleted file mode 100644 index 5d659e9..0000000 --- a/tests/automated/moment-query.js +++ /dev/null @@ -1,177 +0,0 @@ - -(function() { - - var momentTypeSuffixes = { - 'ambiguously-timed': '', - 'ambiguously-zoned': 'T00:30:00', - timed: 'T00:30:00-0500' - }; - - describe('isSame', function() { - - describe('when no units provided', function() { - - it('returns false when the dates are different', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T07:00:00'); - expect(m1.isSame(m2)).toBe(false); - }); - - it('returns false when the dates are the same, but different zone-ambiguation', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00+00:00'); - expect(m1.isSame(m2)).toBe(false); - }); - - it('returns false when the dates are the same, but different hasTime', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - expect(m1.isSame(m2)).toBe(false); - }); - - it('returns true when the dates are exactly the same', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25'); - expect(m1.isSame(m2)).toBe(true); - m1 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - expect(m1.isSame(m2)).toBe(true); - m1 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00+05:00'); - m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00+05:00'); - expect(m1.isSame(m2)).toBe(true); - }); - }); - - describe('when units are provided', function() { - - it('returns true when dates are the same day but different zone-ambiguation', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00-11:00'); - expect(m1.isSame(m2, 'day')).toBe(true); - }); - - it('returns true when dates are the same day but different hasTime', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-25'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00-11:00'); - expect(m1.isSame(m2, 'day')).toBe(true); - }); - - it('returns false when dates are a different day', function() { - var m1 = $.fullCalendar.moment.parseZone('2014-08-24T00:00:00'); - var m2 = $.fullCalendar.moment.parseZone('2014-08-25T06:00:00'); - expect(m1.isSame(m2, 'day')).toBe(false); - }); - }); - }); - - describe('isWithin', function() { - $.each(momentTypeSuffixes, function(thisType, thisSuffix) { - describe('when the moment is ' + thisType, function() { - $.each(momentTypeSuffixes, function(otherType, otherSuffix) { - describe('and other moments are ' + otherType, function() { - - it('is clearly within', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other1 = $.fullCalendar.moment.parseZone('2014-06-01' + otherSuffix); - var other2 = $.fullCalendar.moment.parseZone('2014-07-01' + otherSuffix); - var res = mom.isWithin(other1, other2); - expect(res).toBe(true); - }); - - it('is clearly not within', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other1 = $.fullCalendar.moment.parseZone('2014-09-01' + otherSuffix); - var other2 = $.fullCalendar.moment.parseZone('2014-10-01' + otherSuffix); - var res = mom.isWithin(other1, other2); - expect(res).toBe(false); - }); - - it('is within when equal to start', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other1 = $.fullCalendar.moment.parseZone('2014-06-15' + otherSuffix); - var other2 = $.fullCalendar.moment.parseZone('2014-07-01' + otherSuffix); - var res = mom.isWithin(other1, other2); - expect(res).toBe(true); - }); - - it('is not within when equal to end', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other1 = $.fullCalendar.moment.parseZone('2014-06-01' + otherSuffix); - var other2 = $.fullCalendar.moment.parseZone('2014-06-15' + otherSuffix); - var res = mom.isWithin(other1, other2); - expect(res).toBe(false); - }); - - }); - }); - }); - }); - }); - - describe('isBefore', function() { - $.each(momentTypeSuffixes, function(thisType, thisSuffix) { - describe('when the moment is ' + thisType, function() { - $.each(momentTypeSuffixes, function(otherType, otherSuffix) { - describe('and other moment is ' + otherType, function() { - - it('is clearly before', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2015-01-01' + otherSuffix); - var res = mom.isBefore(other); - expect(res).toBe(true); - }); - - it('is clearly not before', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2013-01-01' + otherSuffix); - var res = mom.isBefore(other); - expect(res).toBe(false); - }); - - it('is equal', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2014-06-15' + otherSuffix); - var res = mom.isBefore(other); - expect(res).toBe(false); - }); - - }); - }); - }); - }); - }); - - describe('isAfter', function() { - $.each(momentTypeSuffixes, function(thisType, thisSuffix) { - describe('when the moment is ' + thisType, function() { - $.each(momentTypeSuffixes, function(otherType, otherSuffix) { - describe('and other moment is ' + otherType, function() { - - it('is clearly after', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2013-01-01' + otherSuffix); - var res = mom.isAfter(other); - expect(res).toBe(true); - }); - - it('is clearly not after', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2015-01-01' + otherSuffix); - var res = mom.isAfter(other); - expect(res).toBe(false); - }); - - it('is equal', function() { - var mom = $.fullCalendar.moment.parseZone('2014-06-15' + thisSuffix); - var other = $.fullCalendar.moment.parseZone('2014-06-15' + otherSuffix); - var res = mom.isAfter(other); - expect(res).toBe(false); - }); - - }); - }); - }); - }); - }); - -})(); diff --git a/tests/automated/monthNames.js b/tests/automated/monthNames.js deleted file mode 100644 index 99ec619..0000000 --- a/tests/automated/monthNames.js +++ /dev/null @@ -1,103 +0,0 @@ -describe('month name', function() { - var settings = {}; - var referenceDate = '2014-01-01'; // The day the world is hung-over - var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]; - - beforeEach(function() { - affix('#cal'); - settings = { - defaultDate: referenceDate - }; - }); - - afterEach(function() { - moment.lang('en'); // reset moment's global language - }); - - [ 'month', 'agendaDay', 'basicDay' ].forEach(function(viewClass, index, viewClasses) { - describe('when view is ' + viewClass, function() { - beforeEach(function() { - settings.defaultView = viewClass; - }); - - describe('when lang is default', function() { - beforeEach(function() { - settings.lang = 'en'; - moment.lang('en'); - }); - - moment.months().forEach(function(month, index, months) { - it('should be ' + month, function(done) { - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.eventAfterAllRender = function() { - expect($('.fc-toolbar h2')).toContainText(month); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - - languages.forEach(function(language, index, languages) { - describe('when lang is ' + language, function() { - beforeEach(function() { - settings.lang = language; - moment.lang(language); - }); - - moment.months().forEach(function(month, index, months) { // `month` will always be English - it('should be the translated name for ' + month, function(done) { - var langMonths = moment.months(); - var langMonth = langMonths[index]; - - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.eventAfterAllRender = function() { - if (viewClass == 'month') { // with month view check for occurence of the monthname in the title - expect($('.fc-toolbar h2')).toContainText(langMonth); - } - else { // with day views ensure that title contains the properly formatted phrase - expect($('.fc-toolbar h2')).toHaveText(settings.defaultDate.format('LL')); - } - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - }); - - describe('when names are specified', function() { - var months = [ - 'I', - 'II', - 'III', - 'IV', - 'V', - 'VI', - 'VII', - 'IIX', - 'IX', - 'X', - 'XI', - 'XII' - ]; - - months.forEach(function(month, index, months) { // `month` is our custom month name - it('should be the translated name for ' + month, function(done) { - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.monthNames = months; - settings.eventAfterAllRender = function() { - expect($('.fc-toolbar h2')).toContainText(month); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - }); - }); - -}); diff --git a/tests/automated/monthNamesShort.js b/tests/automated/monthNamesShort.js deleted file mode 100644 index 533227a..0000000 --- a/tests/automated/monthNamesShort.js +++ /dev/null @@ -1,98 +0,0 @@ -describe('short month name', function() { - var settings = {}; - var referenceDate = '2014-01-01'; // The day the world is hung-over - var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]; - - beforeEach(function() { - affix('#cal'); - settings = { - defaultDate: referenceDate - }; - }); - - afterEach(function() { - moment.lang('en'); // reset moment's global language - }); - - [ 'agendaWeek', 'basicWeek' ].forEach(function(viewClass, index, viewClasses) { - describe('when view is ' + viewClass, function() { - beforeEach(function() { - settings.defaultView = viewClass; - }); - - describe('when lang is default', function() { - beforeEach(function() { - settings.lang = 'en'; - moment.lang('en'); - }); - - moment.monthsShort().forEach(function(monthShort, index) { - it('should be ' + monthShort, function(done) { - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.eventAfterAllRender = function() { - expect($('.fc-toolbar h2')).toContainText(monthShort); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - - languages.forEach(function(language, index, languages) { - describe('when lang is ' + language, function() { - beforeEach(function() { - settings.lang = language; - moment.lang(language); - }); - - moment.monthsShort().forEach(function(monthShort, index) { // `monthShort` will always be English - it('should be the translated name for ' + monthShort, function(done) { - var langMonthsShort = moment.monthsShort(); - var langMonthShort = langMonthsShort[index]; - - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.eventAfterAllRender = function() { - expect($('.fc-toolbar h2')).toContainText(langMonthShort); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - }); - - describe('when names are specified', function() { - var monthsShort = [ - 'I', - 'II', - 'III', - 'IV', - 'V', - 'VI', - 'VII', - 'IIX', - 'IX', - 'X', - 'XI', - 'XII' - ]; - - monthsShort.forEach(function(monthShort, index) { // `monthShort` will be our custom month name - it('should be the translated name for ' + monthShort, function(done) { - settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months'); - settings.monthNamesShort = monthsShort; - settings.eventAfterAllRender = function() { - expect($('.fc-toolbar h2')).toContainText(monthShort); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - }); - }); - -}); diff --git a/tests/automated/nextDayThreshold.js b/tests/automated/nextDayThreshold.js deleted file mode 100644 index c934d4c..0000000 --- a/tests/automated/nextDayThreshold.js +++ /dev/null @@ -1,70 +0,0 @@ - -describe('nextDayThreshold', function() { - - // when a view object exposes its nextDayThreshold value (after some refactoring)... - // TODO: detect the default of 9am - // TODO: detect 2 or more different types of Duration-ish parsing - - beforeEach(function() { - affix('#cal'); - }); - - it('renders an event before the threshold', function() { - $('#cal').fullCalendar({ - nextDayThreshold: '10:00:00', - defaultDate: '2014-06', - defaultView: 'month', - events: [ - { - title: 'event1', - start: '2014-06-08T22:00:00', - end: '2014-06-10T09:00:00' - } - ] - }); - expect(renderedDayCount()).toBe(2); - }); - - it('renders an event equal to the threshold', function() { - $('#cal').fullCalendar({ - nextDayThreshold: '10:00:00', - defaultDate: '2014-06', - defaultView: 'month', - events: [ - { - title: 'event1', - start: '2014-06-08T22:00:00', - end: '2014-06-10T10:00:00' - } - ] - }); - expect(renderedDayCount()).toBe(3); - }); - - it('renders an event after the threshold', function() { - $('#cal').fullCalendar({ - nextDayThreshold: '10:00:00', - defaultDate: '2014-06', - defaultView: 'month', - events: [ - { - title: 'event1', - start: '2014-06-08T22:00:00', - end: '2014-06-10T11:00:00' - } - ] - }); - expect(renderedDayCount()).toBe(3); - }); - - - function renderedDayCount() { // assumes only one event on the calendar - var cellWidth = $('.fc-sun').outerWidth(); // works with basic and agenda - var totalWidth = 0; - $('.fc-event').each(function() { - totalWidth += $(this).outerWidth(); - }); - return Math.round(totalWidth / cellWidth); - } - -}); \ No newline at end of file diff --git a/tests/automated/now.js b/tests/automated/now.js deleted file mode 100644 index 2ab1106..0000000 --- a/tests/automated/now.js +++ /dev/null @@ -1,59 +0,0 @@ -describe('now', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-05-01' - }; - }); - - describe('when month view', function() { - beforeEach(function() { - options.defaultView = 'month'; - }); - it('changes the highlighted day when customized', function() { - options.now = '2014-05-06'; - $('#cal').fullCalendar(options); - var todayCell = $('#cal td.fc-today'); - var todayDate = todayCell.data('date'); - expect(todayDate).toEqual('2014-05-06'); - }); - }); - - describe('when agendaWeek view', function() { - beforeEach(function() { - options.defaultView = 'agendaWeek'; - }); - it('changes the highlighted day when customized', function() { - options.now = '2014-04-29T12:00:00'; - $('#cal').fullCalendar(options); - var todayCell = $('#cal td.fc-today'); - expect(todayCell.data('date')).toBe('2014-04-29'); - }); - }); - - it('accepts a function that returns a moment', function() { - options.defaultView = 'month'; - options.now = function() { - return moment.utc('2014-05-01'); - }; - $('#cal').fullCalendar(options); - var todayCell = $('#cal td.fc-today'); - var todayDate = todayCell.data('date'); - expect(todayDate).toEqual('2014-05-01'); - }); - - it('accepts a function that returns a moment-ish string', function() { - options.defaultView = 'month'; - options.now = function() { - return '2014-05-01'; - }; - $('#cal').fullCalendar(options); - var todayCell = $('#cal td.fc-today'); - var todayDate = todayCell.data('date'); - expect(todayDate).toEqual('2014-05-01'); - }); - -}); \ No newline at end of file diff --git a/tests/automated/scrollTime.js b/tests/automated/scrollTime.js deleted file mode 100644 index 586a203..0000000 --- a/tests/automated/scrollTime.js +++ /dev/null @@ -1,40 +0,0 @@ -describe('scrollTime', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultView: 'agendaWeek' - }; - }); - - it('accepts a string Duration', function() { - options.scrollTime = '02:00:00'; - options.height = 400; // short enough to make scrolling happen - $('#cal').fullCalendar(options); - var slotCell = $('.fc-slats tr:eq(4)'); // 2am slot - var slotTop = slotCell.position().top; - var scrollContainer = $('.fc-time-grid-container'); - var scrollTop = scrollContainer.scrollTop(); - var diff = Math.abs(slotTop - scrollTop); - expect(slotTop).toBeGreaterThan(0); - expect(scrollTop).toBeGreaterThan(0); - expect(diff).toBeLessThan(3); - }); - - it('accepts a Duration object', function() { - options.scrollTime = { hours: 2 }; - options.height = 400; // short enough to make scrolling happen - $('#cal').fullCalendar(options); - var slotCell = $('.fc-slats tr:eq(4)'); // 2am slot - var slotTop = slotCell.position().top; - var scrollContainer = $('.fc-time-grid-container'); - var scrollTop = scrollContainer.scrollTop(); - var diff = Math.abs(slotTop - scrollTop); - expect(slotTop).toBeGreaterThan(0); - expect(scrollTop).toBeGreaterThan(0); - expect(diff).toBeLessThan(3); - }); - -}); \ No newline at end of file diff --git a/tests/automated/select-callback.js b/tests/automated/select-callback.js deleted file mode 100644 index da430f5..0000000 --- a/tests/automated/select-callback.js +++ /dev/null @@ -1,185 +0,0 @@ -describe('select callback', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-05-25', - selectable: true - }; - }); - - afterEach(function() { - $('#cal').fullCalendar('destroy'); - }); - - [ false, true ].forEach(function(isRTL) { - describe('when isRTL is ' + isRTL, function() { - beforeEach(function() { - options.isRTL = isRTL; - }); - describe('when in month view', function() { - beforeEach(function() { - options.defaultView = 'month'; - }); - it('gets fired correctly when the user selects cells', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-04-28'); - expect(end).toEqualMoment('2014-05-07'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-day[data-date="2014-04-28"]').simulate('drag-n-drop', { - dropTarget: '.fc-day[data-date="2014-05-06"]', - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - it('gets fired correctly when the user selects just one cell', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-04-28'); - expect(end).toEqualMoment('2014-04-29'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-day[data-date="2014-04-28"]').simulate('drag-n-drop', { - dropTarget: '.fc-day[data-date="2014-04-28"]', - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - }); - - describe('when in agendaWeek view', function() { - beforeEach(function() { - options.defaultView = 'agendaWeek'; - }); - describe('when selecting all-day slots', function() { - it('gets fired correctly when the user selects cells', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-05-28'); - expect(end).toEqualMoment('2014-05-30'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag-n-drop', { // will be 2014-05-28 for LTR and RTL - dx: $('.fc-sun').outerWidth() * (isRTL ? -1 : 1), // the width of one column - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - it('gets fired correctly when the user selects a single cell', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-05-28'); - expect(end).toEqualMoment('2014-05-29'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag-n-drop', { // will be 2014-05-28 for LTR and RTL - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - }); - describe('when selecting timed slots', function(done) { - it('gets fired correctly when the user selects slots', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(true); - expect(end.hasTime()).toEqual(true); - expect(start).toEqualMoment('2014-05-28T09:00:00'); - expect(end).toEqualMoment('2014-05-28T10:30:00'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 - dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - it('gets fired correctly when the user selects slots in a different day', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(true); - expect(end.hasTime()).toEqual(true); - expect(start).toEqualMoment('2014-05-28T09:00:00'); - expect(end).toEqualMoment('2014-05-29T10:30:00'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 - dx: $('.fc-day-header:first').outerWidth() * .9 * (isRTL ? -1 : 1), // one day ahead - dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - it('gets fired correctly when the user selects a single slot', function(done) { - options.select = function(start, end, jsEvent, view) { - expect(moment.isMoment(start)).toEqual(true); - expect(moment.isMoment(end)).toEqual(true); - expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination - expect(typeof view).toEqual('object'); // " - expect(start.hasTime()).toEqual(true); - expect(end.hasTime()).toEqual(true); - expect(start).toEqualMoment('2014-05-28T09:00:00'); - expect(end).toEqualMoment('2014-05-28T09:30:00'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 - callback: function() { - expect(options.select).toHaveBeenCalled(); - done(); - } - }); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/select-method.js b/tests/automated/select-method.js deleted file mode 100644 index 63299d4..0000000 --- a/tests/automated/select-method.js +++ /dev/null @@ -1,198 +0,0 @@ -describe('select method', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-05-25', - selectable: true - }; - }); - - afterEach(function() { - $('#cal').fullCalendar('destroy'); - }); - - /* - THINGS TO IMPLEMENT IN SRC (in addition to notes further down): - - better date normalization (for both render and reporting to select callback) - - if second date is the same or before the first - - if given a mixture of timed/all-day - - for basic/month views, when given timed dates, should really be all-day - */ - - [ false, true ].forEach(function(isRTL) { - describe('when isRTL is ' + isRTL, function() { - beforeEach(function() { - options.isRTL = isRTL; - }); - describe('when in month view', function() { - beforeEach(function() { - options.defaultView = 'month'; - }); - describe('when called with all-day moments', function() { - describe('when in bounds', function() { - it('renders a selection', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-07', '2014-05-09'); - expect($('.fc-highlight')).toBeVisible(); - }); - it('renders a selection when called with one argument', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-07'); - expect($('.fc-highlight')).toBeVisible(); - }); - it('fires a selection event', function() { - options.select = function(start, end) { - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-05-07'); - expect(end).toEqualMoment('2014-05-09'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-07', '2014-05-09'); - expect(options.select).toHaveBeenCalled(); - }); - }); - describe('when out of bounds', function() { - it('doesn\'t render a selection', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2015-05-07', '2015-05-09'); - expect($('.fc-highlight')).not.toBeVisible(); - }); - /* - TODO: implement this behavior - it('doesn\'t fire a selection event', function() { - options.select = function(start, end) { - expect(start).toEqualMoment('2014-05-07'); - expect(end).toEqualMoment('2014-05-09'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2015-05-07', '2015-05-09'); - expect(options.select).not.toHaveBeenCalled(); - }); - */ - }); - }); - describe('when called with timed moments', function() { - it('renders a selection', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-07T06:00:00', '2014-05-09T07:00:00'); - expect($('.fc-highlight')).toBeVisible(); - }); - it('fires a selection event', function() { - options.select = function(start, end) { - expect(start.hasTime()).toEqual(true); - expect(end.hasTime()).toEqual(true); - expect(start).toEqualMoment('2014-05-07T06:00:00'); - expect(end).toEqualMoment('2014-05-09T06:00:00'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-07T06:00:00', '2014-05-09T06:00:00'); - expect(options.select).toHaveBeenCalled(); - }); - }); - }); - describe('when in agendaWeek view', function() { // May 25 - 31 - beforeEach(function() { - options.defaultView = 'agendaWeek'; - options.scrollTime = '01:00:00'; // so that most events will be below the divider - options.height = 400; // short enought to make scrolling happen - }); - describe('when called with timed moments', function() { - describe('when in bounds', function() { - it('renders a selection when called with one argument', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26T06:00:00'); - expect($('.fc-highlight')).toBeVisible(); - }); - it('renders a selection over the slot area', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26T06:00:00', '2014-05-26T08:00:00'); - expect($('.fc-highlight')).toBeVisible(); - var slotAreaTop = $('.fc-time-grid-container').offset().top; - var overlayTop = $('.fc-highlight').offset().top; - expect(overlayTop).toBeGreaterThan(slotAreaTop); - }); - }); - describe('when out of bounds', function() { - it('doesn\'t render a selection', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2015-05-26T06:00:00', '2015-05-26T07:00:00'); - expect($('.fc-highlight')).not.toBeVisible(); - }); - /* - TODO: implement this behavior - it('doesn\'t fire a selection event', function() { - options.select = function(start, end) { - expect(start).toEqualMoment('2015-05-07T06:00:00'); - expect(end).toEqualMoment('2015-05-09T07:00:00'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2015-05-07T06:00:00', '2015-05-09T07:00:00'); - expect(options.select).not.toHaveBeenCalled(); - }); - */ - }); - }); - describe('when called with all-day moments', function() { // forget about in/out bounds for this :) - describe('when allDaySlot is on', function() { - beforeEach(function() { - options.allDaySlot = true; - }); - it('renders a selection over the day area', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect($('.fc-highlight')).toBeVisible(); - var slotAreaTop = $('.fc-time-grid-container').offset().top; - var overlayTop = $('.fc-highlight').offset().top; - expect(overlayTop).toBeLessThan(slotAreaTop); - }); - it('fires a selection event', function() { - options.select = function(start, end) { - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-05-26'); - expect(end).toEqualMoment('2014-05-28'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect(options.select).toHaveBeenCalled(); - }); - }); - describe('when allDaySlot is off', function() { - beforeEach(function() { - options.allDaySlot = false; - }); - it('doesn\'t render', function() { - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect($('.fc-highlight')).not.toBeVisible(); - }); - /* - TODO: implement - it('doesn\'t fire a selection event', function() { - options.select = function(start, end) { - expect(start.hasTime()).toEqual(false); - expect(end.hasTime()).toEqual(false); - expect(start).toEqualMoment('2014-05-26'); - expect(end).toEqualMoment('2014-05-28'); - }; - spyOn(options, 'select').and.callThrough(); - $('#cal').fullCalendar(options); - $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect(options.select).not.toHaveBeenCalled(); - }); - */ - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/slotDuration.js b/tests/automated/slotDuration.js deleted file mode 100644 index d7cd87e..0000000 --- a/tests/automated/slotDuration.js +++ /dev/null @@ -1,96 +0,0 @@ - -describe('slotDuration', function() { - - var minutesInADay = 1440; - - beforeEach(function() { - affix('#cal'); - }); - - describe('when using the default settings', function() { - describe('in agendaWeek', function() { - it('should have slots 1440/30 slots', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); - }); - }); - describe('in agendaDay', function() { - it('should have slots 1440/30 slots', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); - }); - }); - }); - - describe('when slotMinutes is set to 30', function() { - describe('in agendaWeek', function() { - it('should have slots 1440/30 slots', function() { - var options = { - defaultView: 'agendaWeek' - }; - $('#cal').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); - }); - }); - describe('in agendaDay', function() { - it('should have slots 1440/30 slots', function() { - var options = { - defaultView: 'agendaDay' - }; - $('#cal').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); - }); - }); - }); - - describe('when slotMinutes is set to a series of times', function() { - - var slotMinutesList = [ 10, 12, 15, 17, 20, 30, 35, 45, 60, 62, 120, 300 ]; - - describe('in agendaWeek', function() { - beforeEach(function() { - affix('#cal2'); - }); - slotMinutesList.forEach(function(slotMinutes) { - it('should have slots 1440/x slots', function() { - var options = { - defaultView: 'agendaWeek', - slotDuration: { minutes: slotMinutes } - }; - $('#cal2').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - var expected = Math.ceil(minutesInADay / slotMinutes); - expect(slotCount).toEqual(expected); - }); - }); - }); - - describe('in agendaDay', function() { - beforeEach(function() { - affix('#cal2'); - }); - slotMinutesList.forEach(function(slotMinutes) { - it('should have slots 1440/x slots', function() { - var options = { - defaultView: 'agendaWeek', - slotDuration: { minutes: slotMinutes } - }; - $('#cal2').fullCalendar(options); - var slotCount = $('.fc-slats tr').length; - var expected = Math.ceil(minutesInADay / slotMinutes); - expect(slotCount).toEqual(expected); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/themeButtonIcons.js b/tests/automated/themeButtonIcons.js deleted file mode 100644 index 11c279a..0000000 --- a/tests/automated/themeButtonIcons.js +++ /dev/null @@ -1,65 +0,0 @@ -describe('themeButtonIcons', function() { - - var options; - var defaultSelectors = [ - '.ui-icon-circle-triangle-w', - '.ui-icon-circle-triangle-e', - '.ui-icon-seek-prev', - '.ui-icon-seek-next' - ]; - - beforeEach(function() { - affix('#cal'); - options = { - header: { - left: 'prevYear,prev,next,nextYear today', - center: 'title', - right: 'month,agendaWeek,agendaDay' - } - }; - }); - - describe('when theme is off', function() { - beforeEach(function() { - options.theme = false; - }); - it('should not have any of the default theme icon classes', function() { - $('#cal').fullCalendar(options); - defaultSelectors.forEach(function(selector) { - expect($(selector)).not.toBeInDOM(); - }); - }); - }); - - describe('when theme is on', function() { - - beforeEach(function() { - options.theme = true; - }); - - it('should have all of the deafult theme icon classes', function() { - $('#cal').fullCalendar(options); - defaultSelectors.forEach(function(selector) { - expect($(selector)).toBeInDOM(); - }); - }); - - it('should accept values that override the individual defaults', function() { - options.themeButtonIcons = { - prev: 'arrowthickstop-1-w', - next: 'arrowthickstop-1-e' - }; - $('#cal').fullCalendar(options); - [ - '.ui-icon-arrowthickstop-1-w', - '.ui-icon-arrowthickstop-1-e', - '.ui-icon-seek-prev', // prev/next year should remain - '.ui-icon-seek-next' // - ] - .forEach(function(selector) { - expect($(selector)).toBeInDOM(); - }); - }); - }); - -}); \ No newline at end of file diff --git a/tests/automated/timeFormat.js b/tests/automated/timeFormat.js deleted file mode 100644 index bca652d..0000000 --- a/tests/automated/timeFormat.js +++ /dev/null @@ -1,68 +0,0 @@ -describe('timeFormat', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-06-04', - events: [ { - title: 'my event', - start: '2014-06-04T15:00:00', - end: '2014-06-04T17:00:00' - } ] - }; - }); - - function getRenderedEventTime() { - return $('.fc-event:first .fc-time').text(); - } - - describe('when in month view', function() { - - beforeEach(function() { - options.defaultView = 'month'; - }); - - it('renders correctly when default', function() { - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('3p'); - }); - - it('renders correctly when default and the language is customized', function() { - options.lang = 'en-gb'; - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('15'); - }); - - it('renders correctly when customized', function() { - options.timeFormat = 'Hh:mm:mm'; - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('153:00:00'); - }); - }); - - describe('when in agendaWeek view', function() { - - beforeEach(function() { - options.defaultView = 'agendaWeek'; - }); - - it('renders correctly when default', function() { - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('3:00 - 5:00'); - }); - - it('renders correctly when default and the language is customized', function() { - options.lang = 'en-gb'; - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('15:00 - 17:00'); - }); - - it('renders correctly when customized', function() { - options.timeFormat = 'Hh:mm:mm'; - $('#cal').fullCalendar(options); - expect(getRenderedEventTime()).toBe('153:00:00 - 175:00:00'); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/timezone.js b/tests/automated/timezone.js deleted file mode 100644 index 0860151..0000000 --- a/tests/automated/timezone.js +++ /dev/null @@ -1,113 +0,0 @@ - -describe('timezone', function() { - - // NOTE: Only deals with the processing of *received* events. - // Verification of a correct AJAX *request* is done in events-json-feed.js - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - defaultView: 'month', - defaultDate: '2014-05-01', - events: [ - { - id: '1', - title: 'all day event', - start: '2014-05-02' - }, - { - id: '2', - title: 'timed event', - start: '2014-05-10T12:00:00' - }, - { - id: '3', - title: 'timed and zoned event', - start: '2014-05-10T14:00:00+11:00' - } - ] - }; - }); - - it('receives events correctly when no timezone', function(done) { - options.eventAfterAllRender = function() { - var allDayEvent = $('#cal').fullCalendar('clientEvents', '1')[0]; - var timedEvent = $('#cal').fullCalendar('clientEvents', '2')[0]; - var zonedEvent = $('#cal').fullCalendar('clientEvents', '3')[0]; - expect(allDayEvent.start.hasZone()).toEqual(false); - expect(allDayEvent.start.hasTime()).toEqual(false); - expect(allDayEvent.start.format()).toEqual('2014-05-02'); - expect(timedEvent.start.hasZone()).toEqual(false); - expect(timedEvent.start.hasTime()).toEqual(true); - expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00'); - expect(zonedEvent.start.hasZone()).toEqual(true); - expect(zonedEvent.start.hasTime()).toEqual(true); - expect(zonedEvent.start.format()).toEqual('2014-05-10T14:00:00+11:00'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('receives events correctly when local timezone', function(done) { - options.timezone = 'local'; - options.eventAfterAllRender = function() { - var allDayEvent = $('#cal').fullCalendar('clientEvents', '1')[0]; - var timedEvent = $('#cal').fullCalendar('clientEvents', '2')[0]; - var zonedEvent = $('#cal').fullCalendar('clientEvents', '3')[0]; - expect(allDayEvent.start.hasZone()).toEqual(false); - expect(allDayEvent.start.hasTime()).toEqual(false); - expect(allDayEvent.start.format()).toEqual('2014-05-02'); - expect(timedEvent.start.hasZone()).toEqual(true); - expect(timedEvent.start.hasTime()).toEqual(true); - expect(timedEvent.start.zone()).toEqual(new Date(2014, 4, 10, 12).getTimezoneOffset()); - expect(zonedEvent.start.hasZone()).toEqual(true); - expect(zonedEvent.start.hasTime()).toEqual(true); - expect(zonedEvent.start.zone()).toEqual(new Date('Sat May 10 2014 14:00:00 GMT+1100').getTimezoneOffset()); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('receives events correctly when UTC timezone', function(done) { - options.timezone = 'UTC'; - options.eventAfterAllRender = function() { - var allDayEvent = $('#cal').fullCalendar('clientEvents', '1')[0]; - var timedEvent = $('#cal').fullCalendar('clientEvents', '2')[0]; - var zonedEvent = $('#cal').fullCalendar('clientEvents', '3')[0]; - expect(allDayEvent.start.hasZone()).toEqual(false); - expect(allDayEvent.start.hasTime()).toEqual(false); - expect(allDayEvent.start.format()).toEqual('2014-05-02'); - expect(timedEvent.start.hasZone()).toEqual(true); - expect(timedEvent.start.hasTime()).toEqual(true); - expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00+00:00'); - expect(zonedEvent.start.hasZone()).toEqual(true); - expect(zonedEvent.start.hasTime()).toEqual(true); - expect(zonedEvent.start.format()).toEqual('2014-05-10T03:00:00+00:00'); - done(); - }; - $('#cal').fullCalendar(options); - }); - - it('receives events correctly when custom timezone', function(done) { - options.timezone = 'America/Chicago'; - options.eventAfterAllRender = function() { - var allDayEvent = $('#cal').fullCalendar('clientEvents', '1')[0]; - var timedEvent = $('#cal').fullCalendar('clientEvents', '2')[0]; - var zonedEvent = $('#cal').fullCalendar('clientEvents', '3')[0]; - expect(allDayEvent.start.hasZone()).toEqual(false); - expect(allDayEvent.start.hasTime()).toEqual(false); - expect(allDayEvent.start.format()).toEqual('2014-05-02'); - expect(timedEvent.start.hasZone()).toEqual(false); - expect(timedEvent.start.hasTime()).toEqual(true); - expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00'); - expect(zonedEvent.start.hasZone()).toEqual(true); - expect(zonedEvent.start.hasTime()).toEqual(true); - expect(zonedEvent.start.format()).toEqual('2014-05-10T14:00:00+11:00'); - done(); - }; - $('#cal').fullCalendar(options); - }); - -}); diff --git a/tests/automated/titleFormat.js b/tests/automated/titleFormat.js deleted file mode 100644 index 3b687db..0000000 --- a/tests/automated/titleFormat.js +++ /dev/null @@ -1,97 +0,0 @@ -describe('titleFormat', function() { - - var SELECTOR = '.fc-toolbar h2'; - - beforeEach(function() { - affix('#cal'); - }); - - describe('when default', function() { - - var viewWithFormat = [ - { view: 'month', expected: 'June 2014' }, - { view: 'basicWeek', expected: /Jun 8 - 14,? 2014/ }, // moment changed LL defaults after 2.8 - { view: 'agendaWeek', expected: /Jun 8 - 14,? 2014/ }, // " - { view: 'basicDay', expected: /June 12,? 2014/ }, // " - { view: 'agendaDay', expected: /June 12,? 2014/ } // " - ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-06-12' - }); - }); - - it('should have default values', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(SELECTOR).text()).toMatch(crtView.expected); - }; - }); - }); - - describe('when set on a per-view basis', function() { - - var viewWithFormat = [ - { view: 'month', expected: '2014, June' }, - { view: 'basicWeek', expected: '8 - 14 6 2014' }, - { view: 'agendaWeek', expected: '8 - 14, 6, 2014' }, - { view: 'basicDay', expected: 'Thursday June 12 2014' }, - { view: 'agendaDay', expected: 'Thursday, June, 12, 2014' } - ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-06-12', - titleFormat: { - month: 'YYYY, MMMM', - basicWeek: 'D M YYYY', - agendaWeek: 'D, M, YYYY', - basicDay: 'dddd MMMM D YYYY', - agendaDay: 'dddd, MMMM, D, YYYY' - } - }); - }); - - it('should have the correct values', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(SELECTOR).text()).toBe(crtView.expected); - }; - }); - }); - - describe('when default and language is French', function() { - - var viewWithFormat = [ - { view: 'month', expected: 'juin 2014' }, - { view: 'basicWeek', expected: '9 - 15 juin 2014' }, - { view: 'agendaWeek', expected: '9 - 15 juin 2014' }, - { view: 'basicDay', expected: '12 juin 2014' }, - { view: 'agendaDay', expected: '12 juin 2014' } - ]; - - beforeEach(function() { - $('#cal').fullCalendar({ - defaultDate: '2014-06-12', - lang: 'fr' - }); - }); - - it('should have the translated dates', function() { - var cal = $('#cal'); - - for (var i = 0; i < viewWithFormat.length; i++) { - var crtView = viewWithFormat[i]; - cal.fullCalendar('changeView', crtView.view); - expect(cal.find(SELECTOR).text()).toBe(crtView.expected); - }; - }); - }); -}); diff --git a/tests/automated/updateEvent.js b/tests/automated/updateEvent.js deleted file mode 100644 index 146b761..0000000 --- a/tests/automated/updateEvent.js +++ /dev/null @@ -1,485 +0,0 @@ - -describe('updateEvent', function() { - - var options; - var event; - var relatedEvent; - - beforeEach(function() { - affix('#cal'); - options = { - defaultDate: '2014-05-01', - defaultView: 'month' - }; - event = null; - relatedEvent = null; - }); - - function init() { - $('#cal').fullCalendar(options); - var events = $('#cal').fullCalendar('clientEvents'); - event = events[0]; - relatedEvent = events[1]; - } - - describe('when moving an all-day event\'s start', function() { - describe('when a related event doesn\'t have an end', function() { - it('should move the start by the delta and leave the end as null', function() { - options.events = [ - { id: '1', start: '2014-05-01', allDay: true }, - { id: '1', start: '2014-05-10', allDay: true } - ]; - init(); - event.start.add(2, 'days'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-03'); - expect(event.end).toBeNull(); - expect(relatedEvent.start).toEqualMoment('2014-05-12'); - expect(relatedEvent.end).toBeNull(); - }); - }); - describe('when a related event has an end', function() { - it('should move the start and end by the delta', function() { - options.events = [ - { id: '1', start: '2014-05-01', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-12', allDay: true } - ]; - init(); - event.start.add(2, 'days'); - expect(event.start).toEqualMoment('2014-05-03'); - expect(event.end).toBeNull(); - $('#cal').fullCalendar('updateEvent', event); - expect(relatedEvent.start).toEqualMoment('2014-05-12'); - expect(relatedEvent.end).toEqualMoment('2014-05-14'); - }); - }); - }); - - describe('when moving an timed event\'s start', function() { - describe('when a related event doesn\'t have an end', function() { - it('should move the start by the delta and leave the end as null', function() { - options.events = [ - { id: '1', start: '2014-05-01T12:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', allDay: false } - ]; - init(); - event.start.add({ days: 2, hours: 2 }); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-03T14:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.start).toEqualMoment('2014-05-12T08:00:00'); - expect(relatedEvent.end).toBeNull(); - }); - }); - describe('when a related event has an end', function() { - it('should move the start and end by the delta', function() { - options.events = [ - { id: '1', start: '2014-05-01T12:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', end: '2014-05-12T08:00:00', allDay: false } - ]; - init(); - event.start.add({ days: 2, hours: 2 }); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-03T14:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.start).toEqualMoment('2014-05-12T08:00:00'); - expect(relatedEvent.end).toEqualMoment('2014-05-14T10:00:00'); - }); - }); - }); - - describe('when moving an all-day event\'s end', function() { - describe('when a related event doesn\'t have an end', function() { - it('should give the end a default duration plus the delta', function() { - options.defaultAllDayEventDuration = { days: 2 }; - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', allDay: true } - ]; - init(); - event.end.add(1, 'days'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-01'); - expect(event.end).toEqualMoment('2014-05-04'); - expect(relatedEvent.start).toEqualMoment('2014-05-10'); - expect(relatedEvent.end).toEqualMoment('2014-05-13'); - }); - }); - describe('when a related event has an end', function() { - it('should move the end by the delta', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.end.add(1, 'days'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-01'); - expect(event.end).toEqualMoment('2014-05-04'); - expect(relatedEvent.start).toEqualMoment('2014-05-10'); - expect(relatedEvent.end).toEqualMoment('2014-05-14'); - }); - }); - }); - - describe('when moving a timed event\'s end', function() { - describe('when a related event doesn\'t have an end', function() { - describe('when forceEventDuration is off', function() { - it('should give the end a default duration plus the delta', function() { - options.forceEventDuration = false; - options.defaultTimedEventDuration = { hours: 2 }; - options.events = [ - { id: '1', start: '2014-05-01T12:00:00', end: '2014-05-01T15:00:00', allDay: false }, - { id: '1', start: '2014-05-10T16:00:00', allDay: false } - ]; - init(); - event.end.add({ days: 1, hours: 1 }); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-01T12:00:00'); - expect(event.end).toEqualMoment('2014-05-02T16:00:00'); - expect(relatedEvent.start).toEqualMoment('2014-05-10T16:00:00'); - expect(relatedEvent.end).toEqualMoment('2014-05-11T19:00:00'); - }); - }); - describe('when forceEventDuration is on', function() { - it('should give the end a default duration plus the delta', function() { - options.forceEventDuration = true; - options.defaultTimedEventDuration = { hours: 2 }; - options.events = [ - { id: '1', start: '2014-05-01T12:00:00', end: '2014-05-01T15:00:00', allDay: false }, - { id: '1', start: '2014-05-10T16:00:00', allDay: false } - ]; - init(); - event.end.add({ days: 1, hours: 1 }); - relatedEvent.end = null; - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-01T12:00:00'); - expect(event.end).toEqualMoment('2014-05-02T16:00:00'); - expect(relatedEvent.start).toEqualMoment('2014-05-10T16:00:00'); - expect(relatedEvent.end).toEqualMoment('2014-05-11T19:00:00'); - }); - }); - }); - describe('when a related event has an end', function() { - it('should move the end by the delta', function() { - options.events = [ - { id: '1', start: '2014-05-01T12:00:00', end: '2014-05-01T14:00:00', allDay: false }, - { id: '1', start: '2014-05-10T16:00:00', end: '2014-05-10T19:00:00', allDay: false } - ]; - init(); - event.end.add({ days: 1, hours: 1 }); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-01T12:00:00'); - expect(event.end).toEqualMoment('2014-05-02T15:00:00'); - expect(relatedEvent.start).toEqualMoment('2014-05-10T16:00:00'); - expect(relatedEvent.end).toEqualMoment('2014-05-11T20:00:00'); - }); - }); - }); - - describe('when moving an all-day event\'s start and end', function() { - it('should move the start and end of related events', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.start.add(2, 'days'); - event.end.add(3, 'day'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-03'); - expect(event.end).toEqualMoment('2014-05-06'); - expect(relatedEvent.start).toEqualMoment('2014-05-12'); - expect(relatedEvent.end).toEqualMoment('2014-05-16'); - }); - }); - - describe('when moving a timed event\'s start and end', function() { - it('should move the start and end of related events', function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00', end: '2014-05-03T06:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', end: '2014-05-13T06:00:00', allDay: false } - ]; - init(); - event.start.add({ days: 2, hours: 1 }); - event.end.add({ days: 3, hours: 2 }); - $('#cal').fullCalendar('updateEvent', event); - expect(event.start).toEqualMoment('2014-05-03T07:00:00'); - expect(event.end).toEqualMoment('2014-05-06T08:00:00'); - expect(relatedEvent.start).toEqualMoment('2014-05-12T07:00:00'); - expect(relatedEvent.end).toEqualMoment('2014-05-16T08:00:00'); - }); - }); - - describe('when giving a time to an all-day event\'s start', function() { - it('should make the event and related events timed', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.start.time('18:00'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(false); - expect(event.start).toEqualMoment('2014-05-01T18:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(false); - expect(relatedEvent.start).toEqualMoment('2014-05-10T18:00:00'); - expect(relatedEvent.end).toBeNull(); - }); - }); - - describe('when changing an event from all-day to timed', function() { - describe('when the event\'s dates remain all-day', function() { - it('should make the event and related events allDay=false and 00:00', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.allDay = false; - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(false); - expect(event.start).toEqualMoment('2014-05-01T00:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(false); - expect(relatedEvent.start).toEqualMoment('2014-05-10T00:00:00'); - expect(relatedEvent.end).toBeNull(); - }); - }); - describe('when the event\'s dates are set to a time', function() { - it('should adjust the event and related event\'s allDay/start/end', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.allDay = false; - event.start.time('14:00'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(false); - expect(event.start).toEqualMoment('2014-05-01T14:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(false); - expect(relatedEvent.start).toEqualMoment('2014-05-10T14:00:00'); - expect(relatedEvent.end).toBeNull(); - }); - }); - describe('when the event\'s start is also moved', function() { - it('should adjust the event and related event\'s allDay/start/end', function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-10', end: '2014-05-13', allDay: true } - ]; - init(); - event.allDay = false; - event.start.add(1, 'days'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(false); - expect(event.start).toEqualMoment('2014-05-02T00:00:00'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(false); - expect(relatedEvent.start).toEqualMoment('2014-05-11T00:00:00'); - expect(relatedEvent.end).toBeNull(); - }); - }); - }); - - describe('when changing an event from timed to all-day', function() { - it('should adjust the event and related event\'s allDay/start/end', function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00', end: '2014-05-03T06:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', end: '2014-05-13T06:00:00', allDay: false } - ]; - init(); - event.allDay = true; - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(true); - expect(event.start).toEqualMoment('2014-05-01'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(true); - expect(relatedEvent.start).toEqualMoment('2014-05-10'); - expect(relatedEvent.end).toBeNull(); - }); - it('should adjust the event and related event\'s allDay/start/end and account for a new start', function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00', end: '2014-05-03T06:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', end: '2014-05-13T06:00:00', allDay: false } - ]; - init(); - event.allDay = true; - event.start.add(1, 'days'); - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(true); - expect(event.start).toEqualMoment('2014-05-02'); - expect(event.end).toBeNull(); - expect(relatedEvent.allDay).toEqual(true); - expect(relatedEvent.start).toEqualMoment('2014-05-11'); - expect(relatedEvent.end).toBeNull(); - }); - }); - - it('should accept moments that have unnormalized start/end', function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00', end: '2014-05-03T06:00:00', allDay: false }, - { id: '1', start: '2014-05-10T06:00:00', end: '2014-05-13T06:00:00', allDay: false } - ]; - init(); - event.start = '2014-05-02T06:00:00'; // move by 1 day - event.end = '2014-05-05T06:00:00'; // increase duration by 1 day - $('#cal').fullCalendar('updateEvent', event); - expect(event.allDay).toEqual(false); - expect(moment.isMoment(event.start)).toEqual(true); - expect(event.start).toEqualMoment('2014-05-02T06:00:00'); - expect(moment.isMoment(event.end)).toEqual(true); - expect(event.end).toEqualMoment('2014-05-05T06:00:00'); - expect(relatedEvent.allDay).toEqual(false); - expect(moment.isMoment(relatedEvent.start)).toEqual(true); - expect(relatedEvent.start).toEqualMoment('2014-05-11T06:00:00'); - expect(moment.isMoment(relatedEvent.end)).toEqual(true); - expect(relatedEvent.end).toEqualMoment('2014-05-15T06:00:00'); - }); - - function whenMovingStart(should) { - describe('when moving an timed event\'s start', function() { - beforeEach(function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00+05:00', end: '2014-05-03T06:00:00+05:00', allDay: false }, - { id: '1', start: '2014-05-11T06:00:00+05:00', end: '2014-05-13T06:00:00+05:00', allDay: false } - ]; - init(); - event.start.add(2, 'hours'); - $('#cal').fullCalendar('updateEvent', event); - }); - should(); - }); - } - - function whenMovingEnd(should) { - describe('when moving a timed event\'s end', function() { - beforeEach(function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00+05:00', end: '2014-05-03T06:00:00+05:00', allDay: false }, - { id: '1', start: '2014-05-11T06:00:00+05:00', end: '2014-05-13T06:00:00+05:00', allDay: false } - ]; - init(); - event.end.add(2, 'hours'); - $('#cal').fullCalendar('updateEvent', event); - }); - should(); - }); - } - - function whenMovingToTimed(should) { - describe('when moving an all-day event to timed', function() { - beforeEach(function() { - options.events = [ - { id: '1', start: '2014-05-01', end: '2014-05-03', allDay: true }, - { id: '1', start: '2014-05-11', end: '2014-05-13', allDay: true } - ]; - init(); - event.allDay = false; - $('#cal').fullCalendar('updateEvent', event); - }); - should(); - }); - } - - function whenReportingUnchanged(should) { // not used right now - describe('when reporting an event that hasn\'t changed', function() { - beforeEach(function() { - options.events = [ - { id: '1', start: '2014-05-01T06:00:00+05:00', end: '2014-05-03T06:00:00+05:00', allDay: false }, - { id: '1', start: '2014-05-11T06:00:00+05:00', end: '2014-05-13T06:00:00+05:00', allDay: false } - ]; - init(); - $('#cal').fullCalendar('updateEvent', event); - }); - should(); - }); - } - - function shouldBeAmbiguouslyZoned() { - it('should make the events ambiguously zoned', function() { - expect(event.start.hasZone()).toEqual(false); - if (event.end) { - expect(event.end.hasZone()).toEqual(false); - } - expect(relatedEvent.start.hasZone()).toEqual(false); - if (relatedEvent.end) { - expect(relatedEvent.end.hasZone()).toEqual(false); - } - }); - } - - function shouldBeLocal() { - it('should make the events local', function() { - expect(event.start.hasZone()).toEqual(true); - expect(event.start._isUTC).toEqual(false); - if (event.end) { - expect(event.end.hasZone()).toEqual(true); - expect(event.end._isUTC).toEqual(false); - } - expect(relatedEvent.start.hasZone()).toEqual(true); - expect(relatedEvent.start._isUTC).toEqual(false); - if (relatedEvent.end) { - expect(relatedEvent.end.hasZone()).toEqual(true); - expect(relatedEvent.end._isUTC).toEqual(false); - } - }); - } - - function shouldBeUTC() { - it('should make the events UTC', function() { - expect(event.start.hasZone()).toEqual(true); - expect(event.start._isUTC).toEqual(true); - if (event.end) { - expect(event.end.hasZone()).toEqual(true); - expect(event.end._isUTC).toEqual(true); - } - expect(event.start.hasZone()).toEqual(true); - expect(event.start._isUTC).toEqual(true); - if (relatedEvent.end) { - expect(relatedEvent.end.hasZone()).toEqual(true); - expect(relatedEvent.end._isUTC).toEqual(true); - } - }); - } - - describe('when calendar has no timezone', function() { - beforeEach(function() { - options.timezone = false; - }); - whenMovingStart(shouldBeAmbiguouslyZoned); - whenMovingEnd(shouldBeAmbiguouslyZoned); - whenMovingToTimed(shouldBeAmbiguouslyZoned); - }); - - describe('when calendar has a local timezone', function() { - beforeEach(function() { - options.timezone = 'local'; - }); - whenMovingStart(shouldBeLocal); - whenMovingEnd(shouldBeLocal); - whenMovingToTimed(shouldBeLocal); - }); - - describe('when calendar has a UTC timezone', function() { - beforeEach(function() { - options.timezone = 'UTC'; - }); - whenMovingStart(shouldBeUTC); - whenMovingEnd(shouldBeUTC); - whenMovingToTimed(shouldBeUTC); - }); - - describe('when calendar has a custom timezone', function() { - beforeEach(function() { - options.timezone = 'America/Chicago'; - }); - whenMovingStart(shouldBeAmbiguouslyZoned); - whenMovingEnd(shouldBeAmbiguouslyZoned); - whenMovingToTimed(shouldBeAmbiguouslyZoned); - }); - -}); \ No newline at end of file diff --git a/tests/automated/weekMode.js b/tests/automated/weekMode.js deleted file mode 100644 index c6a755b..0000000 --- a/tests/automated/weekMode.js +++ /dev/null @@ -1,169 +0,0 @@ - -describe('weekMode', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when weekMode is default', function() { - beforeEach(function() { - $('#cal').fullCalendar(); - }); - it('should show 6 weeks for a 5 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should show 6 weeks for a 4 week month', function() { - $('#cal').fullCalendar('gotoDate', '2009-03-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should show 6 weeks for a 6 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should not change height whether 4,5 or weeks', function() { - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = $('.fc-week:first').outerHeight(); - expect(fourWeekHeight).toBeGreaterThan(0); - expect(fiveWeekHeight).toBeGreaterThan(0); - expect(sixWeekHeight).toBeGreaterThan(0); - expect(fourWeekHeight).toEqual(fiveWeekHeight); - expect(fiveWeekHeight).toEqual(sixWeekHeight); - }); - }); - - describe('when weekMode is set to fixed', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - weekMode: 'fixed' - }); - }); - it('should show 6 weeks for a 5 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should show 6 weeks for a 4 week month', function() { - $('#cal').fullCalendar('gotoDate', '2009-03-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should show 6 weeks for a 6 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - }); - - describe('when weekMode is set to liquid', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - weekMode: 'liquid' - }); - }); - it('should show 5 weeks for a 5 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(5); - }); - it('should show 4 weeks for a 4 week month', function() { - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(4); - }); - it('should show 6 weeks for a 6 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should increase height when moving from 6 week to 5 weeks', function() { - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = $('.fc-week:first').outerHeight(); - expect(fiveWeekHeight).toBeGreaterThan(sixWeekHeight); - }); - it('should reduce height when moving from 5 weeks to 6 weeks', function() { - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - expect(fiveWeekHeight).toBeGreaterThan(sixWeekHeight); - }); - it('should increase height when moving from 5 weeks to 4 weeks', function() { - $('#cal').fullCalendar('gotoDate', '2013-05-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = $('.fc-week:first').outerHeight(); - expect(fourWeekHeight).toBeGreaterThan(fiveWeekHeight); - }); - it('should reduce height when moving from 4 weeks to 5 weeks', function() { - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-05-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - expect(fourWeekHeight).toBeGreaterThan(fiveWeekHeight); - }); - }); - - it('should not display an empty week when no visible days and weekMode is set to liquid', function() { - $('#cal').fullCalendar({ - defaultDate: '2013-06-01', // June 2013 has first day as Saturday, and last as Sunday! - weekMode: 'liquid', - weekends: false - }); - expect($('.fc-week').length).toBe(4); - }); - - describe('when weekMode is set to variable', function() { - beforeEach(function() { - $('#cal').fullCalendar({ - weekMode: 'variable' - }); - }); - it('should show 5 weeks for a 5 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(5); - }); - it('should show 4 weeks for a 4 week month', function() { - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(4); - }); - it('should show 6 weeks for a 6 week month', function() { - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var weekCount = $('.fc-week').length; - expect(weekCount).toEqual(6); - }); - it('should not change height whether 4,5 or weeks', function() { - $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = $('.fc-week:first').outerHeight(); - $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = $('.fc-week:first').outerHeight(); - expect(fourWeekHeight).toBeGreaterThan(0); - expect(fiveWeekHeight).toBeGreaterThan(0); - expect(sixWeekHeight).toBeGreaterThan(0); - expect(fourWeekHeight).toEqual(fiveWeekHeight); - expect(fiveWeekHeight).toEqual(sixWeekHeight); - }); - }); - - it('should not display an empty week when no visible days and weekMode is set to variable', function() { - $('#cal').fullCalendar({ - defaultDate: '2013-06-01', // June 2013 has first day as Saturday, and last as Sunday! - weekMode: 'variable', - weekends: false - }); - expect($('.fc-week').length).toBe(4); - }); -}); \ No newline at end of file diff --git a/tests/automated/weekNumberCalculation.js b/tests/automated/weekNumberCalculation.js deleted file mode 100644 index 274364f..0000000 --- a/tests/automated/weekNumberCalculation.js +++ /dev/null @@ -1,68 +0,0 @@ - -describe('weekNumberCalculation', function() { - - var options; - - beforeEach(function() { - options = { - weekNumbers: true - }; - }); - - function getRenderedWeekNumber() { - // works for both kinds of views - var text = $('.fc-agenda-view .fc-week-number, .fc-week:first .fc-content-skeleton .fc-week-number').text(); - return parseInt(text.replace(/\D/g, ''), 10); - } - - beforeEach(function() { - affix('#cal'); - }); - - [ 'basicDay', 'agendaDay' ].forEach(function(viewType) { - describe('when in ' + viewType + ' view', function() { - - beforeEach(function() { - options.defaultView = viewType; - }); - - it('should display the American standard when using \'local\'', function() { - options.defaultDate = '2013-11-23'; // a Saturday - options.weekNumberCalculation = 'local'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumber()).toBe(47); - }); - - it('should display a language-specific local week number', function() { - options.defaultDate = '2013-11-23'; // a Saturday - options.lang = 'ar'; - options.weekNumberCalculation = 'local'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumber()).toBe(48); - }); - - // another local test, but to make sure it is different from ISO - it('should display the American standard when using \'local\'', function() { - options.defaultDate = '2013-11-17'; // a Sunday - options.weekNumberCalculation = 'local'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumber()).toBe(47); - }); - - it('should display ISO standard when using \'ISO\'', function() { - options.defaultDate = '2013-11-17'; // a Sunday - options.weekNumberCalculation = 'ISO'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumber()).toBe(46); - }); - - it('should display the calculated number when a custom function', function() { - options.weekNumberCalculation = function() { - return 4; - }; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumber()).toBe(4); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/weekNumberTitle.js b/tests/automated/weekNumberTitle.js deleted file mode 100644 index 2d37208..0000000 --- a/tests/automated/weekNumberTitle.js +++ /dev/null @@ -1,51 +0,0 @@ -describe('weekNumberTitle', function() { - - var options; - - beforeEach(function() { - affix('#cal'); - options = { - weekNumbers: true - }; - }); - - function getRenderedWeekNumberTitle() { - // works for both kinds of views - var text = $('th.fc-week-number').text(); - return text.replace(/\d/g, ''); - } - - [ 'basicWeek', 'agendaWeek' ].forEach(function(viewName) { - describe('when views is ' + viewName, function() { - - beforeEach(function() { - options.defaultView = viewName; - }); - - it('renders correctly by default', function() { - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumberTitle()).toBe('W'); - }); - - it('renders correctly when unspecified and when language is customized', function() { - options.lang = 'es'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumberTitle()).toBe('Sm'); - }); - - it('renders correctly when customized and LTR', function() { - options.isRTL = false; - options.weekNumberTitle = 'YO'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumberTitle()).toBe('YO'); - }); - - it('renders correctly when customized and RTL', function() { - options.isRTL = true; - options.weekNumberTitle = 'YO'; - $('#cal').fullCalendar(options); - expect(getRenderedWeekNumberTitle()).toBe('YO'); - }); - }); - }); -}); \ No newline at end of file diff --git a/tests/automated/weekNumbers.js b/tests/automated/weekNumbers.js deleted file mode 100644 index 3bd6d1a..0000000 --- a/tests/automated/weekNumbers.js +++ /dev/null @@ -1,118 +0,0 @@ - -describe('weekNumbers', function() { - - beforeEach(function() { - affix('#cal'); - }); - - describe('when using month view', function() { - - describe('when using default weekNumbers', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'month' - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('when setting weekNumbers to false', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'month', - weekNumbers: false - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('when setting weekNumbers to true', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'month', - weekNumbers: true, - weekMode: 'fixed' // will make 6 rows - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(6); - }); - }); - - }); - - describe('when using basicWeek view', function() { - - describe('with default weekNumbers ', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'basicWeek' - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('with weekNumbers to false', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'basicWeek', - weekNumbers: false - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('with weekNumbers to true', function() { - it('should display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'basicWeek', - weekNumbers: true - }); - var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; - expect(weekNumbersCount).toEqual(1); - }); - }); - - }); - - describe('when using an agenda view', function() { - - describe('with default weekNumbers', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'agendaWeek' - }); - var weekNumbersCount = $('.fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('with weekNumbers to false', function() { - it('should not display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'agendaWeek', - weekNumbers: false - }); - var weekNumbersCount = $('.fc-week-number').length; - expect(weekNumbersCount).toEqual(0); - }); - }); - - describe('with weekNumbers to true', function() { - it('should display weekNumbers', function() { - $('#cal').fullCalendar({ - defaultView: 'agendaWeek', - weekNumbers: true - }); - var weekNumbersCount = $('.fc-week-number').length; - // 1 row is axis - expect(weekNumbersCount).toEqual(1); - }); - }); - - }); - -}); \ No newline at end of file diff --git a/tests/automated/weekends.js b/tests/automated/weekends.js deleted file mode 100644 index 5a2e89a..0000000 --- a/tests/automated/weekends.js +++ /dev/null @@ -1,30 +0,0 @@ - -describe('when weekends option is set', function() { - - beforeEach(function() { - affix('#calendar'); - }); - - it('should show sat and sun if true', function() { - var options = { - weekends: true - }; - $('#calendar').fullCalendar(options); - var sun = $('.fc-day-header.fc-sun')[0]; - var sat = $('.fc-day-header.fc-sun')[0]; - expect(sun).toBeDefined(); - expect(sat).toBeDefined(); - }); - - it('should not show sat and sun if false', function() { - var options = { - weekends: false - }; - $('#calendar').fullCalendar(options); - var sun = $('.fc-day-header.fc-sun')[0]; - var sat = $('.fc-day-header.fc-sun')[0]; - expect(sun).not.toBeDefined(); - expect(sat).not.toBeDefined(); - }); - -}); \ No newline at end of file diff --git a/tests/base.css b/tests/base.css deleted file mode 100644 index 6370e1e..0000000 --- a/tests/base.css +++ /dev/null @@ -1,12 +0,0 @@ - -body { - margin-top: 40px; - text-align: center; - font-size: 13px; - font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; -} - -#calendar { - width: 900px; - margin: 0 auto; -} diff --git a/tests/data_as_a_function.html b/tests/data_as_a_function.html deleted file mode 100644 index 09b562d..0000000 --- a/tests/data_as_a_function.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/date_util_test.html b/tests/date_util_test.html deleted file mode 100644 index ce04e4e..0000000 --- a/tests/date_util_test.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tests/day_render.html b/tests/day_render.html deleted file mode 100644 index 2745034..0000000 --- a/tests/day_render.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/dbclick.html b/tests/dbclick.html deleted file mode 100644 index dbe23a5..0000000 --- a/tests/dbclick.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/drag_drop.html b/tests/drag_drop.html deleted file mode 100644 index ca2effe..0000000 --- a/tests/drag_drop.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - -
- - diff --git a/tests/droppable.html b/tests/droppable.html deleted file mode 100644 index 6ce8139..0000000 --- a/tests/droppable.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - -
-
-
Draggable 1
-
Draggable 2
-
Draggable 3
-
-
-
- - diff --git a/tests/droppable_resourceView.html b/tests/droppable_resourceView.html deleted file mode 100644 index 620fbc1..0000000 --- a/tests/droppable_resourceView.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - - - -
-
-
Draggable 1
-
Draggable 2
-
- - diff --git a/tests/event_data_transform.html b/tests/event_data_transform.html deleted file mode 100644 index 975e97b..0000000 --- a/tests/event_data_transform.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/fullheight.html b/tests/fullheight.html deleted file mode 100644 index 52b248b..0000000 --- a/tests/fullheight.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/gcal.html b/tests/gcal.html deleted file mode 100644 index 4e7b133..0000000 --- a/tests/gcal.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - -
- - diff --git a/tests/hiddenDays.html b/tests/hiddenDays.html deleted file mode 100644 index 97bd90b..0000000 --- a/tests/hiddenDays.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/iframe.html b/tests/iframe.html deleted file mode 100644 index 7d44bd7..0000000 --- a/tests/iframe.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - -
- - diff --git a/tests/index.html b/tests/index.html deleted file mode 100644 index 1412ca9..0000000 --- a/tests/index.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - -
- - - diff --git a/tests/issue_1035.html b/tests/issue_1035.html deleted file mode 100644 index 19fe9ef..0000000 --- a/tests/issue_1035.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - -

The selection box for selecting agenda slot cells should align to the grid.

-

(even though .fc-agenda-slots td div has been set to 10px tall)

- -
- - - diff --git a/tests/issue_2048.html b/tests/issue_2048.html deleted file mode 100644 index 8892b22..0000000 --- a/tests/issue_2048.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - -
- - diff --git a/tests/issue_206_parseDate_dst.html b/tests/issue_206_parseDate_dst.html deleted file mode 100644 index 44f31fe..0000000 --- a/tests/issue_206_parseDate_dst.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_2154.html b/tests/issue_2154.html deleted file mode 100644 index 6c261b7..0000000 --- a/tests/issue_2154.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - -
- - - diff --git a/tests/issue_220_buttons_ie6.html b/tests/issue_220_buttons_ie6.html deleted file mode 100644 index 19d3bb6..0000000 --- a/tests/issue_220_buttons_ie6.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - -
-
-
- -
Nav
- -
- -

-this is a paragraph -

- -
- -
- -
-
- - diff --git a/tests/issue_221_quick_remove_source.html b/tests/issue_221_quick_remove_source.html deleted file mode 100644 index 393ed87..0000000 --- a/tests/issue_221_quick_remove_source.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_230_height_json_events.html b/tests/issue_230_height_json_events.html deleted file mode 100644 index 9878dea..0000000 --- a/tests/issue_230_height_json_events.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_244_aspectRatio_0.html b/tests/issue_244_aspectRatio_0.html deleted file mode 100644 index 525ddeb..0000000 --- a/tests/issue_244_aspectRatio_0.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_251_empty_end_date.html b/tests/issue_251_empty_end_date.html deleted file mode 100644 index 9dd43d5..0000000 --- a/tests/issue_251_empty_end_date.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_333_blinking.html b/tests/issue_333_blinking.html deleted file mode 100644 index 56998c5..0000000 --- a/tests/issue_333_blinking.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - -
- - diff --git a/tests/issue_417_refetchEvents.html b/tests/issue_417_refetchEvents.html deleted file mode 100644 index 87f56f5..0000000 --- a/tests/issue_417_refetchEvents.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_429_gotoDate.html b/tests/issue_429_gotoDate.html deleted file mode 100644 index 1b021b0..0000000 --- a/tests/issue_429_gotoDate.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - -
- - diff --git a/tests/issue_477_event_width.html b/tests/issue_477_event_width.html deleted file mode 100644 index f33e423..0000000 --- a/tests/issue_477_event_width.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_517_js_error_ie.html b/tests/issue_517_js_error_ie.html deleted file mode 100644 index f90be1a..0000000 --- a/tests/issue_517_js_error_ie.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_554.html b/tests/issue_554.html deleted file mode 100644 index 48e1439..0000000 --- a/tests/issue_554.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_586_refetchEvents.html b/tests/issue_586_refetchEvents.html deleted file mode 100644 index ba399a9..0000000 --- a/tests/issue_586_refetchEvents.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_616.html b/tests/issue_616.html deleted file mode 100644 index 57cef76..0000000 --- a/tests/issue_616.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_679.html b/tests/issue_679.html deleted file mode 100644 index b61f9cf..0000000 --- a/tests/issue_679.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/issue_688_parseInt.html b/tests/issue_688_parseInt.html deleted file mode 100644 index 108cc59..0000000 --- a/tests/issue_688_parseInt.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_740_event_resizing.html b/tests/issue_740_event_resizing.html deleted file mode 100644 index 90ce650..0000000 --- a/tests/issue_740_event_resizing.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_750.html b/tests/issue_750.html deleted file mode 100644 index 6373282..0000000 --- a/tests/issue_750.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - -
- - diff --git a/tests/issue_757_removeEvents.html b/tests/issue_757_removeEvents.html deleted file mode 100644 index 9547ddb..0000000 --- a/tests/issue_757_removeEvents.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - -
- - diff --git a/tests/languages-datepicker.html b/tests/languages-datepicker.html deleted file mode 100644 index 0ad1a29..0000000 --- a/tests/languages-datepicker.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - -
- - Language: - - -
- -
- -
- - - diff --git a/tests/lib/fancybox/blank.gif b/tests/lib/fancybox/blank.gif deleted file mode 100644 index 35d42e8..0000000 Binary files a/tests/lib/fancybox/blank.gif and /dev/null differ diff --git a/tests/lib/fancybox/fancy_close.png b/tests/lib/fancybox/fancy_close.png deleted file mode 100644 index 0703530..0000000 Binary files a/tests/lib/fancybox/fancy_close.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_loading.png b/tests/lib/fancybox/fancy_loading.png deleted file mode 100644 index 2503017..0000000 Binary files a/tests/lib/fancybox/fancy_loading.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_nav_left.png b/tests/lib/fancybox/fancy_nav_left.png deleted file mode 100644 index ebaa6a4..0000000 Binary files a/tests/lib/fancybox/fancy_nav_left.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_nav_right.png b/tests/lib/fancybox/fancy_nav_right.png deleted file mode 100644 index 873294e..0000000 Binary files a/tests/lib/fancybox/fancy_nav_right.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_e.png b/tests/lib/fancybox/fancy_shadow_e.png deleted file mode 100644 index 2eda089..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_e.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_n.png b/tests/lib/fancybox/fancy_shadow_n.png deleted file mode 100644 index 69aa10e..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_n.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_ne.png b/tests/lib/fancybox/fancy_shadow_ne.png deleted file mode 100644 index 79f6980..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_ne.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_nw.png b/tests/lib/fancybox/fancy_shadow_nw.png deleted file mode 100644 index 7182cd9..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_nw.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_s.png b/tests/lib/fancybox/fancy_shadow_s.png deleted file mode 100644 index d8858bf..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_s.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_se.png b/tests/lib/fancybox/fancy_shadow_se.png deleted file mode 100644 index 541e3ff..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_se.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_sw.png b/tests/lib/fancybox/fancy_shadow_sw.png deleted file mode 100644 index b451689..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_sw.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_shadow_w.png b/tests/lib/fancybox/fancy_shadow_w.png deleted file mode 100644 index 8a4e4a8..0000000 Binary files a/tests/lib/fancybox/fancy_shadow_w.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_title_left.png b/tests/lib/fancybox/fancy_title_left.png deleted file mode 100644 index 6049223..0000000 Binary files a/tests/lib/fancybox/fancy_title_left.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_title_main.png b/tests/lib/fancybox/fancy_title_main.png deleted file mode 100644 index 8044271..0000000 Binary files a/tests/lib/fancybox/fancy_title_main.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_title_over.png b/tests/lib/fancybox/fancy_title_over.png deleted file mode 100644 index d9f458f..0000000 Binary files a/tests/lib/fancybox/fancy_title_over.png and /dev/null differ diff --git a/tests/lib/fancybox/fancy_title_right.png b/tests/lib/fancybox/fancy_title_right.png deleted file mode 100644 index e36d9db..0000000 Binary files a/tests/lib/fancybox/fancy_title_right.png and /dev/null differ diff --git a/tests/lib/fancybox/fancybox-x.png b/tests/lib/fancybox/fancybox-x.png deleted file mode 100644 index c2130f8..0000000 Binary files a/tests/lib/fancybox/fancybox-x.png and /dev/null differ diff --git a/tests/lib/fancybox/fancybox-y.png b/tests/lib/fancybox/fancybox-y.png deleted file mode 100644 index 7ef399b..0000000 Binary files a/tests/lib/fancybox/fancybox-y.png and /dev/null differ diff --git a/tests/lib/fancybox/fancybox.png b/tests/lib/fancybox/fancybox.png deleted file mode 100644 index 65e14f6..0000000 Binary files a/tests/lib/fancybox/fancybox.png and /dev/null differ diff --git a/tests/lib/fancybox/jquery.easing-1.3.pack.js b/tests/lib/fancybox/jquery.easing-1.3.pack.js deleted file mode 100644 index 9028179..0000000 --- a/tests/lib/fancybox/jquery.easing-1.3.pack.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ - * - * Uses the built in easing capabilities added In jQuery 1.1 - * to offer multiple easing options - * - * TERMS OF USE - jQuery Easing - * - * Open source under the BSD License. - * - * Copyright Ā© 2008 George McGinley Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * -*/ - -// t: current time, b: begInnIng value, c: change In value, d: duration -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t')[0], { prop: 0 }), - - isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest, - - /* - * Private methods - */ - - _abort = function() { - loading.hide(); - - imgPreloader.onerror = imgPreloader.onload = null; - - if (ajaxLoader) { - ajaxLoader.abort(); - } - - tmp.empty(); - }, - - _error = function() { - if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) { - loading.hide(); - busy = false; - return; - } - - selectedOpts.titleShow = false; - - selectedOpts.width = 'auto'; - selectedOpts.height = 'auto'; - - tmp.html( '

The requested content cannot be loaded.
Please try again later.

' ); - - _process_inline(); - }, - - _start = function() { - var obj = selectedArray[ selectedIndex ], - href, - type, - title, - str, - emb, - ret; - - _abort(); - - selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox'))); - - ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts); - - if (ret === false) { - busy = false; - return; - } else if (typeof ret == 'object') { - selectedOpts = $.extend(selectedOpts, ret); - } - - title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || ''; - - if (obj.nodeName && !selectedOpts.orig) { - selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj); - } - - if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) { - title = selectedOpts.orig.attr('alt'); - } - - href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null; - - if ((/^(?:javascript)/i).test(href) || href == '#') { - href = null; - } - - if (selectedOpts.type) { - type = selectedOpts.type; - - if (!href) { - href = selectedOpts.content; - } - - } else if (selectedOpts.content) { - type = 'html'; - - } else if (href) { - if (href.match(imgRegExp)) { - type = 'image'; - - } else if (href.match(swfRegExp)) { - type = 'swf'; - - } else if ($(obj).hasClass("iframe")) { - type = 'iframe'; - - } else if (href.indexOf("#") === 0) { - type = 'inline'; - - } else { - type = 'ajax'; - } - } - - if (!type) { - _error(); - return; - } - - if (type == 'inline') { - obj = href.substr(href.indexOf("#")); - type = $(obj).length > 0 ? 'inline' : 'ajax'; - } - - selectedOpts.type = type; - selectedOpts.href = href; - selectedOpts.title = title; - - if (selectedOpts.autoDimensions) { - if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') { - selectedOpts.width = 'auto'; - selectedOpts.height = 'auto'; - } else { - selectedOpts.autoDimensions = false; - } - } - - if (selectedOpts.modal) { - selectedOpts.overlayShow = true; - selectedOpts.hideOnOverlayClick = false; - selectedOpts.hideOnContentClick = false; - selectedOpts.enableEscapeButton = false; - selectedOpts.showCloseButton = false; - } - - selectedOpts.padding = parseInt(selectedOpts.padding, 10); - selectedOpts.margin = parseInt(selectedOpts.margin, 10); - - tmp.css('padding', (selectedOpts.padding + selectedOpts.margin)); - - $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() { - $(this).replaceWith(content.children()); - }); - - switch (type) { - case 'html' : - tmp.html( selectedOpts.content ); - _process_inline(); - break; - - case 'inline' : - if ( $(obj).parent().is('#fancybox-content') === true) { - busy = false; - return; - } - - $('
') - .hide() - .insertBefore( $(obj) ) - .bind('fancybox-cleanup', function() { - $(this).replaceWith(content.children()); - }).bind('fancybox-cancel', function() { - $(this).replaceWith(tmp.children()); - }); - - $(obj).appendTo(tmp); - - _process_inline(); - break; - - case 'image': - busy = false; - - $.fancybox.showActivity(); - - imgPreloader = new Image(); - - imgPreloader.onerror = function() { - _error(); - }; - - imgPreloader.onload = function() { - busy = true; - - imgPreloader.onerror = imgPreloader.onload = null; - - _process_image(); - }; - - imgPreloader.src = href; - break; - - case 'swf': - selectedOpts.scrolling = 'no'; - - str = ''; - emb = ''; - - $.each(selectedOpts.swf, function(name, val) { - str += ''; - emb += ' ' + name + '="' + val + '"'; - }); - - str += ''; - - tmp.html(str); - - _process_inline(); - break; - - case 'ajax': - busy = false; - - $.fancybox.showActivity(); - - selectedOpts.ajax.win = selectedOpts.ajax.success; - - ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, { - url : href, - data : selectedOpts.ajax.data || {}, - error : function(XMLHttpRequest, textStatus, errorThrown) { - if ( XMLHttpRequest.status > 0 ) { - _error(); - } - }, - success : function(data, textStatus, XMLHttpRequest) { - var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader; - if (o.status == 200) { - if ( typeof selectedOpts.ajax.win == 'function' ) { - ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest); - - if (ret === false) { - loading.hide(); - return; - } else if (typeof ret == 'string' || typeof ret == 'object') { - data = ret; - } - } - - tmp.html( data ); - _process_inline(); - } - } - })); - - break; - - case 'iframe': - _show(); - break; - } - }, - - _process_inline = function() { - var - w = selectedOpts.width, - h = selectedOpts.height; - - if (w.toString().indexOf('%') > -1) { - w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px'; - - } else { - w = w == 'auto' ? 'auto' : w + 'px'; - } - - if (h.toString().indexOf('%') > -1) { - h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px'; - - } else { - h = h == 'auto' ? 'auto' : h + 'px'; - } - - tmp.wrapInner('
'); - - selectedOpts.width = tmp.width(); - selectedOpts.height = tmp.height(); - - _show(); - }, - - _process_image = function() { - selectedOpts.width = imgPreloader.width; - selectedOpts.height = imgPreloader.height; - - $("").attr({ - 'id' : 'fancybox-img', - 'src' : imgPreloader.src, - 'alt' : selectedOpts.title - }).appendTo( tmp ); - - _show(); - }, - - _show = function() { - var pos, equal; - - loading.hide(); - - if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { - $.event.trigger('fancybox-cancel'); - - busy = false; - return; - } - - busy = true; - - $(content.add( overlay )).unbind(); - - $(window).unbind("resize.fb scroll.fb"); - $(document).unbind('keydown.fb'); - - if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') { - wrap.css('height', wrap.height()); - } - - currentArray = selectedArray; - currentIndex = selectedIndex; - currentOpts = selectedOpts; - - if (currentOpts.overlayShow) { - overlay.css({ - 'background-color' : currentOpts.overlayColor, - 'opacity' : currentOpts.overlayOpacity, - 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto', - 'height' : $(document).height() - }); - - if (!overlay.is(':visible')) { - if (isIE6) { - $('select:not(#fancybox-tmp select)').filter(function() { - return this.style.visibility !== 'hidden'; - }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() { - this.style.visibility = 'inherit'; - }); - } - - overlay.show(); - } - } else { - overlay.hide(); - } - - final_pos = _get_zoom_to(); - - _process_title(); - - if (wrap.is(":visible")) { - $( close.add( nav_left ).add( nav_right ) ).hide(); - - pos = wrap.position(), - - start_pos = { - top : pos.top, - left : pos.left, - width : wrap.width(), - height : wrap.height() - }; - - equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height); - - content.fadeTo(currentOpts.changeFade, 0.3, function() { - var finish_resizing = function() { - content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish); - }; - - $.event.trigger('fancybox-change'); - - content - .empty() - .removeAttr('filter') - .css({ - 'border-width' : currentOpts.padding, - 'width' : final_pos.width - currentOpts.padding * 2, - 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2 - }); - - if (equal) { - finish_resizing(); - - } else { - fx.prop = 0; - - $(fx).animate({prop: 1}, { - duration : currentOpts.changeSpeed, - easing : currentOpts.easingChange, - step : _draw, - complete : finish_resizing - }); - } - }); - - return; - } - - wrap.removeAttr("style"); - - content.css('border-width', currentOpts.padding); - - if (currentOpts.transitionIn == 'elastic') { - start_pos = _get_zoom_from(); - - content.html( tmp.contents() ); - - wrap.show(); - - if (currentOpts.opacity) { - final_pos.opacity = 0; - } - - fx.prop = 0; - - $(fx).animate({prop: 1}, { - duration : currentOpts.speedIn, - easing : currentOpts.easingIn, - step : _draw, - complete : _finish - }); - - return; - } - - if (currentOpts.titlePosition == 'inside' && titleHeight > 0) { - title.show(); - } - - content - .css({ - 'width' : final_pos.width - currentOpts.padding * 2, - 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2 - }) - .html( tmp.contents() ); - - wrap - .css(final_pos) - .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish ); - }, - - _format_title = function(title) { - if (title && title.length) { - if (currentOpts.titlePosition == 'float') { - return '
' + title + '
'; - } - - return '
' + title + '
'; - } - - return false; - }, - - _process_title = function() { - titleStr = currentOpts.title || ''; - titleHeight = 0; - - title - .empty() - .removeAttr('style') - .removeClass(); - - if (currentOpts.titleShow === false) { - title.hide(); - return; - } - - titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr); - - if (!titleStr || titleStr === '') { - title.hide(); - return; - } - - title - .addClass('fancybox-title-' + currentOpts.titlePosition) - .html( titleStr ) - .appendTo( 'body' ) - .show(); - - switch (currentOpts.titlePosition) { - case 'inside': - title - .css({ - 'width' : final_pos.width - (currentOpts.padding * 2), - 'marginLeft' : currentOpts.padding, - 'marginRight' : currentOpts.padding - }); - - titleHeight = title.outerHeight(true); - - title.appendTo( outer ); - - final_pos.height += titleHeight; - break; - - case 'over': - title - .css({ - 'marginLeft' : currentOpts.padding, - 'width' : final_pos.width - (currentOpts.padding * 2), - 'bottom' : currentOpts.padding - }) - .appendTo( outer ); - break; - - case 'float': - title - .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1) - .appendTo( wrap ); - break; - - default: - title - .css({ - 'width' : final_pos.width - (currentOpts.padding * 2), - 'paddingLeft' : currentOpts.padding, - 'paddingRight' : currentOpts.padding - }) - .appendTo( wrap ); - break; - } - - title.hide(); - }, - - _set_navigation = function() { - if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) { - $(document).bind('keydown.fb', function(e) { - if (e.keyCode == 27 && currentOpts.enableEscapeButton) { - e.preventDefault(); - $.fancybox.close(); - - } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { - e.preventDefault(); - $.fancybox[ e.keyCode == 37 ? 'prev' : 'next'](); - } - }); - } - - if (!currentOpts.showNavArrows) { - nav_left.hide(); - nav_right.hide(); - return; - } - - if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) { - nav_left.show(); - } - - if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) { - nav_right.show(); - } - }, - - _finish = function () { - if (!$.support.opacity) { - content.get(0).style.removeAttribute('filter'); - wrap.get(0).style.removeAttribute('filter'); - } - - if (selectedOpts.autoDimensions) { - content.css('height', 'auto'); - } - - wrap.css('height', 'auto'); - - if (titleStr && titleStr.length) { - title.show(); - } - - if (currentOpts.showCloseButton) { - close.show(); - } - - _set_navigation(); - - if (currentOpts.hideOnContentClick) { - content.bind('click', $.fancybox.close); - } - - if (currentOpts.hideOnOverlayClick) { - overlay.bind('click', $.fancybox.close); - } - - $(window).bind("resize.fb", $.fancybox.resize); - - if (currentOpts.centerOnScroll) { - $(window).bind("scroll.fb", $.fancybox.center); - } - - if (currentOpts.type == 'iframe') { - $('').appendTo(content); - } - - wrap.show(); - - busy = false; - - $.fancybox.center(); - - currentOpts.onComplete(currentArray, currentIndex, currentOpts); - - _preload_images(); - }, - - _preload_images = function() { - var href, - objNext; - - if ((currentArray.length -1) > currentIndex) { - href = currentArray[ currentIndex + 1 ].href; - - if (typeof href !== 'undefined' && href.match(imgRegExp)) { - objNext = new Image(); - objNext.src = href; - } - } - - if (currentIndex > 0) { - href = currentArray[ currentIndex - 1 ].href; - - if (typeof href !== 'undefined' && href.match(imgRegExp)) { - objNext = new Image(); - objNext.src = href; - } - } - }, - - _draw = function(pos) { - var dim = { - width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10), - height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10), - - top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10), - left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10) - }; - - if (typeof final_pos.opacity !== 'undefined') { - dim.opacity = pos < 0.5 ? 0.5 : pos; - } - - wrap.css(dim); - - content.css({ - 'width' : dim.width - currentOpts.padding * 2, - 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2 - }); - }, - - _get_viewport = function() { - return [ - $(window).width() - (currentOpts.margin * 2), - $(window).height() - (currentOpts.margin * 2), - $(document).scrollLeft() + currentOpts.margin, - $(document).scrollTop() + currentOpts.margin - ]; - }, - - _get_zoom_to = function () { - var view = _get_viewport(), - to = {}, - resize = currentOpts.autoScale, - double_padding = currentOpts.padding * 2, - ratio; - - if (currentOpts.width.toString().indexOf('%') > -1) { - to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10); - } else { - to.width = currentOpts.width + double_padding; - } - - if (currentOpts.height.toString().indexOf('%') > -1) { - to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10); - } else { - to.height = currentOpts.height + double_padding; - } - - if (resize && (to.width > view[0] || to.height > view[1])) { - if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') { - ratio = (currentOpts.width ) / (currentOpts.height ); - - if ((to.width ) > view[0]) { - to.width = view[0]; - to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10); - } - - if ((to.height) > view[1]) { - to.height = view[1]; - to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10); - } - - } else { - to.width = Math.min(to.width, view[0]); - to.height = Math.min(to.height, view[1]); - } - } - - to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10); - to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10); - - return to; - }, - - _get_obj_pos = function(obj) { - var pos = obj.offset(); - - pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0; - pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0; - - pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0; - pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0; - - pos.width = obj.width(); - pos.height = obj.height(); - - return pos; - }, - - _get_zoom_from = function() { - var orig = selectedOpts.orig ? $(selectedOpts.orig) : false, - from = {}, - pos, - view; - - if (orig && orig.length) { - pos = _get_obj_pos(orig); - - from = { - width : pos.width + (currentOpts.padding * 2), - height : pos.height + (currentOpts.padding * 2), - top : pos.top - currentOpts.padding - 20, - left : pos.left - currentOpts.padding - 20 - }; - - } else { - view = _get_viewport(); - - from = { - width : currentOpts.padding * 2, - height : currentOpts.padding * 2, - top : parseInt(view[3] + view[1] * 0.5, 10), - left : parseInt(view[2] + view[0] * 0.5, 10) - }; - } - - return from; - }, - - _animate_loading = function() { - if (!loading.is(':visible')){ - clearInterval(loadingTimer); - return; - } - - $('div', loading).css('top', (loadingFrame * -40) + 'px'); - - loadingFrame = (loadingFrame + 1) % 12; - }; - - /* - * Public methods - */ - - $.fn.fancybox = function(options) { - if (!$(this).length) { - return this; - } - - $(this) - .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {}))) - .unbind('click.fb') - .bind('click.fb', function(e) { - e.preventDefault(); - - if (busy) { - return; - } - - busy = true; - - $(this).blur(); - - selectedArray = []; - selectedIndex = 0; - - var rel = $(this).attr('rel') || ''; - - if (!rel || rel == '' || rel === 'nofollow') { - selectedArray.push(this); - - } else { - selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]"); - selectedIndex = selectedArray.index( this ); - } - - _start(); - - return; - }); - - return this; - }; - - $.fancybox = function(obj) { - var opts; - - if (busy) { - return; - } - - busy = true; - opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {}; - - selectedArray = []; - selectedIndex = parseInt(opts.index, 10) || 0; - - if ($.isArray(obj)) { - for (var i = 0, j = obj.length; i < j; i++) { - if (typeof obj[i] == 'object') { - $(obj[i]).data('fancybox', $.extend({}, opts, obj[i])); - } else { - obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts)); - } - } - - selectedArray = jQuery.merge(selectedArray, obj); - - } else { - if (typeof obj == 'object') { - $(obj).data('fancybox', $.extend({}, opts, obj)); - } else { - obj = $({}).data('fancybox', $.extend({content : obj}, opts)); - } - - selectedArray.push(obj); - } - - if (selectedIndex > selectedArray.length || selectedIndex < 0) { - selectedIndex = 0; - } - - _start(); - }; - - $.fancybox.showActivity = function() { - clearInterval(loadingTimer); - - loading.show(); - loadingTimer = setInterval(_animate_loading, 66); - }; - - $.fancybox.hideActivity = function() { - loading.hide(); - }; - - $.fancybox.next = function() { - return $.fancybox.pos( currentIndex + 1); - }; - - $.fancybox.prev = function() { - return $.fancybox.pos( currentIndex - 1); - }; - - $.fancybox.pos = function(pos) { - if (busy) { - return; - } - - pos = parseInt(pos); - - selectedArray = currentArray; - - if (pos > -1 && pos < currentArray.length) { - selectedIndex = pos; - _start(); - - } else if (currentOpts.cyclic && currentArray.length > 1) { - selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1; - _start(); - } - - return; - }; - - $.fancybox.cancel = function() { - if (busy) { - return; - } - - busy = true; - - $.event.trigger('fancybox-cancel'); - - _abort(); - - selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts); - - busy = false; - }; - - // Note: within an iframe use - parent.$.fancybox.close(); - $.fancybox.close = function() { - if (busy || wrap.is(':hidden')) { - return; - } - - busy = true; - - if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { - busy = false; - return; - } - - _abort(); - - $(close.add( nav_left ).add( nav_right )).hide(); - - $(content.add( overlay )).unbind(); - - $(window).unbind("resize.fb scroll.fb"); - $(document).unbind('keydown.fb'); - - content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank'); - - if (currentOpts.titlePosition !== 'inside') { - title.empty(); - } - - wrap.stop(); - - function _cleanup() { - overlay.fadeOut('fast'); - - title.empty().hide(); - wrap.hide(); - - $.event.trigger('fancybox-cleanup'); - - content.empty(); - - currentOpts.onClosed(currentArray, currentIndex, currentOpts); - - currentArray = selectedOpts = []; - currentIndex = selectedIndex = 0; - currentOpts = selectedOpts = {}; - - busy = false; - } - - if (currentOpts.transitionOut == 'elastic') { - start_pos = _get_zoom_from(); - - var pos = wrap.position(); - - final_pos = { - top : pos.top , - left : pos.left, - width : wrap.width(), - height : wrap.height() - }; - - if (currentOpts.opacity) { - final_pos.opacity = 1; - } - - title.empty().hide(); - - fx.prop = 1; - - $(fx).animate({ prop: 0 }, { - duration : currentOpts.speedOut, - easing : currentOpts.easingOut, - step : _draw, - complete : _cleanup - }); - - } else { - wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup); - } - }; - - $.fancybox.resize = function() { - if (overlay.is(':visible')) { - overlay.css('height', $(document).height()); - } - - $.fancybox.center(true); - }; - - $.fancybox.center = function() { - var view, align; - - if (busy) { - return; - } - - align = arguments[0] === true ? 1 : 0; - view = _get_viewport(); - - if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) { - return; - } - - wrap - .stop() - .animate({ - 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)), - 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding)) - }, typeof arguments[0] == 'number' ? arguments[0] : 200); - }; - - $.fancybox.init = function() { - if ($("#fancybox-wrap").length) { - return; - } - - $('body').append( - tmp = $('
'), - loading = $('
'), - overlay = $('
'), - wrap = $('
') - ); - - outer = $('
') - .append('
') - .appendTo( wrap ); - - outer.append( - content = $('
'), - close = $(''), - title = $('
'), - - nav_left = $(''), - nav_right = $('') - ); - - close.click($.fancybox.close); - loading.click($.fancybox.cancel); - - nav_left.click(function(e) { - e.preventDefault(); - $.fancybox.prev(); - }); - - nav_right.click(function(e) { - e.preventDefault(); - $.fancybox.next(); - }); - - if ($.fn.mousewheel) { - wrap.bind('mousewheel.fb', function(e, delta) { - if (busy) { - e.preventDefault(); - - } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) { - e.preventDefault(); - $.fancybox[ delta > 0 ? 'prev' : 'next'](); - } - }); - } - - if (!$.support.opacity) { - wrap.addClass('fancybox-ie'); - } - - if (isIE6) { - loading.addClass('fancybox-ie6'); - wrap.addClass('fancybox-ie6'); - - $('').prependTo(outer); - } - }; - - $.fn.fancybox.defaults = { - padding : 10, - margin : 40, - opacity : false, - modal : false, - cyclic : false, - scrolling : 'auto', // 'auto', 'yes' or 'no' - - width : 560, - height : 340, - - autoScale : true, - autoDimensions : true, - centerOnScroll : false, - - ajax : {}, - swf : { wmode: 'transparent' }, - - hideOnOverlayClick : true, - hideOnContentClick : false, - - overlayShow : true, - overlayOpacity : 0.7, - overlayColor : '#777', - - titleShow : true, - titlePosition : 'float', // 'float', 'outside', 'inside' or 'over' - titleFormat : null, - titleFromAlt : false, - - transitionIn : 'fade', // 'elastic', 'fade' or 'none' - transitionOut : 'fade', // 'elastic', 'fade' or 'none' - - speedIn : 300, - speedOut : 300, - - changeSpeed : 300, - changeFade : 'fast', - - easingIn : 'swing', - easingOut : 'swing', - - showCloseButton : true, - showNavArrows : true, - enableEscapeButton : true, - enableKeyboardNav : true, - - onStart : function(){}, - onCancel : function(){}, - onComplete : function(){}, - onCleanup : function(){}, - onClosed : function(){}, - onError : function(){} - }; - - $(document).ready(function() { - $.fancybox.init(); - }); - -})(jQuery); \ No newline at end of file diff --git a/tests/lib/fancybox/jquery.fancybox-1.3.4.pack.js b/tests/lib/fancybox/jquery.fancybox-1.3.4.pack.js deleted file mode 100644 index 1373ed0..0000000 --- a/tests/lib/fancybox/jquery.fancybox-1.3.4.pack.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * FancyBox - jQuery Plugin - * Simple and fancy lightbox alternative - * - * Examples and documentation at: http://fancybox.net - * - * Copyright (c) 2008 - 2010 Janis Skarnelis - * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. - * - * Version: 1.3.4 (11/11/2010) - * Requires: jQuery v1.3+ - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - */ - -;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("
")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('

The requested content cannot be loaded.
Please try again later.

'); -F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| -c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= -false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('
').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", -function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='';P="";b.each(e.swf,function(x,H){C+='';P+=" "+x+'="'+H+'"'});C+='";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== -"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('
');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, -opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? -d.titlePosition=="float"?'
'+s+'
':'
'+s+"
":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); -y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== -i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); -f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== -37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); -s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('').appendTo(j); -f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); -j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== -"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), -10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; -b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= -0,C=a.length;ko.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ -1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= -true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; -b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- -d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
'),t=b('
'),u=b('
'),f=b('
'));D=b('
').append('
').appendTo(f); -D.append(j=b('
'),E=b(''),n=b('
'),z=b(''),A=b(''));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); -b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('').prependTo(D)}}}; -b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", -easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); \ No newline at end of file diff --git a/tests/lib/fancybox/jquery.mousewheel-3.0.4.pack.js b/tests/lib/fancybox/jquery.mousewheel-3.0.4.pack.js deleted file mode 100644 index cb66588..0000000 --- a/tests/lib/fancybox/jquery.mousewheel-3.0.4.pack.js +++ /dev/null @@ -1,14 +0,0 @@ -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) -* Licensed under the MIT License (LICENSE.txt). -* -* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. -* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. -* Thanks to: Seamus Leahy for adding deltaX and deltaY -* -* Version: 3.0.4 -* -* Requires: 1.2.2+ -*/ - -(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a= -f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); \ No newline at end of file diff --git a/tests/lib/jasmine-ext.js b/tests/lib/jasmine-ext.js deleted file mode 100644 index ac2ef45..0000000 --- a/tests/lib/jasmine-ext.js +++ /dev/null @@ -1,170 +0,0 @@ - -beforeEach(function() { - - // don't show warnings about deprecated methods like `moment.lang`, etc. - // at some point we'll require moment version above 2.8. - // until then, it's too annoying to support two versions. - // (not the best place for this) - moment.suppressDeprecationWarnings = true; - - jasmine.addMatchers({ - - // Moment and Duration - - toEqualMoment: function() { - return { - compare: function(actual, expected) { - var actualStr = $.fullCalendar.moment.parseZone(actual).format(); - var expectedStr = $.fullCalendar.moment.parseZone(expected).format(); - var result = { - pass: actualStr === expectedStr - }; - if (!result.pass) { - result.message = 'Moment ' + actualStr + ' does not equal ' + expectedStr; - } - return result; - } - }; - }, - toEqualNow: function() { - return { - compare: function(actual) { - var actualMoment = $.fullCalendar.moment.parseZone(actual); - var result = { - pass: Math.abs(actualMoment - new Date()) < 1000 // within a second of current datetime - }; - if (!result.pass) { - result.message = 'Moment ' + actualMoment.format() + ' is not close enough to now'; - } - return result; - } - }; - }, - toEqualDuration: function() { - return { - compare: function(actual, expected) { - var actualStr = serializeDuration(moment.duration(actual)); - var expectedStr = serializeDuration(moment.duration(expected)); - var result = { - pass: actualStr === expectedStr - }; - if (!result.pass) { - result.message = 'Duration ' + actualStr + ' does not equal ' + expectedStr; - } - return result; - } - }; - }, - - - // DOM - - toHaveScrollbars: function() { - return { - compare: function(actual) { - var elm = $(actual); - var result = { - pass: elm[0].scrollWidth - 1 > elm[0].clientWidth || // -1 !!! - elm[0].scrollHeight - 1 > elm[0].clientHeight // -1 !!! - }; - // !!! - IE was reporting a scrollWidth/scrollHeight 1 pixel taller than what it was :( - return result; - } - }; - }, - - - // Geometry - - toBeBoundedBy: function() { - return { - compare: function(actual, expected) { - var outer = getBounds(expected); - var inner = getBounds(actual); - var result = { - pass: outer && inner && - inner.left >= outer.left && - inner.right <= outer.right && - inner.top >= outer.top && - inner.bottom <= outer.bottom - }; - if (!result.pass) { - result.message = 'Element does not bound other element'; - } - return result; - } - }; - }, - toBeLeftOf: function() { - return { - compare: function(actual, expected) { - var subjectBounds = getBounds(actual); - var otherBounds = getBounds(expected); - var result = { - pass: subjectBounds && otherBounds && - Math.round(subjectBounds.right) <= Math.round(otherBounds.left) - // need to round because IE was giving weird fractions - }; - if (!result.pass) { - result.message = 'Element is not to the left of the other element'; - } - return result; - } - }; - }, - toBeRightOf: function() { - return { - compare: function(actual, expected) { - var subjectBounds = getBounds(actual); - var otherBounds = getBounds(expected); - var result = { - pass: subjectBounds && otherBounds && - Math.round(subjectBounds.left) >= Math.round(otherBounds.right) - // need to round because IE was giving weird fractions - }; - if (!result.pass) { - result.message = 'Element is not to the right of the other element'; - } - return result; - } - }; - } - - }); - - function serializeDuration(duration) { - return Math.floor(duration.asDays()) + '.' + - pad(duration.hours(), 2) + ':' + - pad(duration.minutes(), 2) + ':' + - pad(duration.seconds(), 2) + '.' + - pad(duration.milliseconds(), 3); - } - - function pad(n, width) { - n = n + ''; - return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n; - } - - function getBounds(node) { - var el = $(node); - var offset = el.offset(); - - if (!offset) { - return false; - } - - return { - top: offset.top, - left: offset.left, - right: offset.left + el.outerWidth(), - bottom: offset.top + el.outerHeight() - }; - } - -}); - -// Destroy the calendar afterwards, to prevent memory leaks -// (not the best place for this) -afterEach(function() { - $('#calendar,#cal').fullCalendar('destroy'); // common id's for calendars in tests -}); diff --git a/tests/lib/jquery-1.4.3.min.js b/tests/lib/jquery-1.4.3.min.js deleted file mode 100644 index c941a5f..0000000 --- a/tests/lib/jquery-1.4.3.min.js +++ /dev/null @@ -1,166 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.3 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Oct 14 23:10:06 2010 -0400 - */ -(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;nd)break;a.currentTarget=f.elem;a.data=f.handleObj.data; -a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b, -e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)} -function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)? -e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a, -1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false, -q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i= -[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i); -else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ": -"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r, -y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready, -1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i== -null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); -if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()=== -r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;F";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div"); -s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="
";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="
t
";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight=== -0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength", -cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]= -c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b= -c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e=== -"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e|| -[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this, -a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this, -a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d-1)return true;return false}, -val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&& -h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l=== -"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[]; -if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b|| -typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h=0){a.type= -f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)=== -false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e; -d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired= -A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type=== -"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]=== -0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); -(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3]; -break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr, -t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h= -k;g.sort(w);if(h)for(var j=1;j0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o, -m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== -true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== -g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return jo[3]-0},nth:function(g,j,o){return o[3]- -0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== -j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]]; -if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o, -g);else if(typeof g.length==="number")for(var p=g.length;m";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g); -o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&& -function(){var g=l,j=u.createElement("div");j.innerHTML="

";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o]; -j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== -0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g, -j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p0)for(var h=d;h0},closest:function(a, -b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h|| -!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}}); -c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling", -d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}}); -c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g, -$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/\s]+\/)>/g,O={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"], -area:[1,"",""],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this, -d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})}, -unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a= -c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*")); -c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($, -"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone|| -!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h= -d.length;f0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default, -s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]===""&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&& -c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]? -c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this; -return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]|| -h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]= -e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"": -b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b], -h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/)<[^<]*)*<\/script>/gi, -mb=/^(?:select|textarea)/i,nb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ob=/^(?:GET|HEAD|DELETE)$/,Na=/\[\]$/,T=/\=\?(&|$)/,ia=/\?/,pb=/([?&])_=[^&]*/,qb=/^(\w+:)?\/\/([^\/?#]+)/,rb=/%20/g,sb=/#.*$/,Ea=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ea)return Ea.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d= -b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l==="success"||l==="notmodified")h.html(f?c("
").append(k.responseText.replace(lb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& -!this.disabled&&(this.checked||mb.test(this.nodeName)||nb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, -getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", -script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=ob.test(h);b.url=b.url.replace(sb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ia.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| -!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+kb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(m){f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);if(c.isFunction(l))l(m);else{E[d]=A;try{delete E[d]}catch(p){}}v&&v.removeChild(B)}}if(b.dataType==="script"&&b.cache===null)b.cache= -false;if(b.cache===false&&h==="GET"){var n=c.now(),s=b.url.replace(pb,"$1_="+n);b.url=s+(s===b.url?(ia.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&&h==="GET")b.url+=(ia.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=qb.exec(b.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var v=u.getElementsByTagName("head")[0]||u.documentElement,B=u.createElement("script");if(b.scriptCharset)B.charset=b.scriptCharset;B.src= -b.url;if(!d){var D=false;B.onload=B.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);B.onload=B.onreadystatechange=null;v&&B.parentNode&&v.removeChild(B)}}}v.insertBefore(B,v.firstChild);return A}var H=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type", -b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(G){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& -c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){H||c.handleComplete(b,w,e,f);H=true;if(w)w.onreadystatechange=c.noop}else if(!H&&w&&(w.readyState===4||m==="timeout")){H=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| -c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&g.call&&g.call(w);M("abort")}}catch(j){}b.async&&b.timeout>0&&setTimeout(function(){w&&!H&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(o){c.handleError(b,w,null,o);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+ -"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ca(f,a[f],b,e);return d.join("&").replace(rb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a, -b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag"); -if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr= -function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var da={},tb=/^(?:toggle|show|hide)$/,ub=/^([+\-]=)?([\d+.\-]+)(.*)$/,aa,na=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{a= -0;for(b=this.length;a=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, -d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* -Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(h){return f.step(h)} -this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var f=this;a=c.fx;e.elem=this.elem;if(e()&&c.timers.push(e)&&!aa)aa=setInterval(a.tick,a.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; -this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| -this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= -c.timers,b=0;b-1;e={};var s={};if(n)s=f.position();k=n?s.top:parseInt(k,10)||0;l=n?s.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a, -e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Fa.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.body;a&&!Fa.test(a.nodeName)&& -c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=ea(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=ea(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); -c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var k=c(this);k[d](e.call(this,h,k[d]()))});return c.isWindow(f)?f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b]:f.nodeType===9?Math.max(f.documentElement["client"+ -b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):e===A?parseFloat(c.css(f,d)):this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/tests/lib/jquery-simulate-hacks.js b/tests/lib/jquery-simulate-hacks.js deleted file mode 100644 index fa529f3..0000000 --- a/tests/lib/jquery-simulate-hacks.js +++ /dev/null @@ -1,54 +0,0 @@ -(function($) { - - /* - Addresses a shortcoming with jquery-simulate[-ext] where a click event doesn't - provide pageX/pageY coordinates. Should be the centered coordinates of the element. - This file needs to be loaded after jquery-simulate and jquery-simulate-ext. - */ - - var originalMouseEvent = $.simulate.prototype.mouseEvent; - - $.simulate.prototype.mouseEvent = function(type, options) { - if (type === 'click' && options.pageX === undefined && options.pageY === undefined) { - $.extend(options, findCenterPageXY(this.target)); - } - // after this, jquery-simulate-ext will calculate screenX/screenY - // and jquery-simulate will calculate clientX/clientY... - return originalMouseEvent.apply(this, [ type, options ]); - }; - - function findCenterPageXY( elem ) { - var offset, - $elem = $(elem), - offset = $elem.offset(); - - return { - pageX: Math.round(offset.left + $elem.outerWidth() / 2), - pageY: Math.round(offset.top + $elem.outerHeight() / 2) - }; - } - - - /* - Give jquery-simulate-ext drag-n-drop a default interpolation. - */ - - var originalSimulate = $.fn.simulate; - - $.fn.simulate = function(eventName, options) { - - if (eventName == 'drag' || eventName == 'drop' || eventName == 'drag-n-drop') { - options = options || {}; - if (options.interpolation === undefined) { - options.interpolation = { - stepCount: 10, - duration: 100 - }; - } - return originalSimulate.call(this, eventName, options); - } - - return originalSimulate.apply(this, arguments); - }; - -})(jQuery); \ No newline at end of file diff --git a/tests/lib/themeswitcher/README.md b/tests/lib/themeswitcher/README.md deleted file mode 100644 index 172cbaf..0000000 --- a/tests/lib/themeswitcher/README.md +++ /dev/null @@ -1,29 +0,0 @@ -Super Theme Switcher is a jQuery plugin based on the original jQuery theme switcher that is no longer hosted or supported by the jQuery UI project. - -### Example: - $('#switcher').themeswitcher({ - imgpath: "images/", - loadTheme: "dot-luv" - }); - -But since all parameters are optional you can just use it like this: - $('#switcher').themeswitcher(); - -### Options - - * **imgPath**: String, path to image directory where theme icons are located - * **rounded**: Boolean, rounded corners on themeswitcher link and dropdown - * **themes**: An array of theme objects that will override the default themes. - [{title:"My theme",name:"my-theme",icon:"my-icon.png",url:"http://url-to-my-css-file.css"}] - * **additionalThemes**: An array of theme objects that will be INCLUDED along with the default themes. - [{title:"My theme",name:"my-theme",icon:"my-icon.png",url:"http://url-to-my-css-file.css"}] - * **jqueryUiVersion**: String, jQuery UI version of themes (Default themes are linked from Google CDN) - * **themePath**: String, Base path to where the jQuery UI CSS themes are located (Default is Google CDN) - -Demo located [here](http://dl.dropbox.com/u/188460/themeswitcher/sample.htm). - -This plugin includes the awesome jQuery cookie plugin by Klaus Hartl found [here](https://github.com/carhartl/jquery-cookie) - -Contact ----- -[@davehoff](http://www.twitter.com/davehoff) \ No newline at end of file diff --git a/tests/lib/themeswitcher/images/buttonbg.png b/tests/lib/themeswitcher/images/buttonbg.png deleted file mode 100644 index 084d7f9..0000000 Binary files a/tests/lib/themeswitcher/images/buttonbg.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/icon_color_arrow.gif b/tests/lib/themeswitcher/images/icon_color_arrow.gif deleted file mode 100644 index b458c7a..0000000 Binary files a/tests/lib/themeswitcher/images/icon_color_arrow.gif and /dev/null differ diff --git a/tests/lib/themeswitcher/images/menuhoverbg.png b/tests/lib/themeswitcher/images/menuhoverbg.png deleted file mode 100644 index c94cf53..0000000 Binary files a/tests/lib/themeswitcher/images/menuhoverbg.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_black_matte.png b/tests/lib/themeswitcher/images/theme_90_black_matte.png deleted file mode 100644 index 182cc0e..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_black_matte.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_black_tie.png b/tests/lib/themeswitcher/images/theme_90_black_tie.png deleted file mode 100644 index 4ea6693..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_black_tie.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_blitzer.png b/tests/lib/themeswitcher/images/theme_90_blitzer.png deleted file mode 100644 index 5dde122..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_blitzer.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_cupertino.png b/tests/lib/themeswitcher/images/theme_90_cupertino.png deleted file mode 100644 index 0d9f11a..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_cupertino.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_dark_hive.png b/tests/lib/themeswitcher/images/theme_90_dark_hive.png deleted file mode 100644 index 66ab870..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_dark_hive.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_dot_luv.png b/tests/lib/themeswitcher/images/theme_90_dot_luv.png deleted file mode 100644 index 2f7bf69..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_dot_luv.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_eggplant.png b/tests/lib/themeswitcher/images/theme_90_eggplant.png deleted file mode 100644 index 92e3d5a..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_eggplant.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_excite_bike.png b/tests/lib/themeswitcher/images/theme_90_excite_bike.png deleted file mode 100644 index 5f58e82..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_excite_bike.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_flick.png b/tests/lib/themeswitcher/images/theme_90_flick.png deleted file mode 100644 index 4baa549..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_flick.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_hot_sneaks.png b/tests/lib/themeswitcher/images/theme_90_hot_sneaks.png deleted file mode 100644 index cde01b3..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_hot_sneaks.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_humanity.png b/tests/lib/themeswitcher/images/theme_90_humanity.png deleted file mode 100644 index 891b39e..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_humanity.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_le_frog.png b/tests/lib/themeswitcher/images/theme_90_le_frog.png deleted file mode 100644 index 80d0d8b..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_le_frog.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_mint_choco.png b/tests/lib/themeswitcher/images/theme_90_mint_choco.png deleted file mode 100644 index 97d2c87..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_mint_choco.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_overcast.png b/tests/lib/themeswitcher/images/theme_90_overcast.png deleted file mode 100644 index b1e5dcc..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_overcast.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_pepper_grinder.png b/tests/lib/themeswitcher/images/theme_90_pepper_grinder.png deleted file mode 100644 index 97b5d73..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_pepper_grinder.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_smoothness.png b/tests/lib/themeswitcher/images/theme_90_smoothness.png deleted file mode 100644 index fa0f8fe..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_smoothness.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_south_street.png b/tests/lib/themeswitcher/images/theme_90_south_street.png deleted file mode 100644 index 1545fd0..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_south_street.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_start_menu.png b/tests/lib/themeswitcher/images/theme_90_start_menu.png deleted file mode 100644 index abd9b67..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_start_menu.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_sunny.png b/tests/lib/themeswitcher/images/theme_90_sunny.png deleted file mode 100644 index 32867b9..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_sunny.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_swanky_purse.png b/tests/lib/themeswitcher/images/theme_90_swanky_purse.png deleted file mode 100644 index 4ae2a33..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_swanky_purse.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_trontastic.png b/tests/lib/themeswitcher/images/theme_90_trontastic.png deleted file mode 100644 index f77b455..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_trontastic.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_ui_dark.png b/tests/lib/themeswitcher/images/theme_90_ui_dark.png deleted file mode 100644 index 80e0fe8..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_ui_dark.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_ui_light.png b/tests/lib/themeswitcher/images/theme_90_ui_light.png deleted file mode 100644 index 04544e3..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_ui_light.png and /dev/null differ diff --git a/tests/lib/themeswitcher/images/theme_90_windoze.png b/tests/lib/themeswitcher/images/theme_90_windoze.png deleted file mode 100644 index 2b8c3bd..0000000 Binary files a/tests/lib/themeswitcher/images/theme_90_windoze.png and /dev/null differ diff --git a/tests/lib/themeswitcher/jquery.themeswitcher.js b/tests/lib/themeswitcher/jquery.themeswitcher.js deleted file mode 100644 index 3f4390c..0000000 --- a/tests/lib/themeswitcher/jquery.themeswitcher.js +++ /dev/null @@ -1,466 +0,0 @@ -/** - * jQuery Theme Switcher plugin - * - * Copyright (c) 2011 Dave Hoff (davehoff.com) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -(function( $ ){ - - $.fn.themeswitcher = function( options ) { - var switcherDiv = this, switcherOptions = {}; - var settings = { - loadtheme : "", - height: 200, - width: 175, - rounded: true, - imgpath: "", - themepath: "https://ajax.googleapis.com/ajax/libs/jqueryui/", - jqueryuiversion: "1.8.10", - initialtext: "Switch Theme", - buttonpretext: "Theme:", - closeonselect: true, - buttonheight: 14, - cookiename: "jquery-ui-theme", - themes: [], - additionalthemes: [], - onopen: null, - onclose: null, - onselect: null, - cookieexpires: 365, - cookiepath: '/' - }; - - if(options) { - //lowercase all options passed in - $.each(options, function(k,v){ - switcherOptions[k.toLowerCase()] = v; - }); - - $.extend( settings, switcherOptions ); - } - - if( ! settings.themes.length ){ - var themes = [ - { - title: "Black Tie", - name: "black-tie", - icon: "theme_90_black_tie.png" - }, - { - title: "Blitzer", - name: "blitzer", - icon: "theme_90_blitzer.png" - }, - { - title: "Cupertino", - name: "cupertino", - icon: "theme_90_cupertino.png" - }, - { - title: "Dark Hive", - name: "dark-hive", - icon: "theme_90_dark_hive.png" - }, - { - title: "Dot Luv", - name: "dot-luv", - icon: "theme_90_dot_luv.png" - }, - { - title: "Eggplant", - name: "eggplant", - icon: "theme_90_eggplant.png" - }, - { - title: "Excite Bike", - name: "excite-bike", - icon: "theme_90_excite_bike.png" - }, - { - title: "Flick", - name: "flick", - icon: "theme_90_flick.png" - }, - { - title: "Hot Sneaks", - name: "hot-sneaks", - icon: "theme_90_hot_sneaks.png" - }, - { - title: "Humanity", - name: "humanity", - icon: "theme_90_humanity.png" - }, - { - title: "Le Frog", - name: "le-frog", - icon: "theme_90_le_frog.png" - }, - { - title: "Mint Choc", - name: "mint-choc", - icon: "theme_90_mint_choco.png" - }, - { - title: "Overcast", - name: "overcast", - icon: "theme_90_overcast.png" - }, - { - title: "Pepper Grinder", - name: "pepper-grinder", - icon: "theme_90_pepper_grinder.png" - }, - { - title: "Redmond", - name: "redmond", - icon: "theme_90_windoze.png" - }, - { - title: "Smoothness", - name: "smoothness", - icon: "theme_90_smoothness.png" - }, - { - title: "South Street", - name: "south-street", - icon: "theme_90_south_street.png" - }, - { - title: "Start", - name: "start", - icon: "theme_90_start_menu.png" - }, - { - title: "Sunny", - name: "sunny", - icon: "theme_90_sunny.png" - }, - { - title: "Swanky Purse", - name: "swanky-purse", - icon: "theme_90_swanky_purse.png" - }, - { - title: "Trontastic", - name: "trontastic", - icon: "theme_90_trontastic.png" - }, - { - title: "UI Darkness", - name: "ui-darkness", - icon: "theme_90_ui_dark.png" - }, - { - title: "UI Lightness", - name: "ui-lightness", - icon: "theme_90_ui_light.png" - }, - { - title: "Vader", - name: "vader", - icon: "theme_90_black_matte.png" - } - ] - }else{ - var themes = settings.themes; - } - - if( settings.additionalthemes.length ){ - $.extend( themes, settings.additionalthemes ); - } - - // Switcher link - var switcherLinkStyle = { - "cursor": "pointer", - "font-family": "'Trebuchet MS', Verdana, sans-serif", - "font-size": "11px", - "color": "#666", - "background": "#eee url("+settings.imgpath+"buttonbg.png) repeat-x 50% 50%", - "border": "1px solid #CCC", - "text-decoration": "none", - "padding": "3px 3px 3px 8px", - "width": settings.width+"px", - "display": "block", - "height": settings.buttonheight+"px", - "outline": "0px" , - "line-height": settings.buttonheight+"px" - } - - if( settings.rounded ){ - switcherLinkStyle['border-radius'] = "6px"; - switcherLinkStyle['-moz-border-radius'] = "6px"; - switcherLinkStyle['-webkit-border-radius'] = "6px"; - } - - var switcherLink = $("") - .addClass("jquery-ui-switcher-link") - .css(switcherLinkStyle) - .bind({ - mouseenter: function(){ - $(this).css({ - "background": "#eee" - }) - }, - mouseleave: function(){ - if( ! switcherDiv.find(".jquery-ui-switcher-list-hldr").is(":visible") ){ - $(this).css({ - "background":"#eee url("+settings.imgpath+"buttonbg.png) repeat-x 50% 50%" - }) - } - }, - click: function(){ - (!switcherDiv.find(".jquery-ui-switcher-list-hldr").is(":visible")) ? openSwitcher() : closeSwitcher(); - } - }); - - // Title & Icon for switcher link - var switcherTitle = $("").addClass("jquery-ui-switcher-title").appendTo(switcherLink); - $("").addClass("jquery-ui-switcher-arrow") - .css({ - "float": "right", - "width": "16px", - "height": "16px", - "background": "url("+settings.imgpath+"icon_color_arrow.gif) no-repeat 50% 50%" - }) - .appendTo(switcherLink); - - // load the default theme or the theme stored in the cookie - if( $.cookie(settings.cookiename) ){ - updateTheme( findTheme($.cookie(settings.cookiename)) ); - - }else if( settings.loadtheme.length ){ - updateTheme( findTheme(settings.loadtheme) ); - - }else{ - switcherTitle.text(settings.initialtext); - } - - var switcherListHldr = $("
") - .addClass("jquery-ui-switcher-list-hldr") - .css({ - "width": eval(settings.width+8)+"px", - "background": "#000", - "color": "#FFF", - "font-family": "'Trebuchet MS', Verdana, sans-serif", - "font-size": "12px", - "border": "1px solid #CCC", - "border-top": "none", - "z-index": "999999", - "position": "absolute", - "top": eval(settings.buttonheight+3)+"px", - "left": "0px", - "padding": "3px 3px 3px 0", - "display": "none" - }) - .bind({ - mouseleave: function(){ - closeSwitcher(); - } - }); - - if( settings.rounded ){ - switcherListHldr.css("border-radius","0 0 6px 6px"); - switcherListHldr.css("-moz-border-radius","0 0 6px 6px"); - switcherListHldr.css("-webkit-border-radius","0 0 6px 6px"); - } - - var switcherList = $("