allow for missing header in tests

This commit is contained in:
Sam 2017-10-23 11:04:24 +11:00
parent 8eb00984ea
commit 87e4c2a90f
1 changed files with 2 additions and 1 deletions

View File

@ -341,7 +341,8 @@ export default Ember.Component.extend(UtilsMixin, DomHelpersMixin, KeyboardMixin
_applyDirection() {
let options = { left: "auto", bottom: "auto", top: "auto" };
const dHeaderBounds = $(".d-header")[0].getBoundingClientRect();
const dHeader = $(".d-header")[0];
const dHeaderBounds = dHeader ? dHeader.getBoundingClientRect() : {top: 0, height: 0};
const dHeaderHeight = dHeaderBounds.top + dHeaderBounds.height;
const headerHeight = this.$header().outerHeight(false);
const headerWidth = this.$header().outerWidth(false);