reorganized the layout of the test directories to follow the layout the source popcorn-port
authorhamidouk
Mon, 14 Nov 2011 12:26:17 +0100
branchpopcorn-port
changeset 234 43b198dc932d
parent 233 126de77ee73e
child 235 33210f1cc4a0
reorganized the layout of the test directories to follow the layout the source code.
unittests/index.html
unittests/tests/JSONSerializer.js
unittests/tests/annotationsWidget.js
unittests/tests/mockSerializer.js
unittests/tests/mockTweetSerializer.js
unittests/tests/playerWidget.js
unittests/tests/polemicWidget.js
unittests/tests/segmentsWidget.js
unittests/tests/serializers/JSONSerializer.js
unittests/tests/serializers/mockSerializer.js
unittests/tests/serializers/mockTweetSerializer.js
unittests/tests/sliderWidget.js
unittests/tests/tooltipWidget.js
unittests/tests/widgets/annotationsWidget.js
unittests/tests/widgets/playerWidget.js
unittests/tests/widgets/polemicWidget.js
unittests/tests/widgets/segmentsWidget.js
unittests/tests/widgets/sliderWidget.js
unittests/tests/widgets/tooltipWidget.js
--- a/unittests/index.html	Mon Nov 14 12:18:02 2011 +0100
+++ b/unittests/index.html	Mon Nov 14 12:26:17 2011 +0100
@@ -22,19 +22,19 @@
 	<!-- tests -->
 	<script src="tests/dataloader.js" type="text/javascript"></script>
 	<script src="tests/serializer.js" type="text/javascript"></script>
-	<script src="tests/mockSerializer.js" type="text/javascript"></script>
-	<script src="tests/mockTweetSerializer.js" type="text/javascript"></script>
-	<script src="tests/JSONSerializer.js" type="text/javascript"></script>
+	<script src="tests/serializers/mockSerializer.js" type="text/javascript"></script>
+	<script src="tests/serializers/mockTweetSerializer.js" type="text/javascript"></script>
+	<script src="tests/serializers/JSONSerializer.js" type="text/javascript"></script>
 	<script src="tests/serializerFactory.js" type="text/javascript"></script>
 	<script src="tests/widget.js" type="text/javascript"></script>
-	<script src="tests/playerWidget.js" type="text/javascript"></script>
-	<script src="tests/annotationsWidget.js" type="text/javascript"></script>
-	<script src="tests/segmentsWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/playerWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/annotationsWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/segmentsWidget.js" type="text/javascript"></script>
 	<script src="tests/layout.js" type="text/javascript"></script>
 	<script src="tests/init.js" type="text/javascript"></script>
-	<script src="tests/tooltipWidget.js" type="text/javascript"></script>
-	<script src="tests/polemicWidget.js" type="text/javascript"></script>
-	<script src="tests/sliderWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/tooltipWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/polemicWidget.js" type="text/javascript"></script>
+	<script src="tests/widgets/sliderWidget.js" type="text/javascript"></script>
 </head>
 <script>
  $(document).ready(function(){ 
--- a/unittests/tests/JSONSerializer.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-function test_JSONSerializer() {
-  module("JSON Serializer tests", 
-    { setup: function() {      
-      this.dt = new IriSP.DataLoader();
-      }
-    }
-    );    
-    
-    test("should return the correct JSON", function() {
-      var arr = ["ab", {"de" : "fg"}, "lp"];
-      var serializer = new IriSP.JSONSerializer(this.dt);
-
-      equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct");
-    });
-    
-    test("sync()", function() {
-      this.xhr = this.sandbox.useFakeXMLHttpRequest();
-      this.requests = [];
-      this.xhr.onCreate = function (request) {
-        this.requests.push(request);
-      };
-      
-      var response_array = { media: 12, content: "Hey there", 
-                             annotations: [{"begin": "32", "end" : 64}, {"begin": "08", "end" : 27},{"begin": "02", "end" : 61}]  };
-
-      /* sorted array is our comparision array */
-      var sorted_array = IriSP.jQuery.extend({}, response_array);
-      sorted_array.annotations.sort(function(a, b) 
-          { var a_begin = +a.begin;
-            var b_begin = +b.begin;
-            return a_begin - b_begin;
-          });
-          
-      var response_string = JSON.stringify(response_array);
-  
-      var spy_callback = this.spy();
-      var ser = new IriSP.JSONSerializer(this.dt, "/url");
-      
-      ser.sync(spy_callback);
-      
-      equals(this.xhr.requests.length, 1, "the mock ajax object should have received the request");
-      equals(this.xhr.requests[0].url, "/url", "the requested url is correct");
-
-      this.xhr.requests[0].respond(200, { "Content-Type": "application/json" },
-                             response_string);
-        
-      ok(spy_callback.calledOnce, "callback called");
-      ok(spy_callback.calledWith(response_array), "callback called with correct value");
-      deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value");
-      
-      var order_preserved = true;
-      
-      var i = 0;
-      for(i = 0; i < ser._data.length - 1; i++) {
-        if (ser._data.annotations[i].begin > ser._data.annotations[i+1].begin) {
-            order_preserved = false;
-            break;
-        }
-      }
-      
-      ok(order_preserved, "the annotation sub-array is sorted by begin time");
-    });
-
-    test("currentMedia should return the current media", function() {
-      var ser = new IriSP.JSONSerializer(this.dt, "/url");
-
-      ser._data = {}
-      ser._data.medias = [0];
-      equal(ser.currentMedia(), 0, "currentMedia() returns the correct value");
-    });
-
-    test("test annotation search", function() {
-      var ser = new IriSP.JSONSerializer(this.dt, "../test/test.json");
-            
-      ser._data = { annotations : [
-      {"content": {        
-        "description": "professeur", 
-        "title": "garrigou"
-        }},
-      { "content": {        
-        "description": "interview", 
-        "title": "Revue de presse - Hervé Gardette"
-      }},
-      {"content": {        
-        "description": "concept", 
-        "title": "idée"
-      }},
-      { "content": {        
-        "description": "", 
-        "title": "sans titre"
-      }}
-      ]};
-      
-      equal(ser.searchAnnotations("GarriGOU", "", "").length, 1, "requesting on title works");
-      equal(ser.searchAnnotations("", "IntErView", "").length, 1, "requesting on description works");      
-      equal(ser.searchAnnotations("", "", "").length, 4, "empty request works");
-      equal(ser.searchAnnotations("idée", "concept", "").length, 1, "specific request works");
-      
-      
-    });
-    
-    test("test occurence count", function() {
-    var ser = new IriSP.JSONSerializer(this.dt, "../test/test.json");
-            
-      ser._data = { annotations : [
-      {"content": {        
-        "description": "professeur", 
-        "title": "garrigou"
-        }, "id" : 1 },
-      { "content": {        
-        "description": "interview", 
-        "title": "Revue de presse - Hervé Gardette"
-      }, "id" : 2},
-      {"content": {        
-        "description": "concept", 
-        "title": "idée"
-      }, "id" : 3},
-      { "content": {        
-        "description": "", 
-        "title": "sans titre"
-      }, "id" : 4}
-      ]};
-      
-      // a function to get the number of fields in a dict.
-      function countOccurences(queryString) {
-        var count = 0;
-        for (var i in ser.searchOccurences(queryString)) {
-          count++;
-        };
-        
-        return count;
-      };
-      
-      equal(countOccurences("garrigou"), 1, "first request works");
-      deepEqual(ser.searchOccurences("garrigou"), {1 : 1}, "returned object is correctly defined");
-          
-      equal(countOccurences("garrigou interview"), 2, "second request works");
-      equal(countOccurences("garrigou idée interview"), 3, "third request works");
-    });
-};
\ No newline at end of file
--- a/unittests/tests/annotationsWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* annotationsWidget.js */
-
-function test_annotations_widget() {
-  module("annotations widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-        
-    IriSP.jQuery("#widget-div").append("<div id='Ldt-Ligne'></div>");
-    
-    this.config = {
-							width:650,
-							height:1,
-							mode:'radio',
-							container:'widget-div',
-							debug:true,
-							css:'../src/css/LdtPlayer.css'};
-    },
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }
-  });
-  
-  test("test widget initialization", function() {  
-    var widget = new IriSP.AnnotationsWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-
-    equal(widget.selector.children(".Ldt-AnnotationsWidget").length, 1, "test if the div has been added correctly");
-    equal(widget.selector.children(".Ldt-AnnotationsWidget").find(".Ldt-SaKeyword").length, 1, "test if sub-div has been added correctly");
-  });
-  
-  test("test annotation display function", function() {
-    var widget = new IriSP.AnnotationsWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-    var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords"}};
-    widget.displayAnnotation(annotation);
-    equal(widget.selector.find(".Ldt-SaTitle").text(), "title", "title set correctly");
-    equal(widget.selector.find(".Ldt-SaDescription").text(), "description", "description set correctly");
-    equal(widget.selector.find(".Ldt-SaKeywordText").text(), "", "keywords field set correctly");
-  });
-}; 
\ No newline at end of file
--- a/unittests/tests/mockSerializer.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-function test_mockSerializer() {
-  module("Mock Serializer basic tests");
-  
-  test("init the serializer with a DataLoader and an url", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockSerializer(dt, "http://google.com");
-      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
-      equal( ser._url, "http://google.com", "The url has been copied as well." );
-      ok(ser._data, "the mock data is defined");
-  });
-  
-  test("check that the serialize and deserialize abstract functions are defined", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockSerializer(dt);
-      notEqual(ser.serialize, undefined, ".serialize is defined");
-      notEqual(ser.deserialize, undefined, ".deserialize is defined");
-  });
-  
-  test("check that the callback is called", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockSerializer(dt);
-      var spy = this.spy();
-      ser.sync(spy);
-      ok(spy.called, "the callback has been called");
-  });
-
-};
\ No newline at end of file
--- a/unittests/tests/mockTweetSerializer.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-function test_mockTweetSerializer() {
-  module("Mock Tweet Serializer basic tests");
-  
-  test("init the serializer with a DataLoader and an url", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockTweetSerializer(dt, "http://google.com");
-      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
-      equal( ser._url, "http://google.com", "The url has been copied as well." );
-      ok(ser._data, "the mock data is defined");
-  });
-  
-  test("check that the serialize and deserialize abstract functions are defined", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockTweetSerializer(dt);
-      notEqual(ser.serialize, undefined, ".serialize is defined");
-      notEqual(ser.deserialize, undefined, ".deserialize is defined");
-  });
-  
-  test("check that the callback is called", function() {
-      var dt = new IriSP.DataLoader();
-      var ser = new IriSP.MockTweetSerializer(dt);
-      var spy = this.spy();
-      ser.sync(spy);
-      ok(spy.called, "the callback has been called");
-  });
-
-};
\ No newline at end of file
--- a/unittests/tests/playerWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/* test module for the player widget */
-
-function test_player_widget() {
-  module("player widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-    this.lay = new IriSP.LayoutManager('widget-div');
-    
-    this.config = {
-							width:650,
-							height:1,
-							mode:'radio',
-							container:'widget-div',
-							debug:true,
-							css:'../src/css/LdtPlayer.css'}					
-    },
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }
-
-  });
-  
-  test("test player initialisation", function() {  
-    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);    
-    player.draw();
-    
-    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");     
-  });
- 
-  test("test play button event handler", function() {
-    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
-
-    var spy_callback = this.spy();
-    var spy_callback2 = this.spy();
-    this.Popcorn.listen("play", spy_callback);
-    this.Popcorn.listen("pause", spy_callback2);
-    sinon.spy(player, "playHandler");
-    
-    player.draw();        
-
-    player.selector.find("#ldt-CtrlPlay").trigger("click");    
-    player.selector.find("#ldt-CtrlPlay").trigger("click");
-    ok(player.playHandler.calledTwice, "play handler called");
-    ok(spy_callback2.calledOnce, "test if pause callback has been called");                                                                    
-  });
-  
-  test("test mute button event handler", function() {
-    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
-
-    var spy_callback = this.spy();
-    var spy_handler = sinon.spy(player, "muteHandler");
-    this.Popcorn.listen("volumechange", spy_callback);    
-    
-    player.draw();
-       
-    // IriSP.jQuery("#ldt-CtrlSound").trigger("click");    
-    player.selector.find(".Ldt-Control2 button:first").next().trigger("click");    
-    ok(this.Popcorn.muted(), "the player is muted");
-    
-    player.selector.find("#ldt-CtrlSound").trigger("click");
-    ok(!this.Popcorn.muted(), "the player is un muted");         
-    ok(spy_handler.called, "handling function has been called");                                                                                                                                        
-  });
-  
-  test("test search button event handler", function() {
-  var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
-  
-  var searchTerm = "blah";
-  
-  var spy_callback = this.spy();
-  var spy_open = this.spy();
-  var spy_closed = this.spy();
-  var spy_cleared = this.spy();
-  var spy_handler = sinon.spy(player, "searchButtonHandler");
-  
-  player._Popcorn.listen("IriSP.search", spy_callback);    
-  player._Popcorn.listen("IriSP.search.open", spy_open);    
-  player._Popcorn.listen("IriSP.search.closed", spy_closed);    
-  player._Popcorn.listen("IriSP.search.cleared", spy_cleared);    
-  
-  player.draw();
-     
-  player.selector.find("#ldt-CtrlSearch").trigger("click");
-  player.selector.find("#LdtSearchInput").attr('value', searchTerm); 
-  player.selector.find("#LdtSearchInput").trigger('keyup');
-  
-  ok(spy_handler.called, "search button handling function has been called");  
-  ok(spy_open.called, "open signal has been sent");  
-  ok(spy_callback.called, "search typeahead function has been called");
-  ok(spy_callback.calledWith(searchTerm), "popcorn message sent with the right parameters");
-
-  player.selector.find("#LdtSearchInput").attr('value', ""); 
-  player.selector.find("#LdtSearchInput").trigger('keyup');
-  ok(spy_cleared.called, "clear message has been sent");
-  
-  player.selector.find("#ldt-CtrlSearch").trigger("click");
-  ok(spy_closed.called, "closed signal has been sent");  
-  
-  });
-  
-};
\ No newline at end of file
--- a/unittests/tests/polemicWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* polemicWidget.js */
-
-function test_polemic_widget() {
-  module("polemic widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockTweetSerializer(this.dt, "/url"); /* dummy serializer */
-
-    IriSP.jQuery("#widget-div").append("<div id='TooltipDiv'></div>");
-    IriSP.jQuery("#widget-div").append("<div id='PolemicDiv'></div>");
-    this.config = {
-						metadata:{
-							format:'cinelab',
-							src:'test.json',
-							load:'json'},
-							width:650,
-							height:1,
-							mode:'radio',
-							container:'PolemicDiv',
-							debug:true,
-							css:'../src/css/LdtPlayer.css',
-            requires: [{
-							type: "TooltipWidget",
-              container: "TooltipDiv",
-							width: 180,
-							heigh: 160,
-							metadata : {
-								format:'cinelab',
-								type:'empty'
-							}
-						 }]
-    }
-    },  
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }});
-  
-  test("test widget initialization", function() {
-
-    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();    
-    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has 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
--- a/unittests/tests/segmentsWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* segmentsWidget.js */
-
-function test_segments_widget() {
-  module("segments widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-            
-    this.config = {
-						metadata:{
-							format:'cinelab',
-							src:'test.json',
-							load:'json'},
-							width:650,
-							height:1,
-							mode:'radio',
-							container:'widget-div',
-							debug:true,
-							css:'../src/css/LdtPlayer.css'}
-    },  
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }});
-  
-  test("test widget initialization", function() {  
-    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-  
-    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");
-    // the + 1 is because we have a z-index div to indicate progress in the video.
-    equal(IriSP.jQuery("#widget-div").children().length, this.ser._data.annotations.length + 1, "test if children have been added correctly");
-    equal(IriSP.jQuery("#widget-div").children(":first").css("z-index"), 100, "test if slider div is created correctly.");
-    equal(IriSP.jQuery("#widget-div").css("overflow"), "auto", "test if the divs are floated correctly.");
-  });
-  
-  test("test click on a random segment", function() {
-    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
-    widget.draw();
-    
-    var spy_callback = this.spy();
-    var spy_handler = sinon.spy(widget, "clickHandler");
-    this.Popcorn.listen("timeupdate", spy_callback);    
-    
-    var selector = IriSP.jQuery("#widget-div :not(first-child)");
-    var random = Math.round(Math.random() * selector.length) + 1;
-    selector.eq(random).click();
-        
-    ok(spy_callback.called, "the currenttime was changed");         
-    ok(spy_handler.called, "handling function has been called");           
-  });
-  
-  test("test search highlight features", function() {
-  
-    var tag_id = "#s_" + "82613B88-9578-DC2C-D7D0-B2C5BE0B7BDA".toUpperCase();
-    
-    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
-    widget.draw();    
-
-    var oldStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
-    widget._Popcorn.trigger("IriSP.search", "sociologie");
-    var newStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
-    notEqual(oldStyle, newStyle, "the segment style has been modified");
-  });
-}; 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/serializers/JSONSerializer.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,140 @@
+function test_JSONSerializer() {
+  module("JSON Serializer tests", 
+    { setup: function() {      
+      this.dt = new IriSP.DataLoader();
+      }
+    }
+    );    
+    
+    test("should return the correct JSON", function() {
+      var arr = ["ab", {"de" : "fg"}, "lp"];
+      var serializer = new IriSP.JSONSerializer(this.dt);
+
+      equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct");
+    });
+    
+    test("sync()", function() {
+      this.xhr = this.sandbox.useFakeXMLHttpRequest();
+      this.requests = [];
+      this.xhr.onCreate = function (request) {
+        this.requests.push(request);
+      };
+      
+      var response_array = { media: 12, content: "Hey there", 
+                             annotations: [{"begin": "32", "end" : 64}, {"begin": "08", "end" : 27},{"begin": "02", "end" : 61}]  };
+
+      /* sorted array is our comparision array */
+      var sorted_array = IriSP.jQuery.extend({}, response_array);
+      sorted_array.annotations.sort(function(a, b) 
+          { var a_begin = +a.begin;
+            var b_begin = +b.begin;
+            return a_begin - b_begin;
+          });
+          
+      var response_string = JSON.stringify(response_array);
+  
+      var spy_callback = this.spy();
+      var ser = new IriSP.JSONSerializer(this.dt, "/url");
+      
+      ser.sync(spy_callback);
+      
+      equals(this.xhr.requests.length, 1, "the mock ajax object should have received the request");
+      equals(this.xhr.requests[0].url, "/url", "the requested url is correct");
+
+      this.xhr.requests[0].respond(200, { "Content-Type": "application/json" },
+                             response_string);
+        
+      ok(spy_callback.calledOnce, "callback called");
+      ok(spy_callback.calledWith(response_array), "callback called with correct value");
+      deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value");
+      
+      var order_preserved = true;
+      
+      var i = 0;
+      for(i = 0; i < ser._data.length - 1; i++) {
+        if (ser._data.annotations[i].begin > ser._data.annotations[i+1].begin) {
+            order_preserved = false;
+            break;
+        }
+      }
+      
+      ok(order_preserved, "the annotation sub-array is sorted by begin time");
+    });
+
+    test("currentMedia should return the current media", function() {
+      var ser = new IriSP.JSONSerializer(this.dt, "/url");
+
+      ser._data = {}
+      ser._data.medias = [0];
+      equal(ser.currentMedia(), 0, "currentMedia() returns the correct value");
+    });
+
+    test("test annotation search", function() {
+      var ser = new IriSP.JSONSerializer(this.dt, "../test/test.json");
+            
+      ser._data = { annotations : [
+      {"content": {        
+        "description": "professeur", 
+        "title": "garrigou"
+        }},
+      { "content": {        
+        "description": "interview", 
+        "title": "Revue de presse - Hervé Gardette"
+      }},
+      {"content": {        
+        "description": "concept", 
+        "title": "idée"
+      }},
+      { "content": {        
+        "description": "", 
+        "title": "sans titre"
+      }}
+      ]};
+      
+      equal(ser.searchAnnotations("GarriGOU", "", "").length, 1, "requesting on title works");
+      equal(ser.searchAnnotations("", "IntErView", "").length, 1, "requesting on description works");      
+      equal(ser.searchAnnotations("", "", "").length, 4, "empty request works");
+      equal(ser.searchAnnotations("idée", "concept", "").length, 1, "specific request works");
+      
+      
+    });
+    
+    test("test occurence count", function() {
+    var ser = new IriSP.JSONSerializer(this.dt, "../test/test.json");
+            
+      ser._data = { annotations : [
+      {"content": {        
+        "description": "professeur", 
+        "title": "garrigou"
+        }, "id" : 1 },
+      { "content": {        
+        "description": "interview", 
+        "title": "Revue de presse - Hervé Gardette"
+      }, "id" : 2},
+      {"content": {        
+        "description": "concept", 
+        "title": "idée"
+      }, "id" : 3},
+      { "content": {        
+        "description": "", 
+        "title": "sans titre"
+      }, "id" : 4}
+      ]};
+      
+      // a function to get the number of fields in a dict.
+      function countOccurences(queryString) {
+        var count = 0;
+        for (var i in ser.searchOccurences(queryString)) {
+          count++;
+        };
+        
+        return count;
+      };
+      
+      equal(countOccurences("garrigou"), 1, "first request works");
+      deepEqual(ser.searchOccurences("garrigou"), {1 : 1}, "returned object is correctly defined");
+          
+      equal(countOccurences("garrigou interview"), 2, "second request works");
+      equal(countOccurences("garrigou idée interview"), 3, "third request works");
+    });
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/serializers/mockSerializer.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,27 @@
+function test_mockSerializer() {
+  module("Mock Serializer basic tests");
+  
+  test("init the serializer with a DataLoader and an url", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockSerializer(dt, "http://google.com");
+      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
+      equal( ser._url, "http://google.com", "The url has been copied as well." );
+      ok(ser._data, "the mock data is defined");
+  });
+  
+  test("check that the serialize and deserialize abstract functions are defined", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockSerializer(dt);
+      notEqual(ser.serialize, undefined, ".serialize is defined");
+      notEqual(ser.deserialize, undefined, ".deserialize is defined");
+  });
+  
+  test("check that the callback is called", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockSerializer(dt);
+      var spy = this.spy();
+      ser.sync(spy);
+      ok(spy.called, "the callback has been called");
+  });
+
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/serializers/mockTweetSerializer.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,27 @@
+function test_mockTweetSerializer() {
+  module("Mock Tweet Serializer basic tests");
+  
+  test("init the serializer with a DataLoader and an url", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockTweetSerializer(dt, "http://google.com");
+      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
+      equal( ser._url, "http://google.com", "The url has been copied as well." );
+      ok(ser._data, "the mock data is defined");
+  });
+  
+  test("check that the serialize and deserialize abstract functions are defined", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockTweetSerializer(dt);
+      notEqual(ser.serialize, undefined, ".serialize is defined");
+      notEqual(ser.deserialize, undefined, ".deserialize is defined");
+  });
+  
+  test("check that the callback is called", function() {
+      var dt = new IriSP.DataLoader();
+      var ser = new IriSP.MockTweetSerializer(dt);
+      var spy = this.spy();
+      ser.sync(spy);
+      ok(spy.called, "the callback has been called");
+  });
+
+};
\ No newline at end of file
--- a/unittests/tests/sliderWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-function test_slider_widget() {
- module("slider widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-            
-    this.config = {
-						metadata:{
-							format:'cinelab',
-							src:'test.json',
-							load:'json'},
-							width:650,
-							height:1,
-							mode:'radio',
-							container:'widget-div',
-							debug:true,
-							css:'../src/css/LdtPlayer.css'}
-    },  
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }});
-  
-  test("test widget initialization", function() {  
-    var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-    
-    ok(IriSP.jQuery("#widget-div").children().hasClass("sliderBackground"), "test if the div has been set-up");
-    ok(IriSP.jQuery("#widget-div").children().hasClass("sliderForeground"), "test if the div has been set-up");
-  
-  });
-  
-  test("test slider seeking", function() {    
-    var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-    
-    var spy_callback = this.spy();
-    widget._Popcorn.listen("timeupdate", spy_callback);       
-    IriSP.jQuery("#widget-div").children().click();
-    ok(spy_callback.called, "handling function has been called");
-  });
-}
\ No newline at end of file
--- a/unittests/tests/tooltipWidget.js	Mon Nov 14 12:18:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* tooltipWidget.js */
-
-function test_tooltip_widget() {
-  module("tooltip widget testing", 
-  {setup : function() {    
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-    
-    this.dt = new IriSP.DataLoader();
-    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
-            
-    this.config = {
-							width: 160,
-							height:120,
-              container: "widget-div"
-						};
-    },
-    
-  teardown: function() {
-    /* free the popcorn object because it has signal handlers attached to it */
-    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
-  }
-  });
-  
-  test("test tooltip widget initialization", function() {  
-    var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-
-    equal(widget.selector.children(".tip").length, 1, "test if the div has been added correctly");
-    equal(widget.selector.children(".tip").css("position"), "fixed", "test if the widget has the correct position attr");    
-    equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
-    equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
-  });
-  
-  test("test widget display function", function() {
-    var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
-    widget.draw();
-    
-    widget.show("ceci est un texte", "#fefefe", 105, 240);
-    equal(widget.selector.children(".tip").css("left"), "105px", "test if div has been positionned correctly");
-    equal(widget.selector.children(".tip").css("top"), "240px", "test if div has been positionned correctly");    
-    equal(widget.selector.find(".tiptext").text(), "ceci est un texte", "test if text has been set correctly");
-    
-    widget.hide();
-    equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
-    equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
-  });
-}; 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/annotationsWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,44 @@
+/* annotationsWidget.js */
+
+function test_annotations_widget() {
+  module("annotations widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
+        
+    IriSP.jQuery("#widget-div").append("<div id='Ldt-Ligne'></div>");
+    
+    this.config = {
+							width:650,
+							height:1,
+							mode:'radio',
+							container:'widget-div',
+							debug:true,
+							css:'../src/css/LdtPlayer.css'};
+    },
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }
+  });
+  
+  test("test widget initialization", function() {  
+    var widget = new IriSP.AnnotationsWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+
+    equal(widget.selector.children(".Ldt-AnnotationsWidget").length, 1, "test if the div has been added correctly");
+    equal(widget.selector.children(".Ldt-AnnotationsWidget").find(".Ldt-SaKeyword").length, 1, "test if sub-div has been added correctly");
+  });
+  
+  test("test annotation display function", function() {
+    var widget = new IriSP.AnnotationsWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+    var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords"}};
+    widget.displayAnnotation(annotation);
+    equal(widget.selector.find(".Ldt-SaTitle").text(), "title", "title set correctly");
+    equal(widget.selector.find(".Ldt-SaDescription").text(), "description", "description set correctly");
+    equal(widget.selector.find(".Ldt-SaKeywordText").text(), "", "keywords field set correctly");
+  });
+}; 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/playerWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,105 @@
+/* test module for the player widget */
+
+function test_player_widget() {
+  module("player widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
+    this.lay = new IriSP.LayoutManager('widget-div');
+    
+    this.config = {
+							width:650,
+							height:1,
+							mode:'radio',
+							container:'widget-div',
+							debug:true,
+							css:'../src/css/LdtPlayer.css'}					
+    },
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }
+
+  });
+  
+  test("test player initialisation", function() {  
+    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);    
+    player.draw();
+    
+    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");     
+  });
+ 
+  test("test play button event handler", function() {
+    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
+
+    var spy_callback = this.spy();
+    var spy_callback2 = this.spy();
+    this.Popcorn.listen("play", spy_callback);
+    this.Popcorn.listen("pause", spy_callback2);
+    sinon.spy(player, "playHandler");
+    
+    player.draw();        
+
+    player.selector.find("#ldt-CtrlPlay").trigger("click");    
+    player.selector.find("#ldt-CtrlPlay").trigger("click");
+    ok(player.playHandler.calledTwice, "play handler called");
+    ok(spy_callback2.calledOnce, "test if pause callback has been called");                                                                    
+  });
+  
+  test("test mute button event handler", function() {
+    var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
+
+    var spy_callback = this.spy();
+    var spy_handler = sinon.spy(player, "muteHandler");
+    this.Popcorn.listen("volumechange", spy_callback);    
+    
+    player.draw();
+       
+    // IriSP.jQuery("#ldt-CtrlSound").trigger("click");    
+    player.selector.find(".Ldt-Control2 button:first").next().trigger("click");    
+    ok(this.Popcorn.muted(), "the player is muted");
+    
+    player.selector.find("#ldt-CtrlSound").trigger("click");
+    ok(!this.Popcorn.muted(), "the player is un muted");         
+    ok(spy_handler.called, "handling function has been called");                                                                                                                                        
+  });
+  
+  test("test search button event handler", function() {
+  var player = new IriSP.PlayerWidget(this.Popcorn, this.config, this.ser);
+  
+  var searchTerm = "blah";
+  
+  var spy_callback = this.spy();
+  var spy_open = this.spy();
+  var spy_closed = this.spy();
+  var spy_cleared = this.spy();
+  var spy_handler = sinon.spy(player, "searchButtonHandler");
+  
+  player._Popcorn.listen("IriSP.search", spy_callback);    
+  player._Popcorn.listen("IriSP.search.open", spy_open);    
+  player._Popcorn.listen("IriSP.search.closed", spy_closed);    
+  player._Popcorn.listen("IriSP.search.cleared", spy_cleared);    
+  
+  player.draw();
+     
+  player.selector.find("#ldt-CtrlSearch").trigger("click");
+  player.selector.find("#LdtSearchInput").attr('value', searchTerm); 
+  player.selector.find("#LdtSearchInput").trigger('keyup');
+  
+  ok(spy_handler.called, "search button handling function has been called");  
+  ok(spy_open.called, "open signal has been sent");  
+  ok(spy_callback.called, "search typeahead function has been called");
+  ok(spy_callback.calledWith(searchTerm), "popcorn message sent with the right parameters");
+
+  player.selector.find("#LdtSearchInput").attr('value', ""); 
+  player.selector.find("#LdtSearchInput").trigger('keyup');
+  ok(spy_cleared.called, "clear message has been sent");
+  
+  player.selector.find("#ldt-CtrlSearch").trigger("click");
+  ok(spy_closed.called, "closed signal has been sent");  
+  
+  });
+  
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/polemicWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,79 @@
+/* polemicWidget.js */
+
+function test_polemic_widget() {
+  module("polemic widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockTweetSerializer(this.dt, "/url"); /* dummy serializer */
+
+    IriSP.jQuery("#widget-div").append("<div id='TooltipDiv'></div>");
+    IriSP.jQuery("#widget-div").append("<div id='PolemicDiv'></div>");
+    this.config = {
+						metadata:{
+							format:'cinelab',
+							src:'test.json',
+							load:'json'},
+							width:650,
+							height:1,
+							mode:'radio',
+							container:'PolemicDiv',
+							debug:true,
+							css:'../src/css/LdtPlayer.css',
+            requires: [{
+							type: "TooltipWidget",
+              container: "TooltipDiv",
+							width: 180,
+							heigh: 160,
+							metadata : {
+								format:'cinelab',
+								type:'empty'
+							}
+						 }]
+    }
+    },  
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }});
+  
+  test("test widget initialization", function() {
+
+    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();    
+    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/segmentsWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,67 @@
+/* segmentsWidget.js */
+
+function test_segments_widget() {
+  module("segments widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
+            
+    this.config = {
+						metadata:{
+							format:'cinelab',
+							src:'test.json',
+							load:'json'},
+							width:650,
+							height:1,
+							mode:'radio',
+							container:'widget-div',
+							debug:true,
+							css:'../src/css/LdtPlayer.css'}
+    },  
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }});
+  
+  test("test widget initialization", function() {  
+    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+  
+    equal(IriSP.jQuery("#widget-div").length, 1, "test if the div has been added correctly");
+    // the + 1 is because we have a z-index div to indicate progress in the video.
+    equal(IriSP.jQuery("#widget-div").children().length, this.ser._data.annotations.length + 1, "test if children have been added correctly");
+    equal(IriSP.jQuery("#widget-div").children(":first").css("z-index"), 100, "test if slider div is created correctly.");
+    equal(IriSP.jQuery("#widget-div").css("overflow"), "auto", "test if the divs are floated correctly.");
+  });
+  
+  test("test click on a random segment", function() {
+    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
+    widget.draw();
+    
+    var spy_callback = this.spy();
+    var spy_handler = sinon.spy(widget, "clickHandler");
+    this.Popcorn.listen("timeupdate", spy_callback);    
+    
+    var selector = IriSP.jQuery("#widget-div :not(first-child)");
+    var random = Math.round(Math.random() * selector.length) + 1;
+    selector.eq(random).click();
+        
+    ok(spy_callback.called, "the currenttime was changed");         
+    ok(spy_handler.called, "handling function has been called");           
+  });
+  
+  test("test search highlight features", function() {
+  
+    var tag_id = "#s_" + "82613B88-9578-DC2C-D7D0-B2C5BE0B7BDA".toUpperCase();
+    
+    var widget = new IriSP.SegmentsWidget(this.Popcorn, this.config, this.ser);
+    widget.draw();    
+
+    var oldStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
+    widget._Popcorn.trigger("IriSP.search", "sociologie");
+    var newStyle = IriSP.jQuery("#widget-div").children(tag_id).attr("style");
+    notEqual(oldStyle, newStyle, "the segment style has been modified");
+  });
+}; 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/sliderWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,44 @@
+function test_slider_widget() {
+ module("slider widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
+            
+    this.config = {
+						metadata:{
+							format:'cinelab',
+							src:'test.json',
+							load:'json'},
+							width:650,
+							height:1,
+							mode:'radio',
+							container:'widget-div',
+							debug:true,
+							css:'../src/css/LdtPlayer.css'}
+    },  
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }});
+  
+  test("test widget initialization", function() {  
+    var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+    
+    ok(IriSP.jQuery("#widget-div").children().hasClass("sliderBackground"), "test if the div has been set-up");
+    ok(IriSP.jQuery("#widget-div").children().hasClass("sliderForeground"), "test if the div has been set-up");
+  
+  });
+  
+  test("test slider seeking", function() {    
+    var widget = new IriSP.SliderWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+    
+    var spy_callback = this.spy();
+    widget._Popcorn.listen("timeupdate", spy_callback);       
+    IriSP.jQuery("#widget-div").children().click();
+    ok(spy_callback.called, "handling function has been called");
+  });
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/tests/widgets/tooltipWidget.js	Mon Nov 14 12:26:17 2011 +0100
@@ -0,0 +1,47 @@
+/* tooltipWidget.js */
+
+function test_tooltip_widget() {
+  module("tooltip widget testing", 
+  {setup : function() {    
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+    
+    this.dt = new IriSP.DataLoader();
+    this.ser = new IriSP.MockSerializer(this.dt, "/url"); /* dummy serializer */
+            
+    this.config = {
+							width: 160,
+							height:120,
+              container: "widget-div"
+						};
+    },
+    
+  teardown: function() {
+    /* free the popcorn object because it has signal handlers attached to it */
+    this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4");
+  }
+  });
+  
+  test("test tooltip widget initialization", function() {  
+    var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+
+    equal(widget.selector.children(".tip").length, 1, "test if the div has been added correctly");
+    equal(widget.selector.children(".tip").css("position"), "fixed", "test if the widget has the correct position attr");    
+    equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
+    equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
+  });
+  
+  test("test widget display function", function() {
+    var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
+    widget.draw();
+    
+    widget.show("ceci est un texte", "#fefefe", 105, 240);
+    equal(widget.selector.children(".tip").css("left"), "105px", "test if div has been positionned correctly");
+    equal(widget.selector.children(".tip").css("top"), "240px", "test if div has been positionned correctly");    
+    equal(widget.selector.find(".tiptext").text(), "ceci est un texte", "test if text has been set correctly");
+    
+    widget.hide();
+    equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
+    equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
+  });
+}; 
\ No newline at end of file