From 451c3a572c78d2367017e1d40137544900af0b07 Mon Sep 17 00:00:00 2001 From: Geoff Kimball Date: Wed, 2 Mar 2016 09:22:04 -0800 Subject: [PATCH] Update test case for issue #7070, and change drilldown height calculation to check the entire height of each submenu --- js/foundation.drilldown.js | 12 +-- scss/components/_drilldown.scss | 2 +- .../visual/drilldown/long-drilldown-menu.html | 50 ------------- test/visual/drilldown/long-titles.html | 73 +++++++++++++++++++ 4 files changed, 81 insertions(+), 56 deletions(-) delete mode 100644 test/visual/drilldown/long-drilldown-menu.html create mode 100644 test/visual/drilldown/long-titles.html diff --git a/js/foundation.drilldown.js b/js/foundation.drilldown.js index ee55085bc..5c2f456af 100644 --- a/js/foundation.drilldown.js +++ b/js/foundation.drilldown.js @@ -279,13 +279,15 @@ class Drilldown { * @private */ _getMaxDims() { - var max = 0, result = {}; - this.$submenus.add(this.$element).each(function(){ - var numOfElems = $(this).children('li').length; - max = numOfElems > max ? numOfElems : max; + var biggest = 0 + var result = {}; + + this.$submenus.add(this.$element).each((i, elem) => { + var height = elem.getBoundingClientRect().height; + if (height > biggest) biggest = height; }); - result['min-height'] = `${max * this.$menuItems[0].getBoundingClientRect().height}px`; + result['min-height'] = `${biggest}px`; result['max-width'] = `${this.$element[0].getBoundingClientRect().width}px`; return result; diff --git a/scss/components/_drilldown.scss b/scss/components/_drilldown.scss index 159dbb4e3..6dbb7cffb 100644 --- a/scss/components/_drilldown.scss +++ b/scss/components/_drilldown.scss @@ -39,7 +39,7 @@ $drilldown-background: $white !default; top: 0; #{$global-left}: 100%; z-index: -1; - height: 100%; + // height: 100%; width: 100%; background: $drilldown-background; transition: $drilldown-transition; diff --git a/test/visual/drilldown/long-drilldown-menu.html b/test/visual/drilldown/long-drilldown-menu.html deleted file mode 100644 index 70b0326a6..000000000 --- a/test/visual/drilldown/long-drilldown-menu.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - Foundation for Sites Testing - - - - -
-

Submenus should not be cut off at the bottom.

- - -
- - - - - - diff --git a/test/visual/drilldown/long-titles.html b/test/visual/drilldown/long-titles.html new file mode 100644 index 000000000..fee576d48 --- /dev/null +++ b/test/visual/drilldown/long-titles.html @@ -0,0 +1,73 @@ + + + + + + + Foundation for Sites Testing + + + + +
+

Submenus should not be cut off at the bottom.

+ + +
+ + + + + + -- 2.47.2