browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Tests that source URLs are abbreviated properly for display on the right-
     1.8 +// hand side of the Web Console.
     1.9 +
    1.10 +function test() {
    1.11 +  testAbbreviation("http://example.com/x.js", "x.js");
    1.12 +  testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js");
    1.13 +  testAbbreviation("http://example.com/foo/bar/", "bar");
    1.14 +  testAbbreviation("http://example.com/foo.js?bar=1&baz=2", "foo.js");
    1.15 +  testAbbreviation("http://example.com/foo/?bar=1&baz=2", "foo");
    1.16 +
    1.17 +  finishTest();
    1.18 +}
    1.19 +
    1.20 +function testAbbreviation(aFullURL, aAbbreviatedURL) {
    1.21 +  is(WebConsoleUtils.abbreviateSourceURL(aFullURL), aAbbreviatedURL, aFullURL +
    1.22 +     " is abbreviated to " + aAbbreviatedURL);
    1.23 +}
    1.24 +

mercurial