Hide tooltip when host is detached

Bug: Issue 5758
Change-Id: Idada8ad3880b515e8222a23da4fac5363e0f9e4d
This commit is contained in:
Viktar Donich
2017-03-13 13:39:53 -07:00
parent 92e4362613
commit 820537fa5b
2 changed files with 9 additions and 0 deletions

View File

@@ -43,6 +43,7 @@
},
detached: function() {
this._handleHideTooltip();
this.unlisten(window, 'scroll', '_handleWindowScroll');
},

View File

@@ -20,6 +20,7 @@ limitations under the License.
<script src="../../bower_components/webcomponentsjs/webcomponents.min.js"></script>
<script src="../../bower_components/web-component-tester/browser.js"></script>
<link rel="import" href="../../bower_components/iron-test-helpers/iron-test-helpers.html">
<link rel="import" href="gr-tooltip-behavior.html">
<test-fixture id="basic">
@@ -108,5 +109,12 @@ limitations under the License.
assert.equal(tooltip.style.left, '915px');
assert.equal(tooltip.style.top, '100px');
});
test('hides tooltip when detached', function() {
sandbox.stub(element, '_handleHideTooltip');
element.remove();
flushAsynchronousOperations();
assert.isTrue(element._handleHideTooltip.called);
});
});
</script>