spec/tests/media.tests.js
changeset 0 54063d8b0412
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spec/tests/media.tests.js	Tue Jul 06 11:31:19 2010 -0700
@@ -0,0 +1,26 @@
+Tests.prototype.MediaTests = function() {	
+	module('Media (Audio)');
+	test("should exist", function() {
+  		expect(1);
+  		ok(typeof Audio == "function", "'Audio' should be defined as a function in global scope.");
+	});
+	test("should define constants for Media errors", function() {
+		expect(5);
+		ok(MediaError != null && typeof MediaError != 'undefined', "MediaError object exists in global scope.");
+		equals(MediaError.MEDIA_ERR_ABORTED, 1, "MediaError.MEDIA_ERR_ABORTED is equal to 1.");
+		equals(MediaError.MEDIA_ERR_NETWORK, 2, "MediaError.MEDIA_ERR_NETWORK is equal to 2.");
+		equals(MediaError.MEDIA_ERR_DECODE, 3, "MediaError.MEDIA_ERR_DECODE is equal to 3.");
+		equals(MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, 4, "MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED is equal to 4.");
+	});
+	test("should contain 'src', 'loop' and 'error' properties", function() {
+  		expect(7);
+		var audioSrc = '/test.mp3';
+		var audio = new Audio(audioSrc);
+  		ok(typeof audio == "object", "Instantiated 'Audio' object instance should be of type 'object.'");
+		ok(audio.src != null && typeof audio.src != 'undefined', "Instantiated 'Audio' object's 'src' property should not be null or undefined.");
+		ok(audio.src == audioSrc, "Instantiated 'Audio' object's 'src' property should match constructor parameter.");
+		ok(audio.loop != null && typeof audio.loop != 'undefined', "Instantiated 'Audio' object's 'loop' property should not be null or undefined.");
+		ok(audio.loop == false, "Instantiated 'Audio' object's 'loop' property should initially be false.");
+		ok(typeof audio.error != 'undefined', "Instantiated 'Audio' object's 'error' property should not undefined.");
+		ok(audio.error == null, "Instantiated 'Audio' object's 'error' should initially be null.");
+};
\ No newline at end of file