mirror of https://github.com/zulip/zulip.git
node tests: Reach 100% coverage for scroll_util.js.
This commit is contained in:
parent
97b9367d20
commit
605a90ce36
|
@ -53,3 +53,41 @@ zrequire('scroll_util');
|
|||
}));
|
||||
|
||||
}());
|
||||
|
||||
(function test_scroll_element_into_container() {
|
||||
const container = (function () {
|
||||
var top = 3;
|
||||
return {
|
||||
height: () => 100,
|
||||
scrollTop: (arg) => {
|
||||
if (arg === undefined) {
|
||||
return top;
|
||||
}
|
||||
top = arg;
|
||||
},
|
||||
};
|
||||
}());
|
||||
|
||||
const elem1 = {
|
||||
height: () => 25,
|
||||
position: () => {
|
||||
return {
|
||||
top: 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
scroll_util.scroll_element_into_container(elem1, container);
|
||||
assert.equal(container.scrollTop(), 3);
|
||||
|
||||
const elem2 = {
|
||||
height: () => 15,
|
||||
position: () => {
|
||||
return {
|
||||
top: 250,
|
||||
};
|
||||
},
|
||||
};
|
||||
scroll_util.scroll_element_into_container(elem2, container);
|
||||
assert.equal(container.scrollTop(), 250 - 100 + 3 + 15);
|
||||
}());
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ enforce_fully_covered = {
|
|||
'static/js/reactions.js',
|
||||
'static/js/recent_senders.js',
|
||||
'static/js/rtl.js',
|
||||
'static/js/scroll_util.js',
|
||||
'static/js/search_suggestion.js',
|
||||
# Removed because we're migrating code from uncovered other settings pages to here.
|
||||
# 'static/js/settings_ui.js',
|
||||
|
|
Loading…
Reference in New Issue