more tests.
--- a/unittests/index.html Fri Nov 18 17:45:45 2011 +0100
+++ b/unittests/index.html Fri Nov 18 17:45:52 2011 +0100
@@ -46,7 +46,8 @@
$(document).ready(function(){
/* only for unit-testing ! */
IriSP.jQuery = jQuery;
-
+ jQuery.fx.off = true;
+
test_dataloader();
test_serializer();
test_mockSerializer();
--- a/unittests/tests/widgets/tweetsWidget.js Fri Nov 18 17:45:45 2011 +0100
+++ b/unittests/tests/widgets/tweetsWidget.js Fri Nov 18 17:45:52 2011 +0100
@@ -26,18 +26,50 @@
var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser);
widget.draw();
- equal(widget.selector.children(".Ldt-tweetAvatar").length, 1, "test if the div has been added correctly");
- equal(widget.selector.children(".Ldt-tweetContents").length, 1, "test if sub-div has been added correctly");
+ equal(widget.selector.find(".Ldt-tweetAvatar").length, 1, "test if the div has been added correctly");
+ equal(widget.selector.find(".Ldt-tweetContents").length, 1, "test if sub-div has been added correctly");
});
- test("test tweet display function", function() {
+ test("test tweet display function", function() {
+ // tweak the display period so that our tests don't timeout
+ IriSP.widgetsDefaults.TweetsWidget.tweet_display_period = 10;
+
var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser);
widget.draw();
- var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords"}};
+ var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords", "img": {"src" : "http://yop.com"}}};
widget.displayTweet(annotation);
- equal(widget.selector.find(".Ldt-tweetContents").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");
+ equal(widget.selector.find(".Ldt-tweetContents").text(), "title", "title set correctly");
+ equal(widget.selector.find(".Ldt-tweetAvatar").children().attr("src"), "http://yop.com", "user avatar set correctly");
+
+ var annotation2 = {content: {"title": "title", "description": "description", "keywords": "keywords", "img" : {}}};
+ widget.displayTweet(annotation2);
+ equal(widget.selector.find(".Ldt-tweetAvatar").children().attr("src"),
+ IriSP.widgetsDefaults.TweetsWidget.default_profile_picture, "default avatar set correctly");
+
+ widget.selector.find(".Ldt-tweetWidgetMinimize").click();
+
+ ok(!widget.selector.is(":visible"), "the widget is hidden after a click");
+ });
+
+ test("test async clear", function() {
+ /*
+ expect(1);
+
+ // tweak the display period so that our tests don't timeout
+ IriSP.widgetsDefaults.TweetsWidget.tweet_display_period = 10;
+ stop();
+
+ var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser);
+ widget.draw();
+ var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords", "img": {"src" : "http://yop.com"}}};
+ widget.displayTweet(annotation);
+
+
+ window.setTimeout(function() { console.log("called!");
+ ok(!widget.selector.is(":visible"), "the widget is hidden after the timeout has passed.");
+ start();
+ }, 100);
+ */
});
};
\ No newline at end of file