dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
michael@0 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
michael@0 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
michael@0 4 <head>
michael@0 5 <title>script.aculo.us Unit test file</title>
michael@0 6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
michael@0 7 <script src="../../lib/prototype.js" type="text/javascript"></script>
michael@0 8 <script src="../../src/scriptaculous.js" type="text/javascript"></script>
michael@0 9 <script src="../../src/unittest.js" type="text/javascript"></script>
michael@0 10 <link rel="stylesheet" href="../test.css" type="text/css" />
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <h1>script.aculo.us Unit test file</h1>
michael@0 14 <p>
michael@0 15 Tests for String.prototype extensions in effects.js
michael@0 16 </p>
michael@0 17
michael@0 18 <!-- Log output -->
michael@0 19 <div id="testlog"> </div>
michael@0 20
michael@0 21 <!-- Tests follow -->
michael@0 22 <script type="text/javascript" language="javascript" charset="utf-8">
michael@0 23 // <![CDATA[
michael@0 24
michael@0 25 new Test.Unit.Runner({
michael@0 26
michael@0 27 testStringParseColor: function() { with(this) {
michael@0 28 assertEqual('#000000', "#000000".parseColor());
michael@0 29 assertEqual('#000000', "rgb(0,0,0)".parseColor());
michael@0 30 assertEqual('#000000', "rgb(0, 0, 0)".parseColor());
michael@0 31 assertEqual('#000000', "#000".parseColor());
michael@0 32
michael@0 33 assertEqual('#1', "#1".parseColor());
michael@0 34 assertEqual('#12', "#12".parseColor());
michael@0 35 assertEqual('#112233', "#123".parseColor());
michael@0 36 assertEqual('#1234', "#1234".parseColor());
michael@0 37 assertEqual('#12345', "#12345".parseColor());
michael@0 38 assertEqual('#123456', "#123456".parseColor());
michael@0 39
michael@0 40 assertEqual('#abcdef', "#aBcDeF".parseColor());
michael@0 41 assertEqual('#aabbcc', "#aBc".parseColor());
michael@0 42
michael@0 43 assertEqual('white', "white".parseColor());
michael@0 44 assertEqual('#123456', "#123456".parseColor('#000000')); // default to #000000 if not parseable
michael@0 45 assertEqual('#000000', "white".parseColor('#000000')); // default to #000000 if not parseable
michael@0 46
michael@0 47 assertEqual('#ffffff', "rgb(255,255,255)".parseColor());
michael@0 48 assertEqual('#ff0000', "rgb(255,0,0)".parseColor());
michael@0 49 assertEqual('#00ff00', "rgb(0,255,0)".parseColor());
michael@0 50 assertEqual('#0000ff', "rgb(0,0,255)".parseColor());
michael@0 51 }},
michael@0 52
michael@0 53 testStringParseStyle: function() { with(this) {
michael@0 54 var expected = "#<Hash:{'fontSize': '11px'}>";
michael@0 55
michael@0 56 assertInspect(expected, "font-size:11px".parseStyle());
michael@0 57 assertInspect(expected, "font-SIZE: 11px".parseStyle());
michael@0 58 assertInspect(expected, "font-size:11px ".parseStyle());
michael@0 59 assertInspect(expected, " Font-size: 11px ".parseStyle());
michael@0 60 }}
michael@0 61
michael@0 62 });
michael@0 63
michael@0 64 // ]]>
michael@0 65 </script>
michael@0 66 </body>
michael@0 67 </html>

mercurial