michael@0: /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: // Tests the computed-view keyboard navigation michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab("data:text/html,computed view keyboard nav test"); michael@0: michael@0: content.document.body.innerHTML = '
\n' + michael@0: '

Some header text

\n' + michael@0: '

hi.

\n' + michael@0: '

I am a test-case. This text exists ' + michael@0: 'solely to provide some things to ' + michael@0: 'highlight and count ' + michael@0: 'style list-items in the box at right. If you are reading this, ' + michael@0: 'you should go do something else instead. Maybe read a book. Or better ' + michael@0: 'yet, write some test-cases for another bit of code. ' + michael@0: 'some text

\n' + michael@0: '

more text

\n' + michael@0: '

even more text

' + michael@0: '
'; michael@0: content.document.title = "Computed view keyboard navigation test"; michael@0: michael@0: info("Opening the computed-view"); michael@0: let {toolbox, inspector, view} = yield openComputedView(); michael@0: michael@0: info("Selecting the test node"); michael@0: yield selectNode("span", inspector); michael@0: michael@0: info("Selecting the first computed style in the list"); michael@0: let firstStyle = view.styleDocument.querySelector(".property-view"); michael@0: ok(firstStyle, "First computed style found in panel"); michael@0: firstStyle.focus(); michael@0: michael@0: info("Tab to select the 2nd style and press return"); michael@0: let onExpanded = inspector.once("computed-view-property-expanded"); michael@0: EventUtils.synthesizeKey("VK_TAB", {}); michael@0: EventUtils.synthesizeKey("VK_RETURN", {}); michael@0: yield onExpanded; michael@0: michael@0: info("Verify the 2nd style has been expanded"); michael@0: let secondStyleSelectors = view.styleDocument.querySelectorAll( michael@0: ".property-content .matchedselectors")[1]; michael@0: ok(secondStyleSelectors.childNodes.length > 0, "Matched selectors expanded"); michael@0: michael@0: info("Tab back up and test the same thing, with space"); michael@0: let onExpanded = inspector.once("computed-view-property-expanded"); michael@0: EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}); michael@0: EventUtils.synthesizeKey("VK_SPACE", {}); michael@0: yield onExpanded; michael@0: michael@0: info("Verify the 1st style has been expanded too"); michael@0: let firstStyleSelectors = view.styleDocument.querySelectorAll( michael@0: ".property-content .matchedselectors")[0]; michael@0: ok(firstStyleSelectors.childNodes.length > 0, "Matched selectors expanded"); michael@0: });