24 |
24 |
25 test("test widget initialization", function() { |
25 test("test widget initialization", function() { |
26 var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
26 var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
27 widget.draw(); |
27 widget.draw(); |
28 |
28 |
29 equal(widget.selector.children(".Ldt-tweetAvatar").length, 1, "test if the div has been added correctly"); |
29 equal(widget.selector.find(".Ldt-tweetAvatar").length, 1, "test if the div has been added correctly"); |
30 equal(widget.selector.children(".Ldt-tweetContents").length, 1, "test if sub-div has been added correctly"); |
30 equal(widget.selector.find(".Ldt-tweetContents").length, 1, "test if sub-div has been added correctly"); |
31 }); |
31 }); |
32 |
32 |
33 test("test tweet display function", function() { |
33 test("test tweet display function", function() { |
|
34 // tweak the display period so that our tests don't timeout |
|
35 IriSP.widgetsDefaults.TweetsWidget.tweet_display_period = 10; |
|
36 |
34 var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
37 var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
35 widget.draw(); |
38 widget.draw(); |
36 var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords"}}; |
39 var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords", "img": {"src" : "http://yop.com"}}}; |
37 widget.displayTweet(annotation); |
40 widget.displayTweet(annotation); |
38 |
41 |
39 equal(widget.selector.find(".Ldt-tweetContents").text(), "title", "title set correctly"); |
42 equal(widget.selector.find(".Ldt-tweetContents").text(), "title", "title set correctly"); |
40 // equal(widget.selector.find(".Ldt-SaDescription").text(), "description", "description set correctly"); |
43 equal(widget.selector.find(".Ldt-tweetAvatar").children().attr("src"), "http://yop.com", "user avatar set correctly"); |
41 // equal(widget.selector.find(".Ldt-SaKeywordText").text(), "", "keywords field set correctly"); |
44 |
|
45 var annotation2 = {content: {"title": "title", "description": "description", "keywords": "keywords", "img" : {}}}; |
|
46 widget.displayTweet(annotation2); |
|
47 equal(widget.selector.find(".Ldt-tweetAvatar").children().attr("src"), |
|
48 IriSP.widgetsDefaults.TweetsWidget.default_profile_picture, "default avatar set correctly"); |
|
49 |
|
50 widget.selector.find(".Ldt-tweetWidgetMinimize").click(); |
|
51 |
|
52 ok(!widget.selector.is(":visible"), "the widget is hidden after a click"); |
|
53 }); |
|
54 |
|
55 test("test async clear", function() { |
|
56 /* |
|
57 expect(1); |
|
58 |
|
59 // tweak the display period so that our tests don't timeout |
|
60 IriSP.widgetsDefaults.TweetsWidget.tweet_display_period = 10; |
|
61 stop(); |
|
62 |
|
63 var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
|
64 widget.draw(); |
|
65 var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords", "img": {"src" : "http://yop.com"}}}; |
|
66 widget.displayTweet(annotation); |
|
67 |
|
68 |
|
69 window.setTimeout(function() { console.log("called!"); |
|
70 ok(!widget.selector.is(":visible"), "the widget is hidden after the timeout has passed."); |
|
71 start(); |
|
72 }, 100); |
|
73 */ |
42 }); |
74 }); |
43 }; |
75 }; |