Skip to content

Commit 5a802a4

Browse files
author
Brad Berger
committed
Adds a last day of month test, updates docs
1 parent 7f0f5ca commit 5a802a4

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

test/unit/calendarService.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,22 @@ describe("calendar service", function() {
4343
expect(Calendar.weeks.length).toBe(4);
4444
});
4545

46+
it("should end with the correct date in February 2015", function() {
47+
Calendar.init(2015, 1);
48+
expect(angular.equals(Calendar.weeks[Calendar.weeks.length-1][6], $date(2015, 1, 28))).toBe(true);
49+
});
50+
4651
it("should start with the correct dates in October 2015", function() {
4752
Calendar.init(2015, 9);
4853
expect(angular.equals(Calendar.start, $date(2015, 9, 1))).toBe(true);
4954
expect(angular.equals(Calendar.weeks[0][0], $date(2015, 8, 27))).toBe(true);
5055
});
5156

57+
it("should end with the correct date in October 2015", function() {
58+
Calendar.init(2015, 9);
59+
expect(angular.equals(Calendar.weeks[Calendar.weeks.length-1][6], $date(2015, 10, 6))).toBe(true);
60+
});
61+
5262
it("should contain the correct number of weeks in October 2015", function() {
5363
Calendar.init(2015, 9);
5464
expect(Calendar.weeks.length).toBe(6);

website/index.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ <h5 class="mdl-typeography--headline">Tooltips</h5>
187187
&lt;script&gt;
188188
angular.module("materialExample", ["ngMaterial", "materialCalendar"]);
189189

190-
angular.module("materialExample").controller("calendarCtrl", function($scope, $filter) {
190+
angular.module("materialExample").controller("calendarCtrl", function($scope, $filter, $http, $q) {
191191

192192
$scope.dayFormat = "d";
193193

@@ -217,9 +217,21 @@ <h5 class="mdl-typeography--headline">Tooltips</h5>
217217

218218
$scope.tooltips = true;
219219
$scope.setDayContent = function(date) {
220-
// You would inject any HTML you wanted for
221-
// that particular date here.
220+
221+
// You would inject any HTML you wanted for
222+
// that particular date here.
222223
return "&lt;p&gt;&lt;/p&gt;";
224+
225+
// You could also use an $http function directly.
226+
return $http.get("/some/external/api");
227+
228+
// You could also use a promise.
229+
var deferred = $q.defer();
230+
$timeout(function() {
231+
deferred.resolve("&lt;p&gt;&lt;/p&gt;");
232+
}, 1000);
233+
return deferred.promise;
234+
223235
};
224236

225237
});

0 commit comments

Comments
 (0)