mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	Set up $.fn.expectOne in setup.js
(imported from commit 77922cf8f506d4eb811498d418215eabf74b76ae)
This commit is contained in:
		
				
					committed by
					
						
						Leo Franchi
					
				
			
			
				
	
			
			
			
						parent
						
							91e83731f0
						
					
				
				
					commit
					b12b44579c
				
			@@ -36,4 +36,16 @@ $(function () {
 | 
			
		||||
        // zxcvbn.js is pretty big, and is only needed on password change, so load it asynchronously.
 | 
			
		||||
        $.getScript('/static/third/zxcvbn/zxcvbn.js');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (typeof $ !== 'undefined') {
 | 
			
		||||
        $.fn.expectOne = function () {
 | 
			
		||||
            if (blueslip && this.length !== 1) {
 | 
			
		||||
                blueslip.error("Expected one element in jQuery set, " + this.length + " found");
 | 
			
		||||
            }
 | 
			
		||||
            return this;
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -241,15 +241,6 @@ exports.enforce_arity = function util_enforce_arity(func) {
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if (typeof $ !== 'undefined') {
 | 
			
		||||
    $.fn.expectOne = function () {
 | 
			
		||||
        if (blueslip && this.length !== 1) {
 | 
			
		||||
            blueslip.error("Expected one element in jQuery set, " + this.length + " found");
 | 
			
		||||
        }
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.execute_early = function (func) {
 | 
			
		||||
    if (page_params.test_suite) {
 | 
			
		||||
        $(document).one('phantom_page_loaded', func);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,6 @@ add_dependencies({
 | 
			
		||||
    util: 'js/util.js'
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
set_global('$', {});
 | 
			
		||||
 | 
			
		||||
var util = global.util;
 | 
			
		||||
 | 
			
		||||
(function test_CachedValue() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user