browser_webconsole_bug_704295.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 for bug 704295
  5. "use strict";
  6. const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
  7. "test/test-console.html";
  8. add_task(function* () {
  9. yield loadTab(TEST_URI);
  10. let hud = yield openConsole();
  11. testCompletion(hud);
  12. });
  13. function testCompletion(hud) {
  14. let jsterm = hud.jsterm;
  15. let input = jsterm.inputNode;
  16. // Test typing 'var d = 5;' and press RETURN
  17. jsterm.setInputValue("var d = ");
  18. EventUtils.synthesizeKey("5", {});
  19. EventUtils.synthesizeKey(";", {});
  20. is(input.value, "var d = 5;", "var d = 5;");
  21. is(jsterm.completeNode.value, "", "no completion");
  22. EventUtils.synthesizeKey("VK_RETURN", {});
  23. is(jsterm.completeNode.value, "", "clear completion on execute()");
  24. // Test typing 'var a = d' and press RETURN
  25. jsterm.setInputValue("var a = ");
  26. EventUtils.synthesizeKey("d", {});
  27. is(input.value, "var a = d", "var a = d");
  28. is(jsterm.completeNode.value, "", "no completion");
  29. EventUtils.synthesizeKey("VK_RETURN", {});
  30. is(jsterm.completeNode.value, "", "clear completion on execute()");
  31. }