browser_webconsole_column_numbers.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // Check if console provides the right column number alongside line number
  5. "use strict";
  6. const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
  7. "test/test-console-column.html";
  8. var hud;
  9. function test() {
  10. loadTab(TEST_URI).then(() => {
  11. openConsole().then(consoleOpened);
  12. });
  13. }
  14. function consoleOpened(aHud) {
  15. hud = aHud;
  16. waitForMessages({
  17. webconsole: hud,
  18. messages: [{
  19. text: "Error Message",
  20. category: CATEGORY_WEBDEV,
  21. severity: SEVERITY_ERROR
  22. }]
  23. }).then(testLocationColumn);
  24. }
  25. function testLocationColumn() {
  26. let messages = hud.outputNode.children;
  27. let expected = ["10:7", "10:39", "11:9", "12:11", "13:9", "14:7"];
  28. for (let i = 0, len = messages.length; i < len; i++) {
  29. let msg = messages[i].textContent;
  30. is(msg.includes(expected[i]), true, "Found expected line:column of " +
  31. expected[i]);
  32. }
  33. finishTest();
  34. }