diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html b/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html new file mode 100644 index 0000000000..995dba496c --- /dev/null +++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/string_test.html @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>script.aculo.us Unit test file</title> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <script src="../../lib/prototype.js" type="text/javascript"></script> + <script src="../../src/scriptaculous.js" type="text/javascript"></script> + <script src="../../src/unittest.js" type="text/javascript"></script> + <link rel="stylesheet" href="../test.css" type="text/css" /> +</head> +<body> +<h1>script.aculo.us Unit test file</h1> +<p> + Tests for String.prototype extensions in effects.js +</p> + +<!-- Log output --> +<div id="testlog"> </div> + +<!-- Tests follow --> +<script type="text/javascript" language="javascript" charset="utf-8"> +// <![CDATA[ + + new Test.Unit.Runner({ + + testStringParseColor: function() { with(this) { + assertEqual('#000000', "#000000".parseColor()); + assertEqual('#000000', "rgb(0,0,0)".parseColor()); + assertEqual('#000000', "rgb(0, 0, 0)".parseColor()); + assertEqual('#000000', "#000".parseColor()); + + assertEqual('#1', "#1".parseColor()); + assertEqual('#12', "#12".parseColor()); + assertEqual('#112233', "#123".parseColor()); + assertEqual('#1234', "#1234".parseColor()); + assertEqual('#12345', "#12345".parseColor()); + assertEqual('#123456', "#123456".parseColor()); + + assertEqual('#abcdef', "#aBcDeF".parseColor()); + assertEqual('#aabbcc', "#aBc".parseColor()); + + assertEqual('white', "white".parseColor()); + assertEqual('#123456', "#123456".parseColor('#000000')); // default to #000000 if not parseable + assertEqual('#000000', "white".parseColor('#000000')); // default to #000000 if not parseable + + assertEqual('#ffffff', "rgb(255,255,255)".parseColor()); + assertEqual('#ff0000', "rgb(255,0,0)".parseColor()); + assertEqual('#00ff00', "rgb(0,255,0)".parseColor()); + assertEqual('#0000ff', "rgb(0,0,255)".parseColor()); + }}, + + testStringParseStyle: function() { with(this) { + var expected = "#<Hash:{'fontSize': '11px'}>"; + + assertInspect(expected, "font-size:11px".parseStyle()); + assertInspect(expected, "font-SIZE: 11px".parseStyle()); + assertInspect(expected, "font-size:11px ".parseStyle()); + assertInspect(expected, " Font-size: 11px ".parseStyle()); + }} + + }); + +// ]]> +</script> +</body> +</html>
\ No newline at end of file |