mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
list_render test: Test replace_list_data.
This gets us to 100% line coverage for list_render, so we remove its exemption.
This commit is contained in:
@@ -630,3 +630,40 @@ run_test('sort helpers', () => {
|
|||||||
assert.equal(num_cmp(alice2, bob10), -1);
|
assert.equal(num_cmp(alice2, bob10), -1);
|
||||||
assert.equal(num_cmp(alice10, bob2), 1);
|
assert.equal(num_cmp(alice10, bob2), 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
run_test('replace_list_data w/filter update', () => {
|
||||||
|
const container = make_container();
|
||||||
|
make_scroll_container(container);
|
||||||
|
container.html = () => {};
|
||||||
|
|
||||||
|
const list = [1, 2, 3, 4];
|
||||||
|
let num_updates = 0;
|
||||||
|
|
||||||
|
list_render.create(container, list, {
|
||||||
|
name: 'replace-list',
|
||||||
|
modifier: (n) => '(' + n.toString() + ')',
|
||||||
|
filter: {
|
||||||
|
predicate: (n) => n % 2 === 0,
|
||||||
|
onupdate: () => {
|
||||||
|
num_updates += 1;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(num_updates, 0);
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
container.appended_data.html(),
|
||||||
|
'(2)(4)'
|
||||||
|
);
|
||||||
|
|
||||||
|
const widget = list_render.get('replace-list');
|
||||||
|
widget.replace_list_data([5, 6, 7, 8]);
|
||||||
|
|
||||||
|
assert.equal(num_updates, 1);
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
container.appended_data.html(),
|
||||||
|
'(6)(8)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ EXEMPT_FILES = {
|
|||||||
'static/js/invite.js',
|
'static/js/invite.js',
|
||||||
'static/js/lightbox_canvas.js',
|
'static/js/lightbox_canvas.js',
|
||||||
'static/js/lightbox.js',
|
'static/js/lightbox.js',
|
||||||
'static/js/list_render.js',
|
|
||||||
'static/js/list_util.js',
|
'static/js/list_util.js',
|
||||||
'static/js/loading.js',
|
'static/js/loading.js',
|
||||||
'static/js/local_message.js',
|
'static/js/local_message.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user