Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zjquery: Add set_height helper.

Steve Howell31f7f26a22c8
diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js
index 9c9a8df0073..61df398a0fe 100644
--- a/frontend_tests/node_tests/buddy_list.js
+++ b/frontend_tests/node_tests/buddy_list.js
@@ -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;
}
diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js
index e9457b89d71..63ca90080b5 100644
--- a/frontend_tests/node_tests/compose_actions.js
+++ b/frontend_tests/node_tests/compose_actions.js
@@ -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);
diff --git a/frontend_tests/zjsunit/zjquery.js b/frontend_tests/zjsunit/zjquery.js
index b45f3f493dd..03261f36cc1 100644
--- a/frontend_tests/zjsunit/zjquery.js
+++ b/frontend_tests/zjsunit/zjquery.js
@@ -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;
},