mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user