1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1.5 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 1.7 +<head> 1.8 + <title>script.aculo.us Unit test file</title> 1.9 + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 1.10 + <script src="../../lib/prototype.js" type="text/javascript"></script> 1.11 + <script src="../../src/scriptaculous.js" type="text/javascript"></script> 1.12 + <script src="../../src/unittest.js" type="text/javascript"></script> 1.13 + <link rel="stylesheet" href="../test.css" type="text/css" /> 1.14 +</head> 1.15 +<body> 1.16 +<h1>script.aculo.us Unit test file</h1> 1.17 +<p> 1.18 + Tests for String.prototype extensions in effects.js 1.19 +</p> 1.20 + 1.21 +<!-- Log output --> 1.22 +<div id="testlog"> </div> 1.23 + 1.24 +<!-- Tests follow --> 1.25 +<script type="text/javascript" language="javascript" charset="utf-8"> 1.26 +// <![CDATA[ 1.27 + 1.28 + new Test.Unit.Runner({ 1.29 + 1.30 + testStringParseColor: function() { with(this) { 1.31 + assertEqual('#000000', "#000000".parseColor()); 1.32 + assertEqual('#000000', "rgb(0,0,0)".parseColor()); 1.33 + assertEqual('#000000', "rgb(0, 0, 0)".parseColor()); 1.34 + assertEqual('#000000', "#000".parseColor()); 1.35 + 1.36 + assertEqual('#1', "#1".parseColor()); 1.37 + assertEqual('#12', "#12".parseColor()); 1.38 + assertEqual('#112233', "#123".parseColor()); 1.39 + assertEqual('#1234', "#1234".parseColor()); 1.40 + assertEqual('#12345', "#12345".parseColor()); 1.41 + assertEqual('#123456', "#123456".parseColor()); 1.42 + 1.43 + assertEqual('#abcdef', "#aBcDeF".parseColor()); 1.44 + assertEqual('#aabbcc', "#aBc".parseColor()); 1.45 + 1.46 + assertEqual('white', "white".parseColor()); 1.47 + assertEqual('#123456', "#123456".parseColor('#000000')); // default to #000000 if not parseable 1.48 + assertEqual('#000000', "white".parseColor('#000000')); // default to #000000 if not parseable 1.49 + 1.50 + assertEqual('#ffffff', "rgb(255,255,255)".parseColor()); 1.51 + assertEqual('#ff0000', "rgb(255,0,0)".parseColor()); 1.52 + assertEqual('#00ff00', "rgb(0,255,0)".parseColor()); 1.53 + assertEqual('#0000ff', "rgb(0,0,255)".parseColor()); 1.54 + }}, 1.55 + 1.56 + testStringParseStyle: function() { with(this) { 1.57 + var expected = "#<Hash:{'fontSize': '11px'}>"; 1.58 + 1.59 + assertInspect(expected, "font-size:11px".parseStyle()); 1.60 + assertInspect(expected, "font-SIZE: 11px".parseStyle()); 1.61 + assertInspect(expected, "font-size:11px ".parseStyle()); 1.62 + assertInspect(expected, " Font-size: 11px ".parseStyle()); 1.63 + }} 1.64 + 1.65 + }); 1.66 + 1.67 +// ]]> 1.68 +</script> 1.69 +</body> 1.70 +</html> 1.71 \ No newline at end of file