mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-07-26 13:18:16 +08:00
latest jasmine-jquery and jasmine-fixture
This commit is contained in:
+2
-2
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user