[qooxdoo-commit] SF.net SVN: qooxdoo:[19943] trunk/qooxdoo/framework/source/class/qx
Brought to you by:
ecker,
martinwittemann
From: <chr...@us...> - 2009-08-28 09:52:01
|
Revision: 19943 http://qooxdoo.svn.sourceforge.net/qooxdoo/?rev=19943&view=rev Author: chris_schmidt Date: 2009-08-28 09:51:52 +0000 (Fri, 28 Aug 2009) Log Message: ----------- Modified setParam, the parameter value should also be of the type boolean. -> Also modified the unit test for that Modified Paths: -------------- trunk/qooxdoo/framework/source/class/qx/html/Flash.js trunk/qooxdoo/framework/source/class/qx/test/html/Flash.js Modified: trunk/qooxdoo/framework/source/class/qx/html/Flash.js =================================================================== --- trunk/qooxdoo/framework/source/class/qx/html/Flash.js 2009-08-28 09:31:49 UTC (rev 19942) +++ trunk/qooxdoo/framework/source/class/qx/html/Flash.js 2009-08-28 09:51:52 UTC (rev 19943) @@ -198,7 +198,7 @@ * Set the param for the Flash DOM element, also called attribute. * * @param key {String} Key name. - * @param value {String|null} Value or <code>null</code> to remove param + * @param value {String|Boolean|null} Value or <code>null</code> to remove param */ setParam : function(key, value) { @@ -206,7 +206,9 @@ qx.core.Assert.assertString(key, "Invalid attribute 'key'."); if (arguments.length > 1 && value !== null) { - qx.core.Assert.assertString(value, "Invalid attribute 'value'."); + if (!qx.lang.Type.isBoolean(value) && !qx.lang.Type.isString(value)) { + throw new Error("Invalid attribute 'value' expected String, Boolean or null."); + } } } @@ -214,10 +216,10 @@ throw new Error("The params cannot be modified after initial creation"); } - if (value) { + if (value === null || value === undefined) { + delete this.__params[key]; + } else { this.__params[key] = value; - } else { - delete this.__params[key]; } }, Modified: trunk/qooxdoo/framework/source/class/qx/test/html/Flash.js =================================================================== --- trunk/qooxdoo/framework/source/class/qx/test/html/Flash.js 2009-08-28 09:31:49 UTC (rev 19942) +++ trunk/qooxdoo/framework/source/class/qx/test/html/Flash.js 2009-08-28 09:51:52 UTC (rev 19943) @@ -82,28 +82,38 @@ this.__flash.setAttribute("attrib2", null); this.__flash.setAttribute("attrib4", null); - this.assertUndefined(this.__flash.getAttributes().attrib1, "1"); - this.assertUndefined(this.__flash.getAttributes().attrib2, "2"); - this.assertUndefined(this.__flash.getAttributes().attrib3, "3"); - this.assertUndefined(this.__flash.getAttributes().attrib4, "4"); + this.assertUndefined(this.__flash.getAttributes().attrib1); + this.assertUndefined(this.__flash.getAttributes().attrib2); + this.assertUndefined(this.__flash.getAttributes().attrib3); + this.assertUndefined(this.__flash.getAttributes().attrib4); }, testSetParam : function(key, value) { this.__flash.setParam("param1", "hoho"); this.__flash.setParam("param2", "gogo"); + this.__flash.setParam("param3", true); + this.__flash.setParam("param4", false); var map = this.__flash.getParams(); this.assertIdentical("hoho", this.__flash.getParams().param1); this.assertIdentical("gogo", this.__flash.getParams().param2); + this.assertTrue(this.__flash.getParams().param3); + this.assertFalse(this.__flash.getParams().param4); this.__flash.setParam("param1"); + this.__flash.setParam("param3"); this.assertUndefined(this.__flash.getParams().param1); this.assertIdentical("gogo", this.__flash.getParams().param2); + this.assertUndefined(this.__flash.getParams().param3); + this.assertFalse(this.__flash.getParams().param4); this.__flash.setParam("param2", null); + this.__flash.setParam("param4", null); this.assertUndefined(this.__flash.getParams().param1); this.assertUndefined(this.__flash.getParams().param2); + this.assertUndefined(this.__flash.getParams().param3); + this.assertUndefined(this.__flash.getParams().param4); } } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |