unittests/tests/tooltipWidget.js
branchpopcorn-port
changeset 231 accc7358d8b5
parent 172 3ffa0e0c8803
equal deleted inserted replaced
228:53d8d95a0079 231:accc7358d8b5
    24   test("test tooltip widget initialization", function() {  
    24   test("test tooltip widget initialization", function() {  
    25     var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
    25     var widget = new IriSP.TooltipWidget(this.Popcorn, this.config, this.ser);    
    26     widget.draw();
    26     widget.draw();
    27 
    27 
    28     equal(widget.selector.children(".tip").length, 1, "test if the div has been added correctly");
    28     equal(widget.selector.children(".tip").length, 1, "test if the div has been added correctly");
       
    29     equal(widget.selector.children(".tip").css("position"), "fixed", "test if the widget has the correct position attr");    
    29     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
    30     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
    30     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
    31     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
    31   });
    32   });
    32   
    33   
    33   test("test widget display function", function() {
    34   test("test widget display function", function() {
    36     
    37     
    37     widget.show("ceci est un texte", "#fefefe", 105, 240);
    38     widget.show("ceci est un texte", "#fefefe", 105, 240);
    38     equal(widget.selector.children(".tip").css("left"), "105px", "test if div has been positionned correctly");
    39     equal(widget.selector.children(".tip").css("left"), "105px", "test if div has been positionned correctly");
    39     equal(widget.selector.children(".tip").css("top"), "240px", "test if div has been positionned correctly");    
    40     equal(widget.selector.children(".tip").css("top"), "240px", "test if div has been positionned correctly");    
    40     equal(widget.selector.find(".tiptext").text(), "ceci est un texte", "test if text has been set correctly");
    41     equal(widget.selector.find(".tiptext").text(), "ceci est un texte", "test if text has been set correctly");
    41   
    42     
    42     widget.hide();
    43     widget.hide();
    43     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
    44     equal(widget.selector.children(".tip").css("left"), "-10000px", "test if div has been positionned correctly");
    44     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
    45     equal(widget.selector.children(".tip").css("top"), "-100000px", "test if div has been positionned correctly");
    45   });
    46   });
    46 }; 
    47 };