Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix: remove deprecated `event.type`

BREAKING CHANGE:

The deprecated `event.type` property has been removed.

See 0.22.0 release notes for migration instructions
  • Loading branch information...
Matt Lewis
Matt Lewis committed Aug 10, 2016
1 parent a7eee2a commit c53d4c84d386d5af6501c19e4cb4d6398e7723c8
@@ -57,10 +57,6 @@ angular
}
}

if (event.type && !event.color) {
$log.warn(LOG_PREFIX, 'Event type is deprecated, please see the changelog on how to upgrade: ' + CHANGELOG_LINK, event);
}

return true;
}

@@ -65,7 +65,6 @@ angular
if (shouldAddClass) {
var dayContainsEvent = day.events.indexOf(event) > -1;
if (dayContainsEvent) {
day.highlightClass = 'day-highlight dh-event-' + event.type;
day.backgroundColor = event.color ? event.color.secondary : '';
}
}
@@ -72,23 +72,4 @@
overflow: hidden;
text-overflow: ellipsis;
}
.day-highlight.dh-event-important {
border: 1px solid @eventImportantColor;
}
.day-highlight.dh-event-warning {
border: 1px solid @eventWarningColor;
}
.day-highlight.dh-event-info {
border: 1px solid @eventInfoColor;
}
.day-highlight.dh-event-inverse {
border: 1px solid @eventInverseColor;
}
.day-highlight.dh-event-success {
border: 1px solid @eventSuccessColor;
}
.day-highlight.dh-event-special {
background-color: @eventHiliteSpecial;
border: 1px solid @eventSpecialColor;
}
}
@@ -22,61 +22,7 @@
margin-top: 3px;
}

.event-important {
background-color: @eventImportantColor;
}

.event-info {
background-color: @eventInfoColor;
}

.event-warning {
background-color: @eventWarningColor;
}

.event-inverse {
background-color: @eventInverseColor;
}

.event-success {
background-color: @eventSuccessColor;
}

.event-special {
background-color: @eventSpecialColor;
}

.day-highlight:hover,
.day-highlight {
background-color: @eventHiliteStandart;
}

.day-highlight.dh-event-important:hover,
.day-highlight.dh-event-important {
background-color: @eventHiliteImportant;
}

.day-highlight.dh-event-warning:hover,
.day-highlight.dh-event-warning {
background-color: @eventHiliteWarning;
}

.day-highlight.dh-event-info:hover,
.day-highlight.dh-event-info {
background-color: @eventHiliteInfo;
}

.day-highlight.dh-event-inverse:hover,
.day-highlight.dh-event-inverse {
background-color: @eventHiliteInverse;
}

.day-highlight.dh-event-success:hover,
.day-highlight.dh-event-success {
background-color: @eventHiliteSuccess;
}

.day-highlight.dh-event-special:hover,
.day-highlight.dh-event-special {
background-color: @eventHiliteSpecial;
}
}
@@ -2,22 +2,8 @@
@rowHeightYear: 60px;

// Events

@eventStandardColor: #c3c3c3;
@eventImportantColor: #ad2121;
@eventInfoColor: dodgerblue;
@eventWarningColor: #e3bc08;
@eventSuccessColor: darkgreen;
@eventInverseColor: #1b1b1b;
@eventSpecialColor: #800080;

@eventHiliteStandart: #dddddd;
@eventHiliteImportant: lighten(@eventImportantColor, 53%);
@eventHiliteInfo: lighten(@eventInfoColor, 35%);
@eventHiliteWarning: lighten(@eventWarningColor, 40%);
@eventHiliteSuccess: lighten(@eventSuccessColor, 70%);
@eventHiliteInverse: lighten(@eventInverseColor, 65%);
@eventHiliteSpecial: lighten(@eventSpecialColor, 70%);

// MONTH
@rowHover: #fafafa;
@@ -32,6 +18,4 @@
@eventBorderColor: #ffffff;
@eventBorderRadius:8px;
@eventMargin: 2px;
@eventSize: 12px;

@calendarImagesPath: "../img";
@eventSize: 12px;
@@ -4,7 +4,7 @@
<div class="col-xs-12">
<div class="cal-row-fluid">
<div
class="cal-cell-6 day-highlight dh-event-{{ event.type }}"
class="cal-cell-6 day-highlight"
ng-style="{backgroundColor: event.color.secondary}"
data-event-class
ng-repeat="event in vm.allDayEvents track by event.$id">
@@ -45,7 +45,7 @@
<div
class="pull-left day-event day-highlight"
ng-repeat="dayEvent in vm.nonAllDayEvents track by dayEvent.event.$id"
ng-class="'dh-event-' + dayEvent.event.type + ' ' + dayEvent.event.cssClass"
ng-class="dayEvent.event.cssClass"
ng-style="{
top: dayEvent.top - 1 + 'px',
left: dayEvent.left + 60 + 'px',
@@ -4,7 +4,7 @@
href="javascript:;"
ng-click="$event.stopPropagation(); vm.onEventClick({calendarEvent: event})"
class="pull-left event"
ng-class="'event-' + event.type + ' ' + event.cssClass"
ng-class="event.cssClass"
ng-style="{backgroundColor: event.color.primary}"
ng-mouseenter="vm.highlightEvent(event, true)"
ng-mouseleave="vm.highlightEvent(event, false)"
@@ -7,7 +7,7 @@
ng-class="event.cssClass"
mwl-draggable="event.draggable === true"
drop-data="{event: event}">
<span class="pull-left event" ng-class="'event-' + event.type" ng-style="{backgroundColor: event.color.primary}"></span>
<span class="pull-left event" ng-style="{backgroundColor: event.color.primary}"></span>
&nbsp;
<a
href="javascript:;"
@@ -58,7 +58,7 @@
}">
<div
class="day-highlight"
ng-class="['dh-event-' + eventRow.event.type, eventRow.event.cssClass, !vm.showTimes && eventRow.startsBeforeWeek ? '' : 'border-left-rounded', !vm.showTimes && eventRow.endsAfterWeek ? '' : 'border-right-rounded']"
ng-class="[eventRow.event.cssClass, !vm.showTimes && eventRow.startsBeforeWeek ? '' : 'border-left-rounded', !vm.showTimes && eventRow.endsAfterWeek ? '' : 'border-right-rounded']"
ng-style="{backgroundColor: eventRow.event.color.secondary}"
data-event-class
mwl-draggable="eventRow.event.draggable === true"
@@ -187,20 +187,6 @@ describe('mwlCalendar directive', function() {
expect($log.warn).to.have.been.calledOnce;
});

it('should log a warning if the deprecated event type is used', function() {
$log.warn = sinon.spy();
scope.vm.events = [{title: 'title', startsAt: new Date(), type: 'success'}];
scope.$apply();
expect($log.warn).to.have.been.calledOnce;
});

it('should not log a warning if the deprecated event type is not used', function() {
$log.warn = sinon.spy();
scope.vm.events = [{title: 'title', startsAt: new Date(), color: {primary: 'blue', secondary: 'lightblue'}}];
scope.$apply();
expect($log.warn).not.to.have.been.called;
});

afterEach(function() {
clock.restore();
});
@@ -141,27 +141,6 @@ describe('mwlCalendarMonth directive', function() {
expect(MwlCalendarCtrl.openDayIndex).to.be.undefined;
});

it('should highlight an event across multiple days', function() {
var monthView = [{
date: moment(calendarDay),
inMonth: true,
events: [scope.events[0]]
}, {
date: moment(calendarDay),
inMonth: true,
events: [scope.events[0]]
}, {
date: moment(calendarDay),
inMonth: true,
events: [scope.events[1]]
}];

MwlCalendarCtrl.view = monthView;
MwlCalendarCtrl.highlightEvent(scope.events[0], true);
expect(monthView[0].highlightClass).to.equal('day-highlight dh-event-warning');
expect(monthView[1].highlightClass).to.equal('day-highlight dh-event-warning');
});

it('should highlight the month with the events color', function() {

scope.events[0].color = {

0 comments on commit c53d4c8

Please sign in to comment.
You can’t perform that action at this time.