This repository was archived by the owner on Jun 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt Lewis
committed
Apr 12, 2015
1 parent
1eea230
commit 610b7ed
Showing
15 changed files
with
216 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe('calendarLimitToFilter', function() { | ||
|
||
var limitToFilter; | ||
|
||
beforeEach(inject(function(_calendarLimitToFilter_) { | ||
limitToFilter = _calendarLimitToFilter_; | ||
})); | ||
|
||
it('should return the first 2 items of the array', function() { | ||
|
||
var result = limitToFilter([1, 2, 3, 4], 2); | ||
expect(result).to.eql([1, 2]); | ||
|
||
}); | ||
|
||
it('should return the second 2 items of the array', function() { | ||
|
||
var result = limitToFilter([1, 2, 3, 4], 2, 2); | ||
expect(result).to.eql([3, 4]); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe('calendarTruncateEventTitleFilter', function() { | ||
|
||
var eventTitleFilter; | ||
|
||
beforeEach(inject(function(_calendarTruncateEventTitleFilter_) { | ||
eventTitleFilter = _calendarTruncateEventTitleFilter_; | ||
})); | ||
|
||
it('should return an empty string when passed a false value', function() { | ||
expect(eventTitleFilter(null)).to.equal(''); | ||
}); | ||
|
||
it('should return the original string', function() { | ||
expect(eventTitleFilter('test', 10, 100)).to.equal('test'); | ||
}); | ||
|
||
it('should return a truncated string for the first 5 characters', function() { | ||
expect(eventTitleFilter('A really long string', 5, 10)).to.equal('A rea...'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
describe('calendarConfig', function() { | ||
|
||
var calendarConfig; | ||
|
||
beforeEach(module('mwl.calendar', function(calendarConfigProvider) { | ||
calendarConfigProvider.setDateFormats({ | ||
hour: 'HA' | ||
}).setTitleFormats({ | ||
month: 'MMMM' | ||
}).setI18nStrings({ | ||
eventsLabel: 'Changed' | ||
}); | ||
})); | ||
|
||
beforeEach(inject(function(_calendarConfig_) { | ||
calendarConfig = _calendarConfig_; | ||
})); | ||
|
||
describe('setDateFormats', function() { | ||
it('should have changed the hour format', function() { | ||
expect(calendarConfig.dateFormats.hour).to.equal('HA'); | ||
}); | ||
}); | ||
|
||
describe('setTitleFormats', function() { | ||
it('should have changed the title format', function() { | ||
expect(calendarConfig.titleFormats.month).to.equal('MMMM'); | ||
}); | ||
}); | ||
|
||
describe('setI18nStrings', function() { | ||
it('should have changed the i18n strings', function() { | ||
expect(calendarConfig.i18nStrings.eventsLabel).to.equal('Changed'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe('calendarDebounce', function() { | ||
|
||
var calendarDebounce, $timeout; | ||
|
||
beforeEach(inject(function(_calendarDebounce_, _$timeout_) { | ||
calendarDebounce = _calendarDebounce_; | ||
$timeout = _$timeout_; | ||
})); | ||
|
||
it('should only be called once', function() { | ||
var spy = sinon.spy(); | ||
var myDebounce = calendarDebounce(spy, 10); | ||
myDebounce(); | ||
myDebounce(); | ||
myDebounce(); | ||
$timeout.flush(); | ||
expect(spy).to.have.been.called.once; | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,74 @@ | ||
describe('calendarHelper', function() { | ||
|
||
var calendarHelper; | ||
var calendarHelper, events; | ||
|
||
beforeEach(inject(function(_calendarHelper_) { | ||
calendarHelper = _calendarHelper_; | ||
|
||
events = [{ | ||
title: 'My event title', | ||
type: 'info', | ||
startsAt: new Date(2013,5,1,1), | ||
endsAt: new Date(2014,8,26,15), | ||
incrementsBadgeTotal: true | ||
}, { | ||
title: 'My event title', | ||
type: 'info', | ||
startsAt: new Date(2013,5,1,1), | ||
endsAt: new Date(2014,8,26,15), | ||
incrementsBadgeTotal: false | ||
}]; | ||
|
||
})); | ||
|
||
describe('getWeekDayNames', function() { | ||
|
||
it('should get the days of the week starting at sunday', function() { | ||
var weekdays = calendarHelper.getWeekDayNames(); | ||
expect(weekdays).to.eql(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']); | ||
}); | ||
|
||
it('should get the days of the week starting at monday', inject(function(moment) { | ||
moment.locale('en', { | ||
week : { | ||
dow : 1 // Monday is the first day of the week | ||
} | ||
}); | ||
|
||
var weekdays = calendarHelper.getWeekDayNames(); | ||
expect(weekdays).to.eql(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']); | ||
|
||
moment.locale('en', { | ||
week : { | ||
dow : 0 // Sunday is the first day of the week | ||
} | ||
}); | ||
})); | ||
|
||
}); | ||
|
||
describe('getYearView', function() { | ||
|
||
//TODO | ||
|
||
}); | ||
|
||
describe('getMonthView', function() { | ||
|
||
//TODO | ||
|
||
}); | ||
|
||
describe('getWeekView', function() { | ||
|
||
//TODO | ||
|
||
}); | ||
|
||
describe('getDayView', function() { | ||
|
||
//TODO | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe('calendarConfig', function() { | ||
|
||
var calendarTitle; | ||
var calendarDay = new Date(2015, 04, 01); | ||
|
||
beforeEach(inject(function(_calendarTitle_) { | ||
calendarTitle = _calendarTitle_; | ||
})); | ||
|
||
it('should give the correct day title', function() { | ||
expect(calendarTitle.day(calendarDay)).to.equal('Friday 1 May, 2015'); | ||
}); | ||
|
||
it('should give the correct week title', function() { | ||
expect(calendarTitle.week(calendarDay)).to.equal('Week 18 of 2015'); | ||
}); | ||
|
||
it('should give the correct month title', function() { | ||
expect(calendarTitle.month(calendarDay)).to.equal('May 2015'); | ||
}); | ||
|
||
it('should give the correct year title', function() { | ||
expect(calendarTitle.year(calendarDay)).to.equal('2015'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('moment', function() { | ||
|
||
it('should be the window moment object', inject(function($window, moment) { | ||
|
||
expect(moment).to.eql($window.moment); | ||
|
||
})); | ||
|
||
}); |