DEV: Use .ember-application instead of #main

`#main` in the test environment is replaced with `#ember-testing`, so this code would break. It never did only because we don't test these code paths 👀
This commit is contained in:
Jarek Radosz 2022-08-22 19:08:24 +02:00 committed by Alan Guo Xiang Tan
parent 349f6e18f3
commit 4ca6717994
3 changed files with 7 additions and 4 deletions

View File

@ -177,7 +177,7 @@ const SiteHeaderComponent = MountWidget.extend(
this.docAt = header.offsetTop;
}
const main = document.querySelector("#main");
const main = document.querySelector(".ember-application");
const offsetTop = main ? main.offsetTop : 0;
const offset = window.pageYOffset - offsetTop;
if (offset >= this.docAt) {

View File

@ -19,7 +19,9 @@ const ScrollingDOMMethods = {
},
screenNotFull() {
return window.height > document.querySelector("#main").offsetHeight;
return (
window.height > document.querySelector(".ember-application").offsetHeight
);
},
};

View File

@ -334,8 +334,9 @@ export default createWidget("topic-admin-menu", {
if (attrs.openUpwards) {
const documentHeight = $(document).height();
const mainHeight = $("#main").height();
let bottom = documentHeight - top - 70 - $("#main").offset().top;
const mainHeight = $(".ember-application").height();
let bottom =
documentHeight - top - 70 - $(".ember-application").offset().top;
if (documentHeight > mainHeight) {
bottom = bottom - (documentHeight - mainHeight) - outerHeight;