browser_webconsole_chrome.js 1019 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. // Tests that code completion works properly in chrome tabs, like about:credits.
  5. "use strict";
  6. function test() {
  7. Task.spawn(function* () {
  8. const {tab} = yield loadTab("about:config");
  9. ok(tab, "tab loaded");
  10. const hud = yield openConsole(tab);
  11. ok(hud, "we have a console");
  12. ok(hud.iframeWindow, "we have the console UI window");
  13. let jsterm = hud.jsterm;
  14. ok(jsterm, "we have a jsterm");
  15. let input = jsterm.inputNode;
  16. ok(hud.outputNode, "we have an output node");
  17. // Test typing 'docu'.
  18. input.value = "docu";
  19. input.setSelectionRange(4, 4);
  20. let deferred = promise.defer();
  21. jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function () {
  22. is(jsterm.completeNode.value, " ment", "'docu' completion");
  23. deferred.resolve(null);
  24. });
  25. yield deferred.promise;
  26. }).then(finishTest);
  27. }