mirror of https://github.com/zulip/zulip.git
lightbox: Export method for testing purposes.
We weren't exercising this method in any meaningful way during the tests, and when do add coverage, we probably want to just test it directly. We also kill off stub_selector(), which was never well-documented.
This commit is contained in:
parent
aed5b65525
commit
ff3175f8a2
|
@ -48,8 +48,7 @@ run_test("pan_and_zoom", (override) => {
|
|||
return "message-stub";
|
||||
};
|
||||
|
||||
// Used by render_lightbox_list_images
|
||||
$.stub_selector(".focused_table .message_inline_image img", []);
|
||||
override(lightbox, "render_lightbox_list_images", () => {});
|
||||
|
||||
lightbox.open(img);
|
||||
|
||||
|
@ -84,8 +83,7 @@ run_test("youtube", (override) => {
|
|||
link.closest = () => msg;
|
||||
link.attr("href", href);
|
||||
|
||||
// Used by render_lightbox_list_images
|
||||
$.stub_selector(".focused_table .message_inline_image img", []);
|
||||
override(lightbox, "render_lightbox_list_images", () => {});
|
||||
|
||||
lightbox.open(img);
|
||||
assert.equal($(".image-actions .open").attr("href"), href);
|
||||
|
|
|
@ -531,10 +531,6 @@ function make_zjquery() {
|
|||
return elem;
|
||||
};
|
||||
|
||||
zjquery.stub_selector = function (selector, stub) {
|
||||
elems.set(selector, stub);
|
||||
};
|
||||
|
||||
zjquery.trim = function (s) {
|
||||
return s;
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ let is_open = false;
|
|||
// memoized instead of being looked up multiple times.
|
||||
const asset_map = new Map();
|
||||
|
||||
function render_lightbox_list_images(preview_source) {
|
||||
exports.render_lightbox_list_images = function (preview_source) {
|
||||
if (!is_open) {
|
||||
const images = Array.prototype.slice.call($(".focused_table .message_inline_image img"));
|
||||
const $image_list = $("#lightbox_overlay .image-list").html("");
|
||||
|
@ -31,10 +31,10 @@ function render_lightbox_list_images(preview_source) {
|
|||
exports.parse_image_data(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function display_image(payload) {
|
||||
render_lightbox_list_images(payload.preview);
|
||||
exports.render_lightbox_list_images(payload.preview);
|
||||
|
||||
$(".player-container").hide();
|
||||
$(".image-actions, .image-description, .download, .lightbox-canvas-trigger").show();
|
||||
|
@ -62,7 +62,7 @@ function display_image(payload) {
|
|||
}
|
||||
|
||||
function display_video(payload) {
|
||||
render_lightbox_list_images(payload.preview);
|
||||
exports.render_lightbox_list_images(payload.preview);
|
||||
|
||||
$(
|
||||
"#lightbox_overlay .image-preview, .image-description, .download, .lightbox-canvas-trigger",
|
||||
|
|
Loading…
Reference in New Issue