added two new config values for a widget : heightmax and widthmax. popcorn-port
authorhamidouk
Wed, 02 Nov 2011 10:58:34 +0100
branchpopcorn-port
changeset 170 5150ae56e0a6
parent 169 427632a324d5
child 171 158f0193ec54
added two new config values for a widget : heightmax and widthmax.
src/js/widgets.js
unittests/tests/widget.js
--- a/src/js/widgets.js	Fri Oct 28 17:28:15 2011 +0200
+++ b/src/js/widgets.js	Wed Nov 02 10:58:34 2011 +0100
@@ -20,11 +20,17 @@
      this.width = config.width;     
   }
   
-  if (config.hasOwnProperty("height")) {
-     // this.width and not this._width because we consider it public.
+  if (config.hasOwnProperty("height")) {    
      this.height = config.height;     
   }
   
+  if (config.hasOwnProperty("heightmax")) {
+     this.heightmax = config.heightmax;     
+  }
+
+  if (config.hasOwnProperty("widthmax")) {
+     this.widthmax = config.widthmax;     
+  }
   
 };
 
--- a/unittests/tests/widget.js	Fri Oct 28 17:28:15 2011 +0200
+++ b/unittests/tests/widget.js	Wed Nov 02 10:58:34 2011 +0100
@@ -17,5 +17,13 @@
     
   });
   
+  test("test initialisation with more values", function() {
+    var config = { container: "mydiv", widthmax: 640, heightmax: 480};
+    var wid = new IriSP.Widget(this.Popcorn, config, this.ser);
+    deepEqual(wid._config, config, "Check if the parent div is set correctly");
+    ok(wid.selector, "Check if the jquery selector is set");
+    
+  });
+  
   
 };
\ No newline at end of file