Fixed expected_messages in casper tests

expected_messages was ltriming headings but we had a newline at the end
innerText. The ltrim was changed to a trim to correct this.

(imported from commit 5e411c5fc46a2cb675c1268041e95bbb2522c8f9)
This commit is contained in:
Jason Michalski
2014-01-07 11:23:14 -05:00
parent 14c0f3def9
commit 2a8f0b4b3b

View File

@@ -192,6 +192,14 @@ exports.ltrim = function (str) {
return str.replace(/^\s+/g, '');
};
exports.rtrim = function (str) {
return str.replace(/\s+$/g, '');
};
exports.trim = function (str) {
return exports.rtrim(exports.ltrim(str));
};
// Call get_rendered_messages and then check that the last few headings and
// bodies match the specified arrays.
exports.expected_messages = function (table, headings, bodies) {
@@ -201,8 +209,8 @@ exports.expected_messages = function (table, headings, bodies) {
var msg = exports.get_rendered_messages(table);
casper.test.assertEquals(
msg.headings.slice(-headings.length).map(exports.normalize_spaces).map(exports.ltrim),
headings.map(exports.ltrim),
msg.headings.slice(-headings.length).map(exports.normalize_spaces).map(exports.trim),
headings.map(exports.trim),
'Got expected message headings');
casper.test.assertEquals(