mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-11 11:18:47 +08:00
some additional automated test utilities
This commit is contained in:
@@ -22,6 +22,7 @@ module.exports = function(config) {
|
||||
|
||||
'../lib/moment/moment.js',
|
||||
'../lib/jquery/dist/jquery.js',
|
||||
'../lib/jquery-ui/jquery-ui.js',
|
||||
|
||||
// for jquery simulate
|
||||
'../lib/jquery-simulate-ext/libs/bililiteRange.js',
|
||||
|
||||
@@ -65,7 +65,8 @@ beforeEach(function() {
|
||||
var outer = getBounds(expected);
|
||||
var inner = getBounds(actual);
|
||||
var result = {
|
||||
pass: inner.left >= outer.left &&
|
||||
pass: outer && inner &&
|
||||
inner.left >= outer.left &&
|
||||
inner.right <= outer.right &&
|
||||
inner.top >= outer.top &&
|
||||
inner.bottom <= outer.bottom
|
||||
@@ -76,6 +77,38 @@ beforeEach(function() {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
},
|
||||
toBeLeftOf: function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
var subjectBounds = getBounds(actual);
|
||||
var otherBounds = getBounds(expected);
|
||||
var result = {
|
||||
pass: subjectBounds && otherBounds &&
|
||||
subjectBounds.right <= otherBounds.left
|
||||
};
|
||||
if (!result.pass) {
|
||||
result.message = 'Element is not to the left of the other element';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
},
|
||||
toBeRightOf: function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
var subjectBounds = getBounds(actual);
|
||||
var otherBounds = getBounds(expected);
|
||||
var result = {
|
||||
pass: subjectBounds && otherBounds &&
|
||||
subjectBounds.left >= otherBounds.right
|
||||
};
|
||||
if (!result.pass) {
|
||||
result.message = 'Element is not to the right of the other element';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
@@ -97,6 +130,10 @@ beforeEach(function() {
|
||||
var el = $(node);
|
||||
var offset = el.offset();
|
||||
|
||||
if (!offset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
top: offset.top,
|
||||
left: offset.left,
|
||||
|
||||
Reference in New Issue
Block a user