Skip to content
Browse files

added some tests to cover more code

  • Loading branch information...
1 parent b0778a1 commit ce3a04935b247de7868d731b3c1f8911ab17f684 @devdazed devdazed committed Jan 12, 2012
Showing with 183 additions and 91 deletions.
  1. +77 −69 test/coverage/column_family.html
  2. +7 −7 test/coverage/index.html
  3. +53 −0 test/coverage/jquery.isonscreen.js
  4. +16 −3 test/helpers/thrift.json
  5. +30 −12 test/thrift.js
View
146 test/coverage/column_family.html
@@ -5,7 +5,7 @@
<meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
- <title>Coverage for column_family.js: 86.67%</title>
+ <title>Coverage for column_family.js: 97.78%</title>
<link rel='stylesheet' href='style.css' type='text/css'>
<script type='text/javascript' src='jquery-1.4.3.min.js'></script>
<script type='text/javascript' src='jquery.hotkeys.js'></script>
@@ -20,13 +20,13 @@
<div id='header'>
<div class='content'>
<h1>Coverage for <b>column_family.js</b> :
- <span class='pc_cov'>86.67%</span>
+ <span class='pc_cov'>97.78%</span>
</h1>
<img id='keyboard_icon' src='keybd_closed.png'>
<h2 class='stats'>
statements
- <span class=' shortkey_r' onclick='coverage.toggle_lines(this, "run")'>39 hits</span>
- <span class=' shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>6 missing</span>
+ <span class=' shortkey_r' onclick='coverage.toggle_lines(this, "run")'>44 hits</span>
+ <span class=' shortkey_m' onclick='coverage.toggle_lines(this, "mis")'>1 missing</span>
<span class=' shortkey_x' onclick='coverage.toggle_lines(this, "exc")'>45 lines</span>
</h2>
</div>
@@ -212,7 +212,7 @@ <h2 class='stats'>
<p id='n77' class='stm run'><a href='#n77'>77</a></p>
- <p id='n78' class='stm mis'><a href='#n78'>78</a></p>
+ <p id='n78' class='stm run'><a href='#n78'>78</a></p>
<p id='n79' class='pln'><a href='#n79'>79</a></p>
@@ -270,41 +270,41 @@ <h2 class='stats'>
<p id='n106' class='pln'><a href='#n106'>106</a></p>
- <p id='n107' class='stm run'><a href='#n107'>107</a></p>
+ <p id='n107' class='pln'><a href='#n107'>107</a></p>
- <p id='n108' class='stm run'><a href='#n108'>108</a></p>
+ <p id='n108' class='pln'><a href='#n108'>108</a></p>
- <p id='n109' class='stm mis'><a href='#n109'>109</a></p>
+ <p id='n109' class='stm run'><a href='#n109'>109</a></p>
- <p id='n110' class='stm mis'><a href='#n110'>110</a></p>
+ <p id='n110' class='stm run'><a href='#n110'>110</a></p>
- <p id='n111' class='pln'><a href='#n111'>111</a></p>
+ <p id='n111' class='stm run'><a href='#n111'>111</a></p>
- <p id='n112' class='pln'><a href='#n112'>112</a></p>
+ <p id='n112' class='stm run'><a href='#n112'>112</a></p>
- <p id='n113' class='stm run'><a href='#n113'>113</a></p>
+ <p id='n113' class='pln'><a href='#n113'>113</a></p>
<p id='n114' class='pln'><a href='#n114'>114</a></p>
<p id='n115' class='stm run'><a href='#n115'>115</a></p>
<p id='n116' class='pln'><a href='#n116'>116</a></p>
- <p id='n117' class='pln'><a href='#n117'>117</a></p>
+ <p id='n117' class='stm run'><a href='#n117'>117</a></p>
- <p id='n118' class='stm run'><a href='#n118'>118</a></p>
+ <p id='n118' class='pln'><a href='#n118'>118</a></p>
<p id='n119' class='pln'><a href='#n119'>119</a></p>
- <p id='n120' class='pln'><a href='#n120'>120</a></p>
+ <p id='n120' class='stm run'><a href='#n120'>120</a></p>
<p id='n121' class='pln'><a href='#n121'>121</a></p>
- <p id='n122' class='stm run'><a href='#n122'>122</a></p>
+ <p id='n122' class='pln'><a href='#n122'>122</a></p>
<p id='n123' class='pln'><a href='#n123'>123</a></p>
- <p id='n124' class='pln'><a href='#n124'>124</a></p>
+ <p id='n124' class='stm run'><a href='#n124'>124</a></p>
<p id='n125' class='pln'><a href='#n125'>125</a></p>
@@ -318,29 +318,33 @@ <h2 class='stats'>
<p id='n130' class='pln'><a href='#n130'>130</a></p>
- <p id='n131' class='stm run'><a href='#n131'>131</a></p>
+ <p id='n131' class='pln'><a href='#n131'>131</a></p>
- <p id='n132' class='stm run'><a href='#n132'>132</a></p>
+ <p id='n132' class='pln'><a href='#n132'>132</a></p>
- <p id='n133' class='stm mis'><a href='#n133'>133</a></p>
+ <p id='n133' class='stm run'><a href='#n133'>133</a></p>
- <p id='n134' class='stm mis'><a href='#n134'>134</a></p>
+ <p id='n134' class='stm run'><a href='#n134'>134</a></p>
- <p id='n135' class='pln'><a href='#n135'>135</a></p>
+ <p id='n135' class='stm run'><a href='#n135'>135</a></p>
- <p id='n136' class='pln'><a href='#n136'>136</a></p>
+ <p id='n136' class='stm run'><a href='#n136'>136</a></p>
- <p id='n137' class='stm run'><a href='#n137'>137</a></p>
+ <p id='n137' class='pln'><a href='#n137'>137</a></p>
<p id='n138' class='pln'><a href='#n138'>138</a></p>
<p id='n139' class='stm run'><a href='#n139'>139</a></p>
<p id='n140' class='pln'><a href='#n140'>140</a></p>
- <p id='n141' class='pln'><a href='#n141'>141</a></p>
+ <p id='n141' class='stm run'><a href='#n141'>141</a></p>
- <p id='n142' class='stm run'><a href='#n142'>142</a></p>
+ <p id='n142' class='pln'><a href='#n142'>142</a></p>
+
+ <p id='n143' class='pln'><a href='#n143'>143</a></p>
+
+ <p id='n144' class='stm run'><a href='#n144'>144</a></p>
</td>
<td class='text' valign='top'>
@@ -499,7 +503,7 @@ <h2 class='stats'>
<p id='t77' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(value&nbsp;===&nbsp;null&nbsp;||&nbsp;value&nbsp;===&nbsp;undefined){<span class='strut'>&nbsp;</span></p>
- <p id='t78' class='stm mis'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;=&nbsp;'';<span class='strut'>&nbsp;</span></p>
+ <p id='t78' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;=&nbsp;'';<span class='strut'>&nbsp;</span></p>
<p id='t79' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
@@ -543,91 +547,95 @@ <h2 class='stats'>
<p id='t99' class='pln'>&nbsp;*&nbsp;@param&nbsp;{String}&nbsp;key&nbsp;The&nbsp;key&nbsp;to&nbsp;get<span class='strut'>&nbsp;</span></p>
- <p id='t100' class='pln'>&nbsp;*&nbsp;@param&nbsp;{Object}&nbsp;options&nbsp;Options&nbsp;for&nbsp;the&nbsp;get,&nbsp;can&nbsp;have&nbsp;start,&nbsp;end,&nbsp;max,&nbsp;consistencyLevel&nbsp;&lt;br&nbsp;/&gt;<span class='strut'>&nbsp;</span></p>
+ <p id='t100' class='pln'>&nbsp;*&nbsp;@param&nbsp;{Object}&nbsp;options&nbsp;Options&nbsp;for&nbsp;the&nbsp;get,&nbsp;can&nbsp;have&nbsp;start,&nbsp;end,&nbsp;max,&nbsp;consistencyLevel<span class='strut'>&nbsp;</span></p>
- <p id='t101' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;start&nbsp;is&nbsp;the&nbsp;from&nbsp;part&nbsp;of&nbsp;the&nbsp;column&nbsp;name&nbsp;&lt;br&nbsp;/&gt;<span class='strut'>&nbsp;</span></p>
+ <p id='t101' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&lt;ul&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t102' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;end&nbsp;is&nbsp;the&nbsp;to&nbsp;part&nbsp;of&nbsp;the&nbsp;column&nbsp;name&nbsp;&lt;br&nbsp;/&gt;<span class='strut'>&nbsp;</span></p>
+ <p id='t102' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;start:&nbsp;the&nbsp;from&nbsp;part&nbsp;of&nbsp;the&nbsp;column&nbsp;name&lt;/li&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t103' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;max&nbsp;is&nbsp;the&nbsp;max&nbsp;amount&nbsp;of&nbsp;columns&nbsp;to&nbsp;return&nbsp;&lt;br&nbsp;/&gt;<span class='strut'>&nbsp;</span></p>
+ <p id='t103' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;end:&nbsp;the&nbsp;to&nbsp;part&nbsp;of&nbsp;the&nbsp;column&nbsp;name&lt;/li&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t104' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;consistencyLevel&nbsp;is&nbsp;the&nbsp;read&nbsp;consistency&nbsp;level<span class='strut'>&nbsp;</span></p>
+ <p id='t104' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;max:&nbsp;the&nbsp;max&nbsp;amount&nbsp;of&nbsp;columns&nbsp;to&nbsp;return&lt;/li&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t105' class='pln'>&nbsp;*&nbsp;@param&nbsp;{Function}&nbsp;callback&nbsp;The&nbsp;callback&nbsp;to&nbsp;invoke&nbsp;once&nbsp;the&nbsp;response&nbsp;has&nbsp;been&nbsp;received<span class='strut'>&nbsp;</span></p>
+ <p id='t105' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;consistencyLevel:&nbsp;the&nbsp;read&nbsp;consistency&nbsp;level&lt;/li&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t106' class='pln'>&nbsp;*/<span class='strut'>&nbsp;</span></p>
+ <p id='t106' class='pln'>&nbsp;*&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<span class='strut'>&nbsp;</span></p>
- <p id='t107' class='stm run'>ColumnFamily.prototype.get&nbsp;=&nbsp;function(key,&nbsp;options,&nbsp;callback){<span class='strut'>&nbsp;</span></p>
+ <p id='t107' class='pln'>&nbsp;*&nbsp;@param&nbsp;{Function}&nbsp;callback&nbsp;The&nbsp;callback&nbsp;to&nbsp;invoke&nbsp;once&nbsp;the&nbsp;response&nbsp;has&nbsp;been&nbsp;received<span class='strut'>&nbsp;</span></p>
- <p id='t108' class='stm run'>&nbsp;&nbsp;if&nbsp;(typeof&nbsp;options&nbsp;===&nbsp;'function'){<span class='strut'>&nbsp;</span></p>
+ <p id='t108' class='pln'>&nbsp;*/<span class='strut'>&nbsp;</span></p>
- <p id='t109' class='stm mis'>&nbsp;&nbsp;&nbsp;&nbsp;callback&nbsp;=&nbsp;options;<span class='strut'>&nbsp;</span></p>
+ <p id='t109' class='stm run'>ColumnFamily.prototype.get&nbsp;=&nbsp;function(key,&nbsp;options,&nbsp;callback){<span class='strut'>&nbsp;</span></p>
- <p id='t110' class='stm mis'>&nbsp;&nbsp;&nbsp;&nbsp;options&nbsp;=&nbsp;undefined;<span class='strut'>&nbsp;</span></p>
+ <p id='t110' class='stm run'>&nbsp;&nbsp;if&nbsp;(typeof&nbsp;options&nbsp;===&nbsp;'function'){<span class='strut'>&nbsp;</span></p>
- <p id='t111' class='pln'>&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
+ <p id='t111' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;callback&nbsp;=&nbsp;options;<span class='strut'>&nbsp;</span></p>
- <p id='t112' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t112' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;options&nbsp;=&nbsp;{};<span class='strut'>&nbsp;</span></p>
- <p id='t113' class='stm run'>&nbsp;&nbsp;callback&nbsp;=&nbsp;callback&nbsp;||&nbsp;NOOP;<span class='strut'>&nbsp;</span></p>
+ <p id='t113' class='pln'>&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
<p id='t114' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t115' class='stm run'>&nbsp;&nbsp;var&nbsp;consistency&nbsp;=&nbsp;options.consistencyLevel&nbsp;||&nbsp;DEFAULT_READ_CONSISTENCY,<span class='strut'>&nbsp;</span></p>
+ <p id='t115' class='stm run'>&nbsp;&nbsp;callback&nbsp;=&nbsp;callback&nbsp;||&nbsp;NOOP;<span class='strut'>&nbsp;</span></p>
+
+ <p id='t116' class='pln'><span class='strut'>&nbsp;</span></p>
+
+ <p id='t117' class='stm run'>&nbsp;&nbsp;var&nbsp;consistency&nbsp;=&nbsp;options.consistencyLevel&nbsp;||&nbsp;DEFAULT_READ_CONSISTENCY,<span class='strut'>&nbsp;</span></p>
- <p id='t116' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self&nbsp;=&nbsp;this,&nbsp;predicate,&nbsp;parent;<span class='strut'>&nbsp;</span></p>
+ <p id='t118' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self&nbsp;=&nbsp;this,&nbsp;predicate,&nbsp;parent;<span class='strut'>&nbsp;</span></p>
- <p id='t117' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t119' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t118' class='stm run'>&nbsp;&nbsp;parent&nbsp;=&nbsp;new&nbsp;ttype.ColumnParent({<span class='strut'>&nbsp;</span></p>
+ <p id='t120' class='stm run'>&nbsp;&nbsp;parent&nbsp;=&nbsp;new&nbsp;ttype.ColumnParent({<span class='strut'>&nbsp;</span></p>
- <p id='t119' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;column_family:&nbsp;this.name<span class='strut'>&nbsp;</span></p>
+ <p id='t121' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;column_family:&nbsp;this.name<span class='strut'>&nbsp;</span></p>
- <p id='t120' class='pln'>&nbsp;&nbsp;});<span class='strut'>&nbsp;</span></p>
+ <p id='t122' class='pln'>&nbsp;&nbsp;});<span class='strut'>&nbsp;</span></p>
- <p id='t121' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t123' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t122' class='stm run'>&nbsp;&nbsp;predicate&nbsp;=&nbsp;new&nbsp;ttype.SlicePredicate({<span class='strut'>&nbsp;</span></p>
+ <p id='t124' class='stm run'>&nbsp;&nbsp;predicate&nbsp;=&nbsp;new&nbsp;ttype.SlicePredicate({<span class='strut'>&nbsp;</span></p>
- <p id='t123' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;slice_range:&nbsp;new&nbsp;ttype.SliceRange({<span class='strut'>&nbsp;</span></p>
+ <p id='t125' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;slice_range:&nbsp;new&nbsp;ttype.SliceRange({<span class='strut'>&nbsp;</span></p>
- <p id='t124' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start:options.start,<span class='strut'>&nbsp;</span></p>
+ <p id='t126' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start:options.start,<span class='strut'>&nbsp;</span></p>
- <p id='t125' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finish:options.finish,<span class='strut'>&nbsp;</span></p>
+ <p id='t127' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finish:options.end,<span class='strut'>&nbsp;</span></p>
- <p id='t126' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reversed:options.reversed,<span class='strut'>&nbsp;</span></p>
+ <p id='t128' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reversed:options.reversed,<span class='strut'>&nbsp;</span></p>
- <p id='t127' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count:options.max<span class='strut'>&nbsp;</span></p>
+ <p id='t129' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count:options.max<span class='strut'>&nbsp;</span></p>
- <p id='t128' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;})<span class='strut'>&nbsp;</span></p>
+ <p id='t130' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;})<span class='strut'>&nbsp;</span></p>
- <p id='t129' class='pln'>&nbsp;&nbsp;});<span class='strut'>&nbsp;</span></p>
+ <p id='t131' class='pln'>&nbsp;&nbsp;});<span class='strut'>&nbsp;</span></p>
- <p id='t130' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t132' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t131' class='stm run'>&nbsp;&nbsp;function&nbsp;onComplete(err,&nbsp;val){<span class='strut'>&nbsp;</span></p>
+ <p id='t133' class='stm run'>&nbsp;&nbsp;function&nbsp;onComplete(err,&nbsp;val){<span class='strut'>&nbsp;</span></p>
- <p id='t132' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;if(err){<span class='strut'>&nbsp;</span></p>
+ <p id='t134' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;if(err){<span class='strut'>&nbsp;</span></p>
- <p id='t133' class='stm mis'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;callback(err);<span class='strut'>&nbsp;</span></p>
+ <p id='t135' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;callback(err);<span class='strut'>&nbsp;</span></p>
- <p id='t134' class='stm mis'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<span class='strut'>&nbsp;</span></p>
+ <p id='t136' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<span class='strut'>&nbsp;</span></p>
- <p id='t135' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
+ <p id='t137' class='pln'>&nbsp;&nbsp;&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
- <p id='t136' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t138' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t137' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;callback(null,&nbsp;Row.fromThrift(key,&nbsp;val,&nbsp;self));<span class='strut'>&nbsp;</span></p>
+ <p id='t139' class='stm run'>&nbsp;&nbsp;&nbsp;&nbsp;callback(null,&nbsp;Row.fromThrift(key,&nbsp;val,&nbsp;self));<span class='strut'>&nbsp;</span></p>
- <p id='t138' class='pln'>&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
+ <p id='t140' class='pln'>&nbsp;&nbsp;}<span class='strut'>&nbsp;</span></p>
- <p id='t139' class='stm run'>&nbsp;&nbsp;this.connection.execute('get_slice',&nbsp;key,&nbsp;parent,&nbsp;predicate,&nbsp;consistency,&nbsp;onComplete);<span class='strut'>&nbsp;</span></p>
+ <p id='t141' class='stm run'>&nbsp;&nbsp;this.connection.execute('get_slice',&nbsp;key,&nbsp;parent,&nbsp;predicate,&nbsp;consistency,&nbsp;onComplete);<span class='strut'>&nbsp;</span></p>
- <p id='t140' class='pln'>};<span class='strut'>&nbsp;</span></p>
+ <p id='t142' class='pln'>};<span class='strut'>&nbsp;</span></p>
- <p id='t141' class='pln'><span class='strut'>&nbsp;</span></p>
+ <p id='t143' class='pln'><span class='strut'>&nbsp;</span></p>
- <p id='t142' class='stm run'>module.exports&nbsp;=&nbsp;ColumnFamily;<span class='strut'>&nbsp;</span></p>
+ <p id='t144' class='stm run'>module.exports&nbsp;=&nbsp;ColumnFamily;<span class='strut'>&nbsp;</span></p>
</td>
</tr>
View
14 test/coverage/index.html
@@ -17,7 +17,7 @@
<div id='header'>
<div class='content'>
<h1>Coverage report:
- <span class='pc_cov'>69.58%</span>
+ <span class='pc_cov'>70.49%</span>
</h1>
<img id='keyboard_icon' src='keybd_closed.png'>
</div>
@@ -53,10 +53,10 @@
<tfoot>
<tr class='total'>
<td class='name left'>Total</td>
- <td>382</td>
- <td>167</td>
+ <td>387</td>
+ <td>162</td>
- <td class='right'>69.58%</td>
+ <td class='right'>70.49%</td>
</tr>
</tfoot>
<tbody>
@@ -135,10 +135,10 @@
<tr class='file'>
<td class='name left'><a href='column_family.html'>column_family.js</a></td>
- <td>39</td>
- <td>6</td>
+ <td>44</td>
+ <td>1</td>
- <td class='right'>86.67%</td>
+ <td class='right'>97.78%</td>
</tr>
</tbody>
View
53 test/coverage/jquery.isonscreen.js
@@ -0,0 +1,53 @@
+/* Copyright (c) 2010
+ * @author Laurence Wheway
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * @version 1.2.0
+ */
+(function($) {
+ jQuery.extend({
+ isOnScreen: function(box, container) {
+ //ensure numbers come in as intgers (not strings) and remove 'px' is it's there
+ for(var i in box){box[i] = parseFloat(box[i])};
+ for(var i in container){container[i] = parseFloat(container[i])};
+
+ if(!container){
+ container = {
+ left: $(window).scrollLeft(),
+ top: $(window).scrollTop(),
+ width: $(window).width(),
+ height: $(window).height()
+ }
+ }
+
+ if( box.left+box.width-container.left > 0 &&
+ box.left < container.width+container.left &&
+ box.top+box.height-container.top > 0 &&
+ box.top < container.height+container.top
+ ) return true;
+ return false;
+ }
+ })
+
+
+ jQuery.fn.isOnScreen = function (container) {
+ for(var i in container){container[i] = parseFloat(container[i])};
+
+ if(!container){
+ container = {
+ left: $(window).scrollLeft(),
+ top: $(window).scrollTop(),
+ width: $(window).width(),
+ height: $(window).height()
+ }
+ }
+
+ if( $(this).offset().left+$(this).width()-container.left > 0 &&
+ $(this).offset().left < container.width+container.left &&
+ $(this).offset().top+$(this).height()-container.top > 0 &&
+ $(this).offset().top < container.height+container.top
+ ) return true;
+ return false;
+ }
+})(jQuery);
View
19 test/helpers/thrift.json
@@ -8,8 +8,21 @@
},
"standard_row_key" : "standard_row_1",
"standard_insert_values" : {
- "one" : "a",
- "two" : "b",
- "three" : "c"
+ "one" : "a",
+ "two" : "b",
+ "three" : "c",
+ "four" : null
+ },
+ "standard_get_options" : {
+ "start" : "s",
+ "end" : "a",
+ "max" : 1,
+ "reversed" : true
+ },
+ "standard_get_options_error" : {
+ "start" : "a",
+ "end" : "z",
+ "max" : 1,
+ "reversed" : true
}
}
View
42 test/thrift.js
@@ -2,7 +2,7 @@ var config = require('./helpers/thrift'),
system = require('./helpers/connection'),
Helenus, conn, ks, cf_standard;
-var ConnectionPoolTest = {
+module.exports = {
'setUp':function(test, assert){
Helenus = require('helenus');
conn = new Helenus.ConnectionPool(system);
@@ -56,23 +56,42 @@ var ConnectionPoolTest = {
});
},
- 'test standard cf.get':function(test, assert){
- var columns = Object.keys(config.standard_insert_values),
- i = 0, len = columns.length;
-
- cf_standard.get(config.standard_row_key, 'one', function(err, row){
+ 'test standard cf.get':function(test, assert){
+ cf_standard.get(config.standard_row_key, function(err, row){
assert.ifError(err);
assert.ok(row instanceof Helenus.Row);
- assert.ok(row.count === len);
+ assert.ok(row.count === 4);
assert.ok(row.key === config.standard_row_key);
- for(; i < len; i += 1){
- assert.ok( row.get(columns[i]).value === config.standard_insert_values[columns[i]] );
- }
+ assert.ok(row.get('one').value === 'a');
+ assert.ok(row.get('two').value === 'b');
+ assert.ok(row.get('three').value === 'c');
+ assert.ok(row.get('four').value === '');
test.finish();
});
},
+ 'test standard cf.get with options':function(test, assert){
+ cf_standard.get(config.standard_row_key, config.standard_get_options, function(err, row){
+ assert.ifError(err);
+ assert.ok(row instanceof Helenus.Row);
+ assert.ok(row.count === 1);
+ assert.ok(row.key === config.standard_row_key);
+ assert.ok(row.get('one').value === 'a');
+
+ test.finish();
+ });
+ },
+
+ 'test standard cf.get with error':function(test, assert){
+ cf_standard.get(config.standard_row_key, config.standard_get_options_error, function(err, row){
+ assert.ok(err instanceof Error);
+ assert.ok(err.name === 'HelenusInvalidRequestException');
+ assert.ok(err.message === 'range finish must come after start in the order of traversal');
+ test.finish();
+ });
+ },
+
'test keyspace.dropColumnFamily':function(test, assert){
ks.dropColumnFamily(config.cf_standard, function(err){
assert.ifError(err);
@@ -95,5 +114,4 @@ var ConnectionPoolTest = {
'tearDown':function(test, assert){
test.finish();
}
-};
-module.exports = ConnectionPoolTest;
+};

0 comments on commit ce3a049

Please sign in to comment.
Something went wrong with that request. Please try again.