Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Test that if a tooltip is visible when a new selection is made, it closes |
michael@0 | 8 | |
michael@0 | 9 | let test = asyncTest(function*() { |
michael@0 | 10 | yield addTab("data:text/html,<div class='one'>el 1</div><div class='two'>el 2</div>"); |
michael@0 | 11 | |
michael@0 | 12 | let {toolbox, inspector, view} = yield openRuleView(); |
michael@0 | 13 | yield selectNode(".one", inspector); |
michael@0 | 14 | |
michael@0 | 15 | info("Testing rule view tooltip closes on new selection"); |
michael@0 | 16 | yield testRuleView(view, inspector); |
michael@0 | 17 | |
michael@0 | 18 | info("Testing computed view tooltip closes on new selection"); |
michael@0 | 19 | let {view} = yield openComputedView(); |
michael@0 | 20 | yield testComputedView(view, inspector); |
michael@0 | 21 | }); |
michael@0 | 22 | |
michael@0 | 23 | function* testRuleView(ruleView, inspector) { |
michael@0 | 24 | info("Showing the tooltip"); |
michael@0 | 25 | let tooltip = ruleView.previewTooltip; |
michael@0 | 26 | let onShown = tooltip.once("shown"); |
michael@0 | 27 | tooltip.show(); |
michael@0 | 28 | yield onShown; |
michael@0 | 29 | |
michael@0 | 30 | info("Selecting a new node"); |
michael@0 | 31 | let onHidden = tooltip.once("hidden"); |
michael@0 | 32 | yield selectNode(".two", inspector); |
michael@0 | 33 | |
michael@0 | 34 | ok(true, "Rule view tooltip closed after a new node got selected"); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | function* testComputedView(computedView, inspector) { |
michael@0 | 38 | info("Showing the tooltip"); |
michael@0 | 39 | let tooltip = computedView.tooltip; |
michael@0 | 40 | let onShown = tooltip.once("shown"); |
michael@0 | 41 | tooltip.show(); |
michael@0 | 42 | yield onShown; |
michael@0 | 43 | |
michael@0 | 44 | info("Selecting a new node"); |
michael@0 | 45 | let onHidden = tooltip.once("hidden"); |
michael@0 | 46 | yield selectNode(".one", inspector); |
michael@0 | 47 | |
michael@0 | 48 | ok(true, "Computed view tooltip closed after a new node got selected"); |
michael@0 | 49 | } |