|
|
|
|
@ -417,6 +417,34 @@ casper.cell_has_class = function(index, classes) {
|
|
|
|
|
}, {i : index, c: classes});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
casper.assert_colors_equal = function (hex_color, local_color, msg) {
|
|
|
|
|
// Tests to see if two colors are equal.
|
|
|
|
|
//
|
|
|
|
|
// Parameters
|
|
|
|
|
// hex_color: string
|
|
|
|
|
// Hexadecimal color code, with or without preceeding hash character.
|
|
|
|
|
// local_color: string
|
|
|
|
|
// Local color representation. Can either be hexadecimal (default for
|
|
|
|
|
// phantom) or rgb (default for slimer).
|
|
|
|
|
|
|
|
|
|
// Remove parentheses, hashes, semi-colons, and space characters.
|
|
|
|
|
hex_color = hex_color.replace(/[\(\); #]/, '');
|
|
|
|
|
local_color = local_color.replace(/[\(\); #]/, '');
|
|
|
|
|
|
|
|
|
|
// If the local color is rgb, clean it up and replace
|
|
|
|
|
if (local_color.substr(0,3).toLowerCase() == 'rgb') {
|
|
|
|
|
components = local_color.substr(3).split(',');
|
|
|
|
|
local_color = '';
|
|
|
|
|
for (var i = 0; i < components.length; i++) {
|
|
|
|
|
var part = parseInt(components[i]).toString(16);
|
|
|
|
|
while (part.length < 2) part = '0' + part;
|
|
|
|
|
local_color += part;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.test.assertEquals(hex_color.toUpperCase(), local_color.toUpperCase(), msg);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
casper.notebook_test = function(test) {
|
|
|
|
|
// Wrap a notebook test to reduce boilerplate.
|
|
|
|
|
//
|
|
|
|
|
|