mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +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, '');
 | 
					    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
 | 
					// Call get_rendered_messages and then check that the last few headings and
 | 
				
			||||||
// bodies match the specified arrays.
 | 
					// bodies match the specified arrays.
 | 
				
			||||||
exports.expected_messages = function (table, headings, bodies) {
 | 
					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);
 | 
					    var msg = exports.get_rendered_messages(table);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    casper.test.assertEquals(
 | 
					    casper.test.assertEquals(
 | 
				
			||||||
        msg.headings.slice(-headings.length).map(exports.normalize_spaces).map(exports.ltrim),
 | 
					        msg.headings.slice(-headings.length).map(exports.normalize_spaces).map(exports.trim),
 | 
				
			||||||
        headings.map(exports.ltrim),
 | 
					        headings.map(exports.trim),
 | 
				
			||||||
        'Got expected message headings');
 | 
					        'Got expected message headings');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    casper.test.assertEquals(
 | 
					    casper.test.assertEquals(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user