mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Add test for bug that was in Handlebars 1.0.9.
(imported from commit 56901dd0615938c9d061faf3f43ca23031c4d215)
This commit is contained in:
		
				
					committed by
					
						
						Waseem Daher
					
				
			
			
				
	
			
			
			
						parent
						
							4c3d22baf5
						
					
				
				
					commit
					b52d9c8c00
				
			@@ -17,6 +17,30 @@ function render(template_name, args) {
 | 
			
		||||
    return global.templates.render(template_name, args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
(function test_handlebars_bug () {
 | 
			
		||||
    // There was a bug in 1.0.9 where identically structured
 | 
			
		||||
    // blocks get confused, so when foo is false, it still
 | 
			
		||||
    // renders the foo-is-true block.
 | 
			
		||||
    var s = '';
 | 
			
		||||
    s += '{{#if foo}}';
 | 
			
		||||
    s += '{{#if bar}}';
 | 
			
		||||
    s += 'a';
 | 
			
		||||
    s += '{{else}}';
 | 
			
		||||
    s += 'b';
 | 
			
		||||
    s += '{{/if}}';
 | 
			
		||||
    s += '{{else}}';
 | 
			
		||||
    s += '{{#if bar}}';
 | 
			
		||||
    s += 'c';
 | 
			
		||||
    s += '{{else}}';
 | 
			
		||||
    s += 'd';
 | 
			
		||||
    s += '{{/if}}';
 | 
			
		||||
    s += '{{/if}}';
 | 
			
		||||
    var template = global.Handlebars.compile(s);
 | 
			
		||||
    var output = template({});
 | 
			
		||||
 | 
			
		||||
    assert.equal(output, 'd'); // the buggy version would return 'b'
 | 
			
		||||
}());
 | 
			
		||||
 | 
			
		||||
(function actions_popover_content() {
 | 
			
		||||
    var args = {
 | 
			
		||||
        "stream_subject_uri": "/stream/subject/uri",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user