DXR will be turned off on Tuesday, December 29th. It will redirect to Searchfox.
See the announcement on Discourse.

DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5b81998bb7ab)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
<!DOCTYPE HTML>
<html>
<head>
  <title>Test SmsFilter</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<iframe></iframe>
</div>
<pre id="test">
<script type="application/javascript">

/** Test SmsFilter **/

function throwingCheck(aFilter, aProperty, disallowedValue)
{
  disallowedValue.forEach(function(v) {
    var exception = false;
    try {
      aFilter[aProperty] = v;
    } catch (e) {
      exception = true;
    }
    ok(exception, "An exception should have been thrown");
  });
}

var filter = new MozSmsFilter();

isnot(filter, null, "filter should be set");

is(filter.startDate, null, "Parameters shouldn't be initialized");
is(filter.endDate, null, "Parameters shouldn't be initialized");
is(filter.numbers, null, "Parameters shouldn't be initialized");
is(filter.delivery, null, "Parameters shouldn't be initialized");
is(filter.read, null, "Parameters shouldn't be initialized");
is(filter.threadId, null, "Parameters shouldn't be initialized");

var date = new Date();
filter.startDate = date;
is(filter.startDate, "" + date, "Setters and getters should work!");
filter.startDate = null;
is(filter.startDate, null, "null should revert the value to default");
throwingCheck(filter, 'startDate', [ "foo", 42, [1, 2], function () {}, undefined ]);

filter.endDate = date;
is(filter.endDate, "" + date, "Setters and getters should work!");
filter.endDate = null;
is(filter.endDate, null, "null should revert the value to default");
throwingCheck(filter, 'endDate', [ "foo", 42, [1, 2], function () {}, undefined ]);

var numbers = [ "foo", "bar" ];
filter.numbers = numbers;
is(filter.numbers, "" + numbers, "Setters and getters should work!");
filter.numbers = null;
is(filter.numbers, null, "null should revert the value to default");
throwingCheck(filter, 'numbers', [ "foo", 42, function () {}, new Date(), undefined ]);

filter.delivery = "sent";
is(filter.delivery, "sent", "Setters and getters should work!");
filter.delivery = "received";
is(filter.delivery, "received", "Setters and getters should work!");
filter.delivery = "";
is(filter.delivery, null, "The empty string should revert the value to default.");
filter.delivery = null;
is(filter.delivery, null, "'null' should revert the value to default.");
throwingCheck(filter, 'delivery', [ "foo", 42, [1, 2], function () {}, new Date(), undefined ]);

filter.read = true;
is(filter.read, true, "Setters and getters should work!");
filter.read = false;
is(filter.read, false, "Setters and getters should work!");
filter.read = null;
is(filter.read, null, "'null' should revert the value to default");
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), undefined ]);

filter.threadId = 1;
is(filter.threadId, 1, "Setters and getters should work!");
filter.threadId = null;
is(filter.threadId, null, "'null' should revert the value to default");
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), undefined ]);

</script>
</pre>
</body>
</html>