AUI-1096  A popover will not center align after its first visible toggle
AUI-1096 - Improve the logic, add tests
Merge branch 'pr-389'