Set up $.fn.expectOne in setup.js

(imported from commit 77922cf8f506d4eb811498d418215eabf74b76ae)
This commit is contained in:
Steve Howell
2014-03-13 11:06:14 -04:00
committed by Leo Franchi
parent 91e83731f0
commit b12b44579c
3 changed files with 12 additions and 11 deletions

View File

@@ -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;
};
}
});

View File

@@ -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);

View File

@@ -2,8 +2,6 @@ add_dependencies({
util: 'js/util.js'
});
set_global('$', {});
var util = global.util;
(function test_CachedValue() {