unittests/tests/polemicWidget.js
branchpopcorn-port
changeset 196 9fb4dcb0b878
parent 186 7a963ec3e09a
--- a/unittests/tests/polemicWidget.js	Fri Nov 04 12:40:30 2011 +0100
+++ b/unittests/tests/polemicWidget.js	Fri Nov 04 16:08:25 2011 +0100
@@ -46,6 +46,34 @@
     
     widget.draw();    
     equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");        
-    equal(IriSP.jQuery("#PolemicDiv").children().length, 1, "test if children have been added correctly");
+    equal(IriSP.jQuery("#PolemicDiv svg").length, 1, "test if svg div has been added correctly");
+    
+    // select the second element of the svg. the second because the first is a rect which serves
+    // as a background.
+    var paperSlider = IriSP.jQuery("#PolemicDiv svg :nth-child(2)");
+    // querying svg with jquery is quite the piece of cake.
+    equal(paperSlider.attr("x").baseVal.value, 0, "test if the slider has been created correctly");            
   });
+  
+  test("test widget interactions", function() {
+  
+    /* We can't test interactions because of raphael */
+    // var tooltip = new IriSP.TooltipWidget(this.Popcorn, this.config.requires[0], this.ser);
+    // var widget = new IriSP.PolemicWidget(this.Popcorn, this.config, this.ser);
+    
+    // widget.TooltipWidget = tooltip;
+    // widget.draw();
+    
+    // var spy_callback = this.spy();    
+    // this.Popcorn.listen("timeupdate", spy_callback);
+    
+    // var random = Math.round(Math.random() * widget.svgElements.length) + 1;
+    // var e = widget.svgElements[random].node;
+    // IriSP.jQuery(e).click();
+    
+    // ok(spy_callback.called, "the currenttime was changed");  
+    
+  });
+  
+  
 }; 
\ No newline at end of file