diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojo/tests/colors.js | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojo/tests/colors.js')
-rw-r--r-- | includes/js/dojo/tests/colors.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/includes/js/dojo/tests/colors.js b/includes/js/dojo/tests/colors.js new file mode 100644 index 0000000..7f3808e --- /dev/null +++ b/includes/js/dojo/tests/colors.js @@ -0,0 +1,48 @@ +if(!dojo._hasResource["tests.colors"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["tests.colors"] = true; +dojo.provide("tests.colors"); +dojo.require("dojo.colors"); + +(function(){ + var verifyColor = function(t, source, expected){ + var source = new dojo.Color(source); + var expected = new dojo.Color(expected); + t.is(expected.toRgba(), source.toRgba()); + dojo.forEach(source.toRgba(), function(n){ t.is("number", typeof(n)); }); + } + + doh.register("tests.colors", + [ + // all tests below are taken from #4.2 of the CSS3 Color Module + function testColorEx01(t){ verifyColor(t, "black", [0, 0, 0]); }, + function testColorEx02(t){ verifyColor(t, "white", [255, 255, 255]); }, + function testColorEx03(t){ verifyColor(t, "maroon", [128, 0, 0]); }, + function testColorEx04(t){ verifyColor(t, "olive", [128, 128, 0]); }, + function testColorEx05(t){ verifyColor(t, "#f00", "red"); }, + function testColorEx06(t){ verifyColor(t, "#ff0000", "red"); }, + function testColorEx07(t){ verifyColor(t, "rgb(255, 0, 0)", "red"); }, + function testColorEx08(t){ verifyColor(t, "rgb(100%, 0%, 0%)", "red"); }, + function testColorEx09(t){ verifyColor(t, "rgb(300, 0, 0)", "red"); }, + function testColorEx10(t){ verifyColor(t, "rgb(255, -10, 0)", "red"); }, + function testColorEx11(t){ verifyColor(t, "rgb(110%, 0%, 0%)", "red"); }, + function testColorEx12(t){ verifyColor(t, "rgba(255, 0, 0, 1)", "red"); }, + function testColorEx13(t){ verifyColor(t, "rgba(100%, 0%, 0%, 1)", "red"); }, + function testColorEx14(t){ verifyColor(t, "rgba(0, 0, 255, 0.5)", [0, 0, 255, 0.5]); }, + function testColorEx15(t){ verifyColor(t, "rgba(100%, 50%, 0%, 0.1)", [255, 128, 0, 0.1]); }, + function testColorEx16(t){ verifyColor(t, "hsl(0, 100%, 50%)", "red"); }, + function testColorEx17(t){ verifyColor(t, "hsl(120, 100%, 50%)", "lime"); }, + function testColorEx18(t){ verifyColor(t, "hsl(120, 100%, 25%)", "green"); }, + function testColorEx19(t){ verifyColor(t, "hsl(120, 100%, 75%)", "#80ff80"); }, + function testColorEx20(t){ verifyColor(t, "hsl(120, 50%, 50%)", "#40c040"); }, + function testColorEx21(t){ verifyColor(t, "hsla(120, 100%, 50%, 1)", "lime"); }, + function testColorEx22(t){ verifyColor(t, "hsla(240, 100%, 50%, 0.5)", [0, 0, 255, 0.5]); }, + function testColorEx23(t){ verifyColor(t, "hsla(30, 100%, 50%, 0.1)", [255, 128, 0, 0.1]); }, + function testColorEx24(t){ verifyColor(t, "transparent", [0, 0, 0, 0]); }, + // all tests below test greyscale colors + function testColorEx25(t){ verifyColor(t, dojo.colors.makeGrey(5), [5, 5, 5, 1]); }, + function testColorEx26(t){ verifyColor(t, dojo.colors.makeGrey(2, 0.3), [2, 2, 2, 0.3]); } + ] + ); +})(); + +} |