node tests: Reach 100% coverage for scroll_util.js.

This commit is contained in:
Steve Howell 2018-04-24 12:28:24 +00:00 committed by Tim Abbott
parent 97b9367d20
commit 605a90ce36
2 changed files with 39 additions and 0 deletions

View File

@ -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);
}());

View File

@ -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',