pineconellc/angular-foundation — pull request #166 by ArTiSTiX (2014-12-06 17:49:28+00:00)
Title: dropdownToggle: uses parentOffset instead of window width + close on horizontal window resize

I notices some issues when changing window size with dropdown.
The original behaviour is to check if controller is small or not, but if the value changes from small -> !small, the dropdown had a different width.
The reason is because jquery.css() needs an empty string to reset css value (and not null values).

Secondly, dropdownWidth was calculated before the mediaQuery check... so if controller was small, width is the old value (95% of container).
I think it could be improved by removing some css calls, but the new behaviour is correct.

Then, i added a windows resize listener to close dropdown if windows is resized (since it can cause mediaQuery to changer).
But i filtered this to only horizontal resize, because on some devices, vertical resize can happen (toolbar appearing) when scrolling.

I was not able to write 2 tests: 'closes on window horizontal resize', and 'not closes on windows vertical resize', because $windows.resizeBy(deltaX, deltaY) works only for popups.
If anyone know how to trigger a custom resize event, don't hesitate to write those 2 missing tests.