Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FBTest for issue 959 (Enable auto-completion of built-in members)

  • Loading branch information...
commit 40a5c9d5703ddcf0b4d7bf38e2d1449fff143288 1 parent 191f202
@simonlindholm simonlindholm authored
View
2  tests/content/console/completion/3394/issue3394.js
@@ -9,7 +9,7 @@ function runTest()
var panel = FW.Firebug.chrome.selectPanel("console");
FBTest.clearAndTypeCommand("loc");
- FBTest.synthesizeKey("VK_TAB", null, win); // 9 == tab
+ FBTest.synthesizeKey("VK_TAB", null, win);
var doc = FW.Firebug.chrome.window.document;
var cmdLine = doc.getElementById("fbCommandLine");
View
6 tests/content/console/completion/4233/issue4233.html
@@ -3,6 +3,10 @@
<head>
<title>Test Case for Issue #4233</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<script>
+var htmlCollection = document.getElementsByTagName("html");
+var anArray = [1,2,3,4];
+</script>
</head>
<body>
@@ -80,6 +84,8 @@
<li><code style="color:green">function([i</code></li>
<li><code style="color:green">[{set a([i</code></li>
<li><code style="color:green">id(eval('window')).i</code></li>
+ <li><code style="color:green">anArray.0</code></li>
+ <li><code style="color:green">htmlCollection.0</code></li>
<li><code style="color:green">(window).i</code></li>
<li><code style="color:green">q='';q.s</code></li>
</ul>
View
5 tests/content/console/completion/4233/issue4233.js
@@ -19,7 +19,7 @@ function runTest()
cmdLine.value = expr.slice(0, -1);
FBTest.synthesizeKey(expr.slice(-1), null, win);
- var hasCompletion = (completionBox.value.length > cmdLine.value.length);
+ var hasCompletion = (completionBox.value.length > expr.length);
FBTest.compare(shouldComplete, hasCompletion,
"Completions should " + (shouldComplete ? "" : "not ") +
"appear for: " + expr);
@@ -89,6 +89,9 @@ function runTest()
["String.prototype.ch", true],
["new Date().g", true],
+ ["anArray.0", false],
+ ["htmlCollection.0", false],
+
// currently not handled
["(window).i", false],
["q='';q.s", false]
View
65 tests/content/console/completion/959/issue959.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8"/>
+ <title>Issue 959: Enable auto-completion of built-in members</title>
+ <link href="../../../_common/testcase.css" type="text/css" rel="stylesheet"/>
+ <script>
+
+obj1 = Object.create(null, {
+ aa1: { enumerable: false, configurable: false, set: function() { for (;;) { /* break everything */ } }},
+ aa2: { value: 1 }
+});
+obj2 = Object.create({}, {
+ aa1: { enumerable: false, configurable: false, set: function() { for (;;) { /* break everything */ } }},
+ aa2: { value: 1 }
+});
+ </script>
+ </head>
+ <body>
+ <header>
+ <h1><a href="http://code.google.com/p/fbug/issues/detail?id=959">Issue 959</a>: Enable auto-completion of built-in members</h1>
+ </header>
+ <div>
+ <section id="description">
+ <h3>Steps to reproduce</h3>
+ <ol>
+ <li>Verify the following completions:
+ <ul>
+ <li><code>Object.prototype.</code> -&gt; <code>toString</code> (with popup)</li>
+ <li><code>Object.</code> -&gt; <code>prototype</code> (with popup)</li>
+ <li><code>Object.getOwn</code> -&gt; <code>propertyNames</code> (with popup)</li>
+ <li><code>do</code> -&gt; <code>cument</code> (without popup)</li>
+ <li><code>document._</code> -&gt; <code>_proto__</code> (without popup)</li>
+ <li><code>obj1.</code> -&gt; <code>aa1</code> (with popup)</li>
+ <li><code>obj2.</code> -&gt; <code>aa1</code> (with popup)</li>
+ </ul>
+ </li>
+ <li>Verify that the following completions are avoided unless they are the only
+ option (e.g. by creating a similar property in the console)</li>
+ <ul>
+ <li><code>String.prototype.toLocaleUpperCase</code></li>
+ <li><code>''.toLocaleUpperCase</code></li>
+ <li><code>tostring</code></li>
+ <li><code>alert.arguments</code></li>
+ <li><code>document.body.__lookupGetter__</code></li>
+ <li><code>document.body.vLink</code></li>
+ </ul>
+ </li>
+ </ol>
+ <h3>Expected Results</h3>
+ <ul>
+ <li>All properties should be completeable.</li>
+ <li>A subset of annoying properties should never appear in completion popups
+ (except on Ctrl+Space), nor be findable with up/down as long as there are
+ properties not from that subset.</li>
+ <li><code>Object.prototype.</code> should show every Object-general property,
+ but e.g. <code>document.</code> should not.</li>
+ </ul>
+ </section>
+ <footer>
+ Simon Lindholm, simon.lindholm10@gmail.com
+ </footer>
+ </div>
+ </body>
+</html>
View
72 tests/content/console/completion/959/issue959.js
@@ -0,0 +1,72 @@
+function runTest()
+{
+ FBTest.sysout("issue959.START");
+ FBTest.setPref("commandLineShowCompleterPopup", true);
+ FBTest.openNewTab(basePath + "console/completion/959/issue959.html", function(win)
+ {
+ FBTest.openFirebug();
+ FBTest.enableConsolePanel(function(win)
+ {
+ var panel = FW.Firebug.chrome.selectPanel("console");
+
+ var doc = FW.Firebug.chrome.window.document;
+ var cmdLine = doc.getElementById("fbCommandLine");
+ var completionBox = doc.getElementById("fbCommandLineCompletion");
+ var popup = doc.getElementById("fbCommandLineCompletionList");
+ cmdLine.value = "";
+
+ function testWithPopup(callback, expr, wanted, wantedPopup)
+ {
+ // To save on time, only send the last character as a key press.
+ cmdLine.focus();
+ cmdLine.value = expr.slice(0, -1);
+ FBTest.synthesizeKey(expr.slice(-1), null, win);
+
+ FBTest.compare(expr + wanted, completionBox.value,
+ "Completing \"" + expr + "|" + wanted + "\"");
+ FBTest.compare(wantedPopup, (popup.state !== "closed"),
+ "Completion box should " + (wantedPopup ? "" : "not ") + " open.");
+
+ callback();
+ }
+
+ function testHidden(callback, expr)
+ {
+ // Add one shown property - if the popup shows there must have been
+ // another one before.
+ // (N.B., in the case expr = "''.toLocaleU" the eval doesn't
+ // work, but this is okay because the correct property is set
+ // on String.prototype just before.)
+ win.wrappedJSObject.eval(expr + "2 = 0");
+
+ cmdLine.focus();
+ cmdLine.value = expr.slice(0, -1);
+ FBTest.synthesizeKey(expr.slice(-1), null, win);
+ FBTest.compare("closed", popup.state, "Completion box should not open.");
+
+ callback();
+ }
+
+ var tasks = new FBTest.TaskList();
+ tasks.push(testWithPopup, "Object.prototype.", "toString", true);
+ tasks.push(testWithPopup, "Object.", "prototype", true);
+ tasks.push(testWithPopup, "Object.getOwn", "PropertyNames", true);
+ tasks.push(testWithPopup, "do", "cument", false);
+ tasks.push(testWithPopup, "document._", "_proto__", false);
+ tasks.push(testWithPopup, "obj1.", "aa1", true);
+ tasks.push(testWithPopup, "obj2.", "aa1", true);
+
+ tasks.push(testHidden, "String.prototype.toLocaleU");
+ tasks.push(testHidden, "''.toLocaleU");
+ tasks.push(testHidden, "tos");
+ tasks.push(testHidden, "document.body.__lo");
+ tasks.push(testHidden, "alert.arg");
+ tasks.push(testHidden, "document.body.vLin");
+
+ tasks.run(function()
+ {
+ FBTest.testDone("issue959.DONE");
+ }, 0);
+ });
+ });
+}
View
1  tests/content/firebug.html
@@ -141,6 +141,7 @@
{group: "console/api", uri: "console/api/trace.js", desc: "Test for console.trace API.", testPage: "console/api/trace.html" },
{group: "console/api", uri: "console/api/warn.js", desc: "Test for console.warn API.", testPage: "console/api/warn.html" },
{group: "console/completion", uri: "console/completion/index/index.js", desc: "Completions involving []-access.", testPage: "console/completion/index/index.html"},
+ {group: "console/completion", uri: "console/completion/959/issue959.js", desc: "Issue 959: Enable auto-completion of built-in members", testPage: "console/completion/959/issue959.html" },
{group: "console/completion", uri: "console/completion/3394/issue3394.js", desc: "Issue 3394: TAB Key does not finish an autocomplete keyword in Gnome (Ubuntu)", testPage: "console/completion/3394/issue3394.html" },
{group: "console/completion", uri: "console/completion/3421/issue3421.js", desc: "Issue 3421: Autocompletion expression parsing is wrong", testPage: "console/completion/3421/issue3421.html" },
{group: "console/completion", uri: "console/completion/3466/issue3466.js", desc: "Issue 3466: Can not use dir() command in console's command line", testPage: "console/completion/3466/issue3466.html" },
Please sign in to comment.
Something went wrong with that request. Please try again.