node tests: Test refreshing pinned streams.

This commit is contained in:
Steve Howell 2018-04-25 16:12:16 +00:00 committed by Tim Abbott
parent cf24445809
commit 6e851f98f6
1 changed files with 36 additions and 0 deletions

View File

@ -689,6 +689,42 @@ narrow_state.active = () => false;
assert(count_updated); assert(count_updated);
}()); }());
set_global('$', global.make_zjquery());
(function test_refresh_pin() {
initialize_stream_data();
const sub = {
name: 'maybe_pin',
stream_id: 100,
color: 'blue',
pin_to_top: false,
};
stream_data.add_sub(sub.name, sub);
const pinned_sub = _.extend(sub, {
pin_to_top: true,
});
const li_stub = $.create('li stub');
templates.render = () => {
return {to_$: () => li_stub};
};
stream_list.update_count_in_dom = noop;
$('#stream_filters').append = noop;
var scrolled;
stream_list.scroll_stream_into_view = (li) => {
assert.equal(li, li_stub);
scrolled = true;
};
stream_list.refresh_pinned_or_unpinned_stream(pinned_sub);
assert(scrolled);
}());
(function test_create_initial_sidebar_rows() { (function test_create_initial_sidebar_rows() {
initialize_stream_data(); initialize_stream_data();