public
Description: GitHub Blog Badges for Everyone
Clone URL: git://github.com/drnic/github-badges.git
Search Repo:
moved GITHUB_XXX config tests into alt_config_badge
drnic (author)
Tue May 06 17:52:04 -0700 2008
commit  26f36d2d136a15b649c947efd3dca67ef0d9f569
tree    59353d911502a9f9ad578e8a9e9941493beadfbb
parent  d70732273dd7d6b06fe222c644df69442056b6f6
...
84
85
86
87
 
88
89
90
...
84
85
86
 
87
88
89
90
0
@@ -84,7 +84,7 @@ GitHubBadge.requestUserInfo = function(username) {
0
   $.fn.buildHeader = function(title, username) {
0
     var head = ("GITHUB_HEAD" in window) ? GITHUB_HEAD : "div";
0
     var template = $.template(
0
- "<" + head + " class='header'>${title} <span>("
0
+ "<" + head + " class='header'><span class='title'>${title}</span> <span>("
0
       + "<a href='http://github.com/${username}'>${username}</a>)"
0
       + "</span></" + head + ">")
0
     return this.append(template, { title: title, username: username });
...
5
6
7
8
9
10
11
12
13
14
...
35
36
37
 
 
38
39
40
...
44
45
46
47
48
49
50
51
52
53
 
 
 
 
54
55
56
57
 
 
 
 
 
 
 
58
59
60
...
5
6
7
 
 
8
 
9
10
11
...
32
33
34
35
36
37
38
39
...
43
44
45
 
46
47
48
49
 
 
50
51
52
53
54
55
56
 
57
58
59
60
61
62
63
64
65
66
0
@@ -5,10 +5,7 @@
0
   <title>JavaScript unit test file</title>
0
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
0
   <script src="../assets/jsunittest.js" type="text/javascript"></script>
0
- <script src="../../src/ext/jquery.js"></script>
0
- <script src="../../src/ext/jquery.template.js"></script>
0
   
0
- <link rel="stylesheet" href="../../src/ext/stylesheets/badge.css" type="text/css" media="screen" title="no title" charset="utf-8">
0
   <link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
0
 </head>
0
 <body>
0
@@ -35,6 +32,8 @@
0
     <script type="text/javascript" charset="utf-8">
0
       GITHUB_USERNAME="drnic";
0
       GITHUB_HEAD="h2";
0
+ GITHUB_TITLE = "Open Source Projects";
0
+ GITHUB_SHOW_ALL = 'More';
0
     </script>
0
     <script src="../../dist/github-badge-launcher.js" type="text/javascript"></script>
0
   </div>
0
@@ -44,17 +43,24 @@
0
 // <![CDATA[
0
   new Test.Unit.Runner({
0
     setup: function() {
0
- GitHubBadge.buildUserBadge("drnic");
0
       this.badge = $('div#github-badge');
0
     },
0
     
0
     "test that header displayed": function() { with(this) {
0
- assertEqual(1, badge.find('h2.header').size());
0
- username_link = badge.find('h2.header a');
0
+ var header = badge.find('h2.header');
0
+ assertEqual(1, header.size());
0
+ assertEqual('Open Source Projects', header.find('span.title').html());
0
+ username_link = header.find('a');
0
       assertEqual("drnic", username_link.html());
0
       assertEqual("http://github.com/drnic", username_link.attr('href'));
0
     }},
0
- }, {testLog: "testlog"});
0
+
0
+ "test that 'Show more' link includes total project count": function() { with(this) {
0
+ assertEqual(1, badge.find('.more').size(), 'Missing "More" link');
0
+ assertMatch(/More \(\d+\)/, badge.find('.more').html());
0
+ }}
0
+
0
+ });
0
 // ]]>
0
 </script>
0
 </body>
...
25
26
27
28
29
30
31
32
...
25
26
27
 
 
28
29
30
0
@@ -25,8 +25,6 @@
0
   <script type="text/javascript" charset="utf-8">
0
     GITHUB_USERNAME = 'drnic';
0
     GITHUB_LIST_LENGTH = 5;
0
- GITHUB_TITLE = "Open Source Projects";
0
- GITHUB_SHOW_ALL = 'More';
0
   </script>
0
   <!-- Put sample/test html here -->
0
   <div id="sample">
...
49
50
51
52
53
 
 
 
 
54
55
56
...
101
102
103
104
105
 
 
106
107
108
...
49
50
51
 
 
52
53
54
55
56
57
58
...
103
104
105
 
 
106
107
108
109
110
0
@@ -49,8 +49,10 @@
0
     },
0
     
0
     "test that header displayed": function() { with(this) {
0
- assertEqual(1, badge.find('.header').size());
0
- username_link = badge.find('.header a');
0
+ var header = badge.find('.header');
0
+ assertEqual(1, header.size());
0
+ assertEqual('My projects', header.find('span.title').html());
0
+ username_link = header.find('a');
0
       assertEqual("drnic", username_link.html());
0
       assertEqual("http://github.com/drnic", username_link.attr('href'));
0
     }},
0
@@ -101,8 +103,8 @@
0
     }},
0
     
0
     "test that 'Show more' link includes total project count": function() { with(this) {
0
- assertEqual(1, $('.more').size(), 'Missing "Show all" link');
0
- assertEqual('Show all (32)', $('.more').html());
0
+ assertEqual(1, badge.find('.more').size(), 'Missing "Show all" link');
0
+ assertEqual('Show all (32)', badge.find('.more').html());
0
     }},
0
 
0
     

Comments

    No one has commented yet.