From 87e4c2a90f8dcbe9204af338d1dc7f5dc057538f Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 23 Oct 2017 11:04:24 +1100 Subject: [PATCH] allow for missing header in tests --- .../select-box-kit/components/select-box-kit.js.es6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/select-box-kit/components/select-box-kit.js.es6 b/app/assets/javascripts/select-box-kit/components/select-box-kit.js.es6 index d9461d1cac1..e9a0bdba6d6 100644 --- a/app/assets/javascripts/select-box-kit/components/select-box-kit.js.es6 +++ b/app/assets/javascripts/select-box-kit/components/select-box-kit.js.es6 @@ -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);