diff -r 000000000000 -r 6474c204b198 browser/devtools/sourceeditor/test/browser_css_getInfo.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/sourceeditor/test/browser_css_getInfo.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,177 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const cssAutoCompleter = require("devtools/sourceeditor/css-autocompleter"); + +const source = [ +".devtools-toolbar {", +" -moz-appearance: none;", +" padding:4px 3px;border-bottom-width: 1px;", +" border-bottom-style: solid;", +"}", +"", +"#devtools-menu.devtools-menulist,", +".devtools-toolbarbutton#devtools-menu {", +" -moz-appearance: none;", +" -moz-box-align: center;", +" min-width: 78px;", +" min-height: 22px;", +" text-shadow: 0 -1px 0 hsla(210,8%,5%,.45);", +" border: 1px solid hsla(210,8%,5%,.45);", +" border-radius: 3px;", +" background: linear-gradient(hsla(212,7%,57%,.35),", +" hsla(212,7%,57%,.1)) padding-box;", +" margin: 0 3px;", +" color: inherit;", +"}", +"", +".devtools-toolbarbutton > hbox.toolbarbutton-menubutton-button {", +" -moz-box-orient: horizontal;", +"}", +"", +".devtools-menulist:active,", +"#devtools-toolbarbutton:focus {", +" outline: 1px dotted hsla(210,30%,85%,0.7);", +" outline-offset : -4px;", +"}", +"", +".devtools-toolbarbutton:not([label]) {", +" min-width: 32px;", +"}", +"", +".devtools-toolbarbutton:not([label]) > .toolbarbutton-text, .devtools-toolbar {", +" display: none;", +"}", +].join("\n"); + +// Format of test cases : +// [ +// {line, ch}, - The caret position at which the getInfo call should be made +// expectedState, - The expected state at the caret +// expectedSelector, - The expected selector for the state +// expectedProperty, - The expected property name for states value and property +// expectedValue, - If state is value, then the expected value +// ] +const tests = [ + [{line: 0, ch: 13}, "selector", ".devtools-toolbar"], + [{line: 8, ch: 13}, "property", ["#devtools-menu.devtools-menulist", + ".devtools-toolbarbutton#devtools-menu "], "-moz-appearance"], + [{line: 28, ch: 25}, "value", [".devtools-menulist:active", + "#devtools-toolbarbutton:focus "], "outline-offset", "-4px"], + [{line: 4, ch: 1}, "null"], + [{line: 5, ch: 0}, "null"], + [{line: 31, ch: 13}, "selector", ".devtools-toolbarbutton:not([label])"], + [{line: 35, ch: 23}, "selector", ".devtools-toolbarbutton:not([label]) > .toolbarbutton-text"], + [{line: 35, ch: 70}, "selector", ".devtools-toolbar"], + [{line: 27, ch: 14}, "value", [".devtools-menulist:active", + "#devtools-toolbarbutton:focus "], "outline", "1px dotted hsla(210,30%,85%,0.7)"], + [{line: 16, ch: 16}, "value", ["#devtools-menu.devtools-menulist", + ".devtools-toolbarbutton#devtools-menu "], "background", + "linear-gradient(hsla(212,7%,57%,.35),\n hsla(212,7%,57%,.1)) padding-box"], + [{line: 16, ch: 3}, "value", ["#devtools-menu.devtools-menulist", + ".devtools-toolbarbutton#devtools-menu "], "background", + "linear-gradient(hsla(212,7%,57%,.35),\n hsla(212,7%,57%,.1)) padding-box"], + [{line: 15, ch: 25}, "value", ["#devtools-menu.devtools-menulist", + ".devtools-toolbarbutton#devtools-menu "], "background", + "linear-gradient(hsla(212,7%,57%,.35),\n hsla(212,7%,57%,.1)) padding-box"], +]; + +const TEST_URI = "data:text/html;charset=UTF-8," + encodeURIComponent( + ["", + "", + "
", + "