| author | hamidouk |
| Thu, 17 Nov 2011 16:51:19 +0100 | |
| branch | tweet-widget |
| changeset 267 | f84013fb19dc |
| child 283 | 39e6707ca72b |
| permissions | -rw-r--r-- |
|
267
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
1 |
/* tweetsWidget.js */ |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
2 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
3 |
function test_tweets_widget() { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
4 |
module("tweet widget testing", |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
5 |
{setup : function() { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
6 |
this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
7 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
8 |
this.dt = new IriSP.DataLoader(); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
9 |
this.ser = new IriSP.MockTweetSerializer(this.dt, "/url"); /* dummy serializer */ |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
10 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
11 |
this.config = { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
12 |
width:650, |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
13 |
height:1, |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
14 |
mode:'radio', |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
15 |
container:'widget-div', |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
16 |
debug:true, |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
17 |
css:'../src/css/LdtPlayer.css'}; |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
18 |
}, |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
19 |
teardown: function() { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
20 |
/* free the popcorn object because it has signal handlers attached to it */ |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
21 |
this.Popcorn = Popcorn.youtube("#popcorn-div", "http://www.youtube.com/watch?v=QH2-TGUlwu4"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
22 |
} |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
23 |
}); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
24 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
25 |
test("test widget initialization", function() { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
26 |
var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
27 |
widget.draw(); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
28 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
29 |
equal(widget.selector.children(".Ldt-tweetAvatar").length, 1, "test if the div has been added correctly"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
30 |
equal(widget.selector.children(".Ldt-tweetContents").length, 1, "test if sub-div has been added correctly"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
31 |
}); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
32 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
33 |
test("test tweet display function", function() { |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
34 |
var widget = new IriSP.TweetsWidget(this.Popcorn, this.config, this.ser); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
35 |
widget.draw(); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
36 |
var annotation = {content: {"title": "title", "description": "description", "keywords": "keywords"}}; |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
37 |
widget.displayTweet(annotation); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
38 |
|
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
39 |
equal(widget.selector.find(".Ldt-tweetContents").text(), "title", "title set correctly"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
40 |
// equal(widget.selector.find(".Ldt-SaDescription").text(), "description", "description set correctly"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
41 |
// equal(widget.selector.find(".Ldt-SaKeywordText").text(), "", "keywords field set correctly"); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
42 |
}); |
|
f84013fb19dc
added a new widget, to display the contents of tweets in a separate pane.
hamidouk
parents:
diff
changeset
|
43 |
}; |