diff options
Diffstat (limited to 'polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html')
-rw-r--r-- | polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html b/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html index f442c43266..8bca33935c 100644 --- a/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html +++ b/polygerrit-ui/app/behaviors/gr-tooltip-behavior/gr-tooltip-behavior_test.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <!-- +@license Copyright (C) 2017 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -111,6 +112,24 @@ limitations under the License. assert.equal(tooltip.style.top, '100px'); }); + test('position to bottom', () => { + sandbox.stub(element, 'getBoundingClientRect', () => { + return {top: 100, left: 950, width: 50, height: 50}; + }); + const tooltip = makeTooltip( + {height: 30, width: 120}, + {top: 0, left: 0, width: 1000}); + + element.positionBelow = true; + element._positionTooltip(tooltip); + assert.isTrue(tooltip.updateStyles.called); + const offset = tooltip.updateStyles + .lastCall.args[0]['--gr-tooltip-arrow-center-offset']; + assert.isAbove(parseFloat(offset.replace(/px$/, '')), 0); + assert.equal(tooltip.style.left, '915px'); + assert.equal(tooltip.style.top, '157.2px'); + }); + test('hides tooltip when detached', () => { sandbox.stub(element, '_handleHideTooltip'); element.remove(); |