browser_cmd_csscoverage_util.js 784 B

12345678910111213141516171819202122232425
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Tests that the addon commands works as they should
  4. const csscoverage = require("devtools/server/actors/csscoverage");
  5. add_task(function* () {
  6. testDeconstructRuleId();
  7. });
  8. function testDeconstructRuleId() {
  9. // This is the easy case
  10. let rule = csscoverage.deconstructRuleId("http://thing/blah|10|20");
  11. is(rule.url, "http://thing/blah", "1 url");
  12. is(rule.line, 10, "1 line");
  13. is(rule.column, 20, "1 column");
  14. // This is the harder case with a URL containing a '|'
  15. rule = csscoverage.deconstructRuleId("http://thing/blah?q=a|b|11|22");
  16. is(rule.url, "http://thing/blah?q=a|b", "2 url");
  17. is(rule.line, 11, "2 line");
  18. is(rule.column, 22, "2 column");
  19. }