mirror of https://github.com/zulip/zulip.git
list_render: Use namespaces for events.
This commit is contained in:
parent
eb1344c41c
commit
0ff62fc6a2
|
@ -51,7 +51,8 @@ function make_containers() {
|
|||
|
||||
// Capture the scroll callback so we can call it in
|
||||
// our tests.
|
||||
parent_container.scroll = (f) => {
|
||||
parent_container.on = (sel, f) => {
|
||||
assert.equal(sel, 'scroll.list_widget_container');
|
||||
parent_container.call_scroll = () => {
|
||||
f.call(parent_container);
|
||||
};
|
||||
|
@ -77,7 +78,7 @@ function make_search_input() {
|
|||
$element.to_jquery = () => $element;
|
||||
|
||||
$element.on = (event_name, f) => {
|
||||
assert.equal(event_name, 'input');
|
||||
assert.equal(event_name, 'input.list_widget_filter');
|
||||
$element.simulate_input_event = () => {
|
||||
const elem = {
|
||||
value: $element.val(),
|
||||
|
|
|
@ -248,18 +248,18 @@ exports.create = function ($container, list, opts) {
|
|||
|
||||
// on scroll of the nearest scrolling container, if it hits the bottom
|
||||
// of the container then fetch a new block of items and render them.
|
||||
meta.scroll_container.scroll(function () {
|
||||
meta.scroll_container.on('scroll.list_widget_container', function () {
|
||||
if (this.scrollHeight - (this.scrollTop + this.clientHeight) < 10) {
|
||||
widget.render();
|
||||
}
|
||||
});
|
||||
|
||||
if (opts.parent_container) {
|
||||
opts.parent_container.on("click", "[data-sort]", exports.handle_sort);
|
||||
opts.parent_container.on('click.list_widget_sort', "[data-sort]", exports.handle_sort);
|
||||
}
|
||||
|
||||
if (opts.filter && opts.filter.element) {
|
||||
opts.filter.element.on("input", function () {
|
||||
opts.filter.element.on('input.list_widget_filter', function () {
|
||||
const value = this.value.toLocaleLowerCase();
|
||||
widget.set_filter_value(value);
|
||||
widget.hard_redraw();
|
||||
|
|
Loading…
Reference in New Issue