diff --git a/bower.json b/bower.json index 15fc732..7a323cc 100644 --- a/bower.json +++ b/bower.json @@ -6,7 +6,7 @@ "jquery": "~1.10.2", "jquery-ui": "~1.10.3", "jquery-simulate": "*", - "jasmine-jquery": "~1.7.0", - "jasmine-fixture": "~1.0.8" + "jasmine-jquery": "~2.0.3", + "jasmine-fixture": "~1.2.0" } } diff --git a/readme.md b/readme.md index e0c0c48..279f898 100644 --- a/readme.md +++ b/readme.md @@ -48,9 +48,9 @@ If you want to clean up the generated files, run: Automated Testing ----------------- -To run automated tests, you must first install [karma] globally: +To run automated tests, you must first install [karma] globally, as well as some karma plugins: - npm install -g karma + npm install -g karma karma-jasmine karma-phantomjs-launcher Then, assuming all your source files have been built (via `grunt dev` or `watch`), you can run the tests from a browser: diff --git a/tests/automated/isRTL.js b/tests/automated/isRTL.js index cfc2594..b712c48 100644 --- a/tests/automated/isRTL.js +++ b/tests/automated/isRTL.js @@ -19,15 +19,15 @@ describe('isRTL tests', function() { }); it('should have prev in left', function() { var fcHeaderLeft = $(cal).find('.fc-header-left')[0]; - expect(fcHeaderLeft).toContain('.fc-button-prev'); + expect(fcHeaderLeft).toContainElement('.fc-button-prev'); }); it('should have today in center', function() { var fcHeaderCenter = $(cal).find('.fc-header-center')[0]; - expect(fcHeaderCenter).toContain('.fc-button-today'); + expect(fcHeaderCenter).toContainElement('.fc-button-today'); }); it('should have next in right', function() { var fcHeaderRight = $(cal).find('.fc-header-right')[0]; - expect(fcHeaderRight).toContain('.fc-button-next'); + expect(fcHeaderRight).toContainElement('.fc-button-next'); }); }); @@ -46,15 +46,15 @@ describe('isRTL tests', function() { }); it('should have prev in left', function() { var fcHeaderLeft = $(cal).find('.fc-header-left')[0]; - expect(fcHeaderLeft).toContain('.fc-button-prev'); + expect(fcHeaderLeft).toContainElement('.fc-button-prev'); }); it('should have today in center', function() { var fcHeaderCenter = $(cal).find('.fc-header-center')[0]; - expect(fcHeaderCenter).toContain('.fc-button-today'); + expect(fcHeaderCenter).toContainElement('.fc-button-today'); }); it('should have next in right', function() { var fcHeaderRight = $(cal).find('.fc-header-right')[0]; - expect(fcHeaderRight).toContain('.fc-button-next'); + expect(fcHeaderRight).toContainElement('.fc-button-next'); }); }); @@ -73,15 +73,15 @@ describe('isRTL tests', function() { }); it('should have prev in left', function() { var fcHeaderLeft = $(cal).find('.fc-header-left')[0]; - expect(fcHeaderLeft).toContain('.fc-button-prev'); + expect(fcHeaderLeft).toContainElement('.fc-button-prev'); }); it('should have today in center', function() { var fcHeaderCenter = $(cal).find('.fc-header-center')[0]; - expect(fcHeaderCenter).toContain('.fc-button-today'); + expect(fcHeaderCenter).toContainElement('.fc-button-today'); }); it('should have next in right', function() { var fcHeaderRight = $(cal).find('.fc-header-right')[0]; - expect(fcHeaderRight).toContain('.fc-button-next'); + expect(fcHeaderRight).toContainElement('.fc-button-next'); }); }); diff --git a/tests/lib/jasmine-ext.js b/tests/lib/jasmine-ext.js index 3219e38..9e05d73 100644 --- a/tests/lib/jasmine-ext.js +++ b/tests/lib/jasmine-ext.js @@ -1,15 +1,27 @@ beforeEach(function() { - this.addMatchers({ - toEqualMoment: function(expected) { - return $.fullCalendar.moment(this.actual).format() === - $.fullCalendar.moment(expected).format(); + jasmine.addMatchers({ + toEqualMoment: function() { + return { + compare: function(actual, expected) { + return { + pass: $.fullCalendar.moment(actual).format() === + $.fullCalendar.moment(expected).format() + }; + } + }; }, toEqualNow: function() { - return Math.abs( - $.fullCalendar.moment(this.actual) - - new Date() - ) < 1000; // within a second of current datetime + return { + compare: function(actual) { + return { + pass: Math.abs( + $.fullCalendar.moment(actual) - + new Date() + ) < 1000 // within a second of current datetime + }; + } + }; } }); }); \ No newline at end of file