Sha256: 977043f77c7cdb7acd41307b581b5621e6cdeec9dea3e66ac6473fd64a160937

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

dojo.provide("tests._base.Color");

(function(){
	var white  = dojo.colorFromString("white").toRgba();
	var maroon = dojo.colorFromString("maroon").toRgba();
	var verifyColor = function(t, source, expected){
		var color = new dojo.Color(source);
		t.is(expected, color.toRgba());
		dojo.forEach(color.toRgba(), function(n){ t.is("number", typeof(n)); });
	}

	doh.register("tests._base.Color", 
		[
			function testColor1(t){ verifyColor(t, "maroon", maroon); },
			function testColor2(t){ verifyColor(t, "white", white); },
			function testColor3(t){ verifyColor(t, "#fff", white); },
			function testColor4(t){ verifyColor(t, "#ffffff", white); },
			function testColor5(t){ verifyColor(t, "rgb(255,255,255)", white); },
			function testColor6(t){ verifyColor(t, "#800000", maroon); },
			function testColor7(t){ verifyColor(t, "rgb(128, 0, 0)", maroon); },
			function testColor8(t){ verifyColor(t, "rgba(128, 0, 0, 0.5)", [128, 0, 0, 0.5]); },
			function testColor9(t){ verifyColor(t, maroon, maroon); },
			function testColor10(t){ verifyColor(t, [1, 2, 3], [1, 2, 3, 1]); },
			function testColor11(t){ verifyColor(t, [1, 2, 3, 0.5], [1, 2, 3, 0.5]); },
			function testColor12(t){ verifyColor(t, dojo.blendColors(new dojo.Color("black"), new dojo.Color("white"), 0.5), [128, 128, 128, 1]); }
		]
	);
})();

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
dojo_src-1.5.0 dojo/dojo/tests/_base/Color.js
dojo_src-1.4.3 dojo/dojo/tests/_base/Color.js
dojo_src-1.4.102 dojo/dojo/tests/_base/Color.js
dojo-pkg-1.132.0 data/dojo-release-1.3.2-src/dojo/tests/_base/Color.js
dojo-pkg-1.111.0 data/dojo-release-1.1.1-src/dojo/tests/_base/Color.js
dojo-pkg-1.120.0 data/dojo-release-1.2.0-src/dojo/tests/_base/Color.js
dojo-pkg-1.121.0 data/dojo-release-1.2.1-src/dojo/tests/_base/Color.js
dojo-pkg-1.122.0 data/dojo-release-1.2.2-src/dojo/tests/_base/Color.js
dojo-pkg-1.123.0 data/dojo-release-1.2.3-src/dojo/tests/_base/Color.js
dojo-pkg-1.130.0 data/dojo-release-1.3.0-src/dojo/tests/_base/Color.js
dojo-pkg-1.131.0 data/dojo-release-1.3.1-src/dojo/tests/_base/Color.js