mirror of https://github.com/zulip/zulip.git
zjquery: Add set_height helper.
This commit is contained in:
parent
e93a4313f3
commit
31f7f26a22
|
@ -31,7 +31,7 @@ function init_simulated_scrolling() {
|
|||
|
||||
$("#buddy_list_wrapper")[0] = elem;
|
||||
|
||||
$("#buddy_list_wrapper_padding").height = () => 0;
|
||||
$("#buddy_list_wrapper_padding").set_height(0);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
|
|
@ -223,6 +223,8 @@ run_test("start", () => {
|
|||
abort_xhr_called = true;
|
||||
};
|
||||
|
||||
$("#compose-textarea").set_height(50);
|
||||
|
||||
assert_hidden("#compose_controls");
|
||||
cancel();
|
||||
assert(abort_xhr_called);
|
||||
|
|
|
@ -152,6 +152,8 @@ exports.make_new_elem = function (selector, opts) {
|
|||
let value;
|
||||
let css;
|
||||
let shown = false;
|
||||
let height;
|
||||
|
||||
const find_results = new Map();
|
||||
let my_parent;
|
||||
const parents_result = new Map();
|
||||
|
@ -234,7 +236,12 @@ exports.make_new_elem = function (selector, opts) {
|
|||
hasClass(class_name) {
|
||||
return classes.has(class_name);
|
||||
},
|
||||
height: noop,
|
||||
height() {
|
||||
if (height === undefined) {
|
||||
throw new Error(`Please call $("${selector}").set_height`);
|
||||
}
|
||||
return height;
|
||||
},
|
||||
hide() {
|
||||
shown = false;
|
||||
return self;
|
||||
|
@ -325,6 +332,9 @@ exports.make_new_elem = function (selector, opts) {
|
|||
serializeArray() {
|
||||
return self;
|
||||
},
|
||||
set_height(fake_height) {
|
||||
height = fake_height;
|
||||
},
|
||||
set_parent(parent_elem) {
|
||||
my_parent = parent_elem;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue