How to use eq method in Jest

Best JavaScript code snippet using jest

tabs_core.js

Source:tabs_core.js Github

copy

Full Screen

...45 equal( anchor.prop( "hash" ).substring( 1 ), tab.attr( "aria-controls" ) );46 });47 element = $( "#tabs2" ).tabs();48 tabs = element.find( ".ui-tabs-nav li" );49 equal( tabs.eq( 0 ).attr( "aria-controls" ), "colon:test" );50 equal( tabs.eq( 1 ).attr( "aria-controls" ), "inline-style" );51 ok( /^ui-tabs-\d+$/.test( tabs.eq( 2 ).attr( "aria-controls" ) ), "generated id" );52 equal( tabs.eq( 3 ).attr( "aria-controls" ), "custom-id" );53});54test( "accessibility", function() {55 expect( 49 );56 var element = $( "#tabs1" ).tabs({57 active: 1,58 disabled: [ 2 ]59 }),60 tabs = element.find( ".ui-tabs-nav li" ),61 anchors = tabs.find( ".ui-tabs-anchor" ),62 panels = element.find( ".ui-tabs-panel" );63 equal( element.find( ".ui-tabs-nav" ).attr( "role" ), "tablist", "tablist role" );64 tabs.each(function( index ) {65 var tab = tabs.eq( index ),66 anchor = anchors.eq( index ),67 anchorId = anchor.attr( "id" ),68 panel = panels.eq( index );69 equal( tab.attr( "role" ), "tab", "tab " + index + " role" );70 equal( tab.attr( "aria-labelledby" ), anchorId, "tab " + index + " aria-labelledby" );71 equal( anchor.attr( "role" ), "presentation", "anchor " + index + " role" );72 equal( anchor.attr( "tabindex" ), -1, "anchor " + index + " tabindex" );73 equal( panel.attr( "role" ), "tabpanel", "panel " + index + " role" );74 equal( panel.attr( "aria-labelledby" ), anchorId, "panel " + index + " aria-labelledby" );75 });76 equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );77 equal( tabs.eq( 1 ).attr( "tabindex" ), 0, "active tab has tabindex=0" );78 equal( tabs.eq( 1 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );79 equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "active panel has aria-expanded=true" );80 equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "active panel has aria-hidden=false" );81 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );82 equal( tabs.eq( 0 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );83 equal( tabs.eq( 0 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );84 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );85 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );86 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );87 equal( tabs.eq( 2 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );88 equal( tabs.eq( 2 ).attr( "aria-disabled" ), "true", "disabled tab has aria-disabled=true" );89 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );90 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );91 element.tabs( "option", "active", 0 );92 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );93 equal( tabs.eq( 0 ).attr( "tabindex" ), 0, "active tab has tabindex=0" );94 equal( tabs.eq( 0 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );95 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "active panel has aria-expanded=true" );96 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "active panel has aria-hidden=false" );97 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );98 equal( tabs.eq( 1 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );99 equal( tabs.eq( 1 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );100 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );101 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );102 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );103 equal( tabs.eq( 2 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );104 equal( tabs.eq( 2 ).attr( "aria-disabled" ), "true", "disabled tab has aria-disabled=true" );105 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );106 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );107 // TODO: aria-live and aria-busy tests for ajax tabs108});109asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", function() {110 expect( 92 );111 var element = $( "#tabs1" ).tabs({112 collapsible: true113 }),114 tabs = element.find( ".ui-tabs-nav li" ),115 panels = element.find( ".ui-tabs-panel" ),116 keyCode = $.ui.keyCode;117 element.data( "tabs" ).delay = 50;118 equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );119 tabs.eq( 0 ).simulate( "focus" );120 // down, right, down (wrap), up (wrap)121 function step1() {122 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab has focus" );123 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );124 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );125 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } );126 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next tab" );127 ok( !tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab is no longer focused" );128 equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );129 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );130 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );131 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );132 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );133 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );134 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );135 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );136 tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } );137 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next tab" );138 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );139 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );140 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );141 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );142 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );143 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );144 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );145 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );146 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } );147 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first tab" );148 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );149 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );150 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );151 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );152 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );153 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } );154 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last tab" );155 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );156 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );157 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );158 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );159 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );160 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );161 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );162 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );163 setTimeout( step2, 100 );164 }165 // left, home, space166 function step2() {167 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );168 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );169 ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );170 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );171 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );172 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );173 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );174 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );175 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } );176 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous tab" );177 equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );178 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );179 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );180 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );181 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );182 ok( panels.eq( 2 ).is( ":visible" ), "third panel is still visible" );183 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );184 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );185 tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } );186 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first tab" );187 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );188 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );189 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is still hidden" );190 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );191 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );192 ok( panels.eq( 2 ).is( ":visible" ), "third panel is still visible" );193 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );194 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );195 // SPACE activates, cancels delay196 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.SPACE } );197 setTimeout( step3, 1 );198 }199 // end, enter200 function step3() {201 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );202 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );203 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );204 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );205 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );206 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );207 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );208 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );209 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } );210 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last tab" );211 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );212 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );213 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );214 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );215 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );216 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );217 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );218 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );219 // ENTER activates, cancels delay220 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.ENTER } );221 setTimeout( step4, 1 );222 }223 // enter (collapse)224 function step4() {225 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );226 ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );227 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );228 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );229 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );230 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );231 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );232 // ENTER collapses if active233 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } );234 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );235 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );236 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );237 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );238 // support: Firefox 12239 // Firefox <13 passes arguments so we can't use setTimeout( start, 1 )240 setTimeout(function() {241 start();242 }, 1 );243 }244 setTimeout( step1, 1 );245});246asyncTest( "keyboard support - CTRL navigation", function() {247 expect( 115 );248 var element = $( "#tabs1" ).tabs(),249 tabs = element.find( ".ui-tabs-nav li" ),250 panels = element.find( ".ui-tabs-panel" ),251 keyCode = $.ui.keyCode;252 element.data( "tabs" ).delay = 50;253 equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );254 tabs.eq( 0 ).simulate( "focus" );255 // down256 function step1() {257 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab has focus" );258 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );259 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );260 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN, ctrlKey: true } );261 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next tab" );262 ok( !tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab is no longer focused" );263 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );264 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );265 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );266 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );267 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );268 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );269 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );270 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );271 setTimeout( step2, 100 );272 }273 // right274 function step2() {275 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );276 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );277 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );278 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );279 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );280 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );281 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );282 tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT, ctrlKey: true } );283 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next tab" );284 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );285 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );286 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );287 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );288 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );289 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );290 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );291 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );292 setTimeout( step3, 100 );293 }294 // down (wrap)295 function step3() {296 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );297 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );298 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );299 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );300 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );301 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );302 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );303 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN, ctrlKey: true } );304 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first tab" );305 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );306 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );307 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );308 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );309 setTimeout( step4, 100 );310 }311 // up (wrap)312 function step4() {313 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );314 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );315 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );316 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );317 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } );318 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last tab" );319 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );320 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );321 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );322 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );323 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );324 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );325 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );326 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );327 setTimeout( step5, 100 );328 }329 // left330 function step5() {331 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );332 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );333 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );334 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );335 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );336 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );337 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );338 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT, ctrlKey: true } );339 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous tab" );340 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );341 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );342 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );343 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );344 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );345 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );346 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );347 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );348 setTimeout( step6, 100 );349 }350 // home351 function step6() {352 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );353 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );354 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );355 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );356 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );357 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );358 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );359 tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME, ctrlKey: true } );360 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first tab" );361 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );362 equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );363 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );364 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );365 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );366 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );367 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );368 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );369 setTimeout( step7, 100 );370 }371 // end372 function step7() {373 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );374 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );375 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );376 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );377 tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END, ctrlKey: true } );378 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last tab" );379 equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );380 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );381 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );382 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );383 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );384 ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );385 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );386 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );387 setTimeout( step8, 100 );388 }389 // space390 function step8() {391 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );392 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );393 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );394 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );395 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );396 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );397 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );398 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.SPACE } );399 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );400 equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );401 ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );402 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );403 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );404 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );405 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );406 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );407 // support: Firefox 12408 // Firefox <13 passes arguments so we can't use setTimeout( start, 1 )409 setTimeout(function() {410 start();411 }, 1 );412 }413 setTimeout( step1, 1 );414});415asyncTest( "keyboard support - CTRL+UP, ALT+PAGE_DOWN, ALT+PAGE_UP", function() {416 expect( 50 );417 var element = $( "#tabs1" ).tabs(),418 tabs = element.find( ".ui-tabs-nav li" ),419 panels = element.find( ".ui-tabs-panel" ),420 keyCode = $.ui.keyCode;421 equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );422 panels.attr( "tabindex", -1 );423 panels.eq( 0 ).simulate( "focus" );424 function step1() {425 strictEqual( document.activeElement, panels[ 0 ], "first panel is activeElement" );426 panels.eq( 0 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );427 strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );428 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN moves focus to next tab" );429 equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );430 ok( panels.eq( 1 ).is( ":visible" ), "second panel is visible" );431 equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "second panel has aria-expanded=true" );432 equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "second panel has aria-hidden=false" );433 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );434 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );435 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );436 tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );437 strictEqual( document.activeElement, tabs[ 2 ], "third tab is activeElement" );438 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN moves focus to next tab" );439 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );440 ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );441 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );442 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );443 ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );444 equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );445 equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );446 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );447 strictEqual( document.activeElement, tabs[ 0 ], "first tab is activeElement" );448 ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN wraps focus to first tab" );449 equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );450 ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );451 equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );452 equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );453 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );454 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );455 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );456 panels.eq( 0 ).simulate( "focus" );457 setTimeout( step2, 1 );458 }459 function step2() {460 strictEqual( document.activeElement, panels[ 0 ], "first panel is activeElement" );461 panels.eq( 0 ).simulate( "keydown", { keyCode: keyCode.PAGE_UP, altKey: true } );462 strictEqual( document.activeElement, tabs[ 2 ], "third tab is activeElement" );463 ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "ALT+PAGE_UP wraps focus to last tab" );464 equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );465 ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );466 equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );467 equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );468 ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );469 equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );470 equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );471 tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.PAGE_UP, altKey: true } );472 strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );473 ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "ALT+PAGE_UP moves focus to previous tab" );474 equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );475 ok( panels.eq( 1 ).is( ":visible" ), "second panel is visible" );476 equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "second panel has aria-expanded=true" );477 equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "second panel has aria-hidden=false" );478 ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );479 equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );480 equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );481 panels.eq( 1 ).simulate( "focus" );482 setTimeout( step3, 1 );483 }484 function step3() {485 strictEqual( document.activeElement, panels[ 1 ], "second panel is activeElement" );486 panels.eq( 1 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } );487 strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );488 // support: Firefox 12489 // Firefox <13 passes arguments so we can't use setTimeout( start, 1 )490 setTimeout(function() {491 start();492 }, 1 );493 }494 setTimeout( step1, 1 );495});496test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {497 expect( 1 );498 var element = $( "#tabs2" ).tabs({499 active: 2,500 beforeLoad: function( event, ui ) {...

Full Screen

Full Screen

testBitopWithConstan.js

Source:testBitopWithConstan.js Github

copy

Full Screen

1function test1 (x) {2 assertEq(x | -1, -1);3 assertEq(-1 | x, -1);4 assertEq(x & -1, 1);5 assertEq(-1 & x, 1);6 assertEq(x ^ -1, -2);7 assertEq(-1 ^ x, -2);8 assertEq(x >> -1, 0);9 assertEq(-1 >> x, -1);10 assertEq(x >>> -1, 0);11 assertEq(-1 >>> x, 2147483647);12 assertEq(x << -1, -2147483648);13 assertEq(-1 << x, -2);14 assertEq(x | 1, 1);15 assertEq(1 | x, 1);16 assertEq(x & 1, 1);17 assertEq(1 & x, 1);18 assertEq(x ^ 1, 0);19 assertEq(1 ^ x, 0);20 assertEq(x >> 1, 0);21 assertEq(1 >> x, 0);22 assertEq(x >>> 1, 0);23 assertEq(1 >>> x, 0);24 assertEq(x << 1, 2);25 assertEq(1 << x, 2);26 assertEq(x | 0, 1);27 assertEq(0 | x, 1);28 assertEq(x & 0, 0);29 assertEq(0 & x, 0);30 assertEq(x ^ 0, 1);31 assertEq(0 ^ x, 1);32 assertEq(x >> 0, 1);33 assertEq(0 >> x, 0);34 assertEq(x >>> 0, 1);35 assertEq(0 >>> x, 0);36 assertEq(x << 0, 1);37 assertEq(0 << x, 0);38 assertEq(x | 0xffffffff, -1);39 assertEq(0xffffffff | x, -1);40 assertEq(x & 0xffffffff, 1);41 assertEq(0xffffffff & x, 1);42 assertEq(x ^ 0xffffffff, -2);43 assertEq(0xffffffff ^ x, -2);44 assertEq(x >> 0xffffffff, 0);45 assertEq(0xffffffff >> x, -1);46 assertEq(x >>> 0xffffffff, 0);47 assertEq(0xffffffff >>> x, 2147483647);48 assertEq(x << 0xffffffff, -2147483648);49 assertEq(0xffffffff << x, -2);50 assertEq(x | "10.6", 11);51 assertEq("10.6" | x, 11);52 assertEq(x & "10.6", 0);53 assertEq("10.6" & x, 0);54 assertEq(x ^ "10.6", 11);55 assertEq("10.6" ^ x, 11);56 assertEq(x >> "10.6", 0);57 assertEq("10.6" >> x, 5);58 assertEq(x >>> "10.6", 0);59 assertEq("10.6" >>> x, 5);60 assertEq(x << "10.6", 1024);61 assertEq("10.6" << x, 20);62 assertEq(x | 2147483648, -2147483647);63 assertEq(2147483648 | x, -2147483647);64 assertEq(x & 2147483648, 0);65 assertEq(2147483648 & x, 0);66 assertEq(x ^ 2147483648, -2147483647);67 assertEq(2147483648 ^ x, -2147483647);68 assertEq(x >> 2147483648, 1);69 assertEq(2147483648 >> x, -1073741824);70 assertEq(x >>> 2147483648, 1);71 assertEq(2147483648 >>> x, 1073741824);72 assertEq(x << 2147483648, 1);73 assertEq(2147483648 << x, 0);74 assertEq(x | 4294967296, 1);75 assertEq(4294967296 | x, 1);76 assertEq(x & 4294967296, 0);77 assertEq(4294967296 & x, 0);78 assertEq(x ^ 4294967296, 1);79 assertEq(4294967296 ^ x, 1);80 assertEq(x >> 4294967296, 1);81 assertEq(4294967296 >> x, 0);82 assertEq(x >>> 4294967296, 1);83 assertEq(4294967296 >>> x, 0);84 assertEq(x << 4294967296, 1);85 assertEq(4294967296 << x, 0);86 assertEq(x | undefined, 1);87 assertEq(undefined | x, 1);88 assertEq(x & undefined, 0);89 assertEq(undefined & x, 0);90 assertEq(x ^ undefined, 1);91 assertEq(undefined ^ x, 1);92 assertEq(x >> undefined, 1);93 assertEq(undefined >> x, 0);94 assertEq(x >>> undefined, 1);95 assertEq(undefined >>> x, 0);96 assertEq(x << undefined, 1);97 assertEq(undefined << x, 0);98 assertEq(x | null, 1);99 assertEq(null | x, 1);100 assertEq(x & null, 0);101 assertEq(null & x, 0);102 assertEq(x ^ null, 1);103 assertEq(null ^ x, 1);104 assertEq(x >> null, 1);105 assertEq(null >> x, 0);106 assertEq(x >>> null, 1);107 assertEq(null >>> x, 0);108 assertEq(x << null, 1);109 assertEq(null << x, 0);110 assertEq(x | false, 1);111 assertEq(false | x, 1);112 assertEq(x & false, 0);113 assertEq(false & x, 0);114 assertEq(x ^ false, 1);115 assertEq(false ^ x, 1);116 assertEq(x >> false, 1);117 assertEq(false >> x, 0);118 assertEq(x >>> false, 1);119 assertEq(false >>> x, 0);120 assertEq(x << false, 1);121 assertEq(false << x, 0);122 assertEq(x | true, 1);123 assertEq(true | x, 1);124 assertEq(x & true, 1);125 assertEq(true & x, 1);126 assertEq(x ^ true, 0);127 assertEq(true ^ x, 0);128 assertEq(x >> true, 0);129 assertEq(true >> x, 0);130 assertEq(x >>> true, 0);131 assertEq(true >>> x, 0);132 assertEq(x << true, 2);133 assertEq(true << x, 2);134 assertEq(x | -1.5, -1);135 assertEq(-1.5 | x, -1);136 assertEq(x & -1.5, 1);137 assertEq(-1.5 & x, 1);138 assertEq(x ^ -1.5, -2);139 assertEq(-1.5 ^ x, -2);140 assertEq(x >> -1.5, 0);141 assertEq(-1.5 >> x, -1);142 assertEq(x >>> -1.5, 0);143 assertEq(-1.5 >>> x, 2147483647);144 assertEq(x << -1.5, -2147483648);145 assertEq(-1.5 << x, -2);146}147test1(1)148149function test2 (x) {150 assertEq(x | -1, -1);151 assertEq(-1 | x, -1);152 assertEq(x & -1, 0);153 assertEq(-1 & x, 0);154 assertEq(x ^ -1, -1);155 assertEq(-1 ^ x, -1);156 assertEq(x >> -1, 0);157 assertEq(-1 >> x, -1);158 assertEq(x >>> -1, 0);159 assertEq(-1 >>> x, 4294967295);160 assertEq(x << -1, 0);161 assertEq(-1 << x, -1);162 assertEq(x | 1, 1);163 assertEq(1 | x, 1);164 assertEq(x & 1, 0);165 assertEq(1 & x, 0);166 assertEq(x ^ 1, 1);167 assertEq(1 ^ x, 1);168 assertEq(x >> 1, 0);169 assertEq(1 >> x, 1);170 assertEq(x >>> 1, 0);171 assertEq(1 >>> x, 1);172 assertEq(x << 1, 0);173 assertEq(1 << x, 1);174 assertEq(x | 0, 0);175 assertEq(0 | x, 0);176 assertEq(x & 0, 0);177 assertEq(0 & x, 0);178 assertEq(x ^ 0, 0);179 assertEq(0 ^ x, 0);180 assertEq(x >> 0, 0);181 assertEq(0 >> x, 0);182 assertEq(x >>> 0, 0);183 assertEq(0 >>> x, 0);184 assertEq(x << 0, 0);185 assertEq(0 << x, 0);186 assertEq(x | 0xffffffff, -1);187 assertEq(0xffffffff | x, -1);188 assertEq(x & 0xffffffff, 0);189 assertEq(0xffffffff & x, 0);190 assertEq(x ^ 0xffffffff, -1);191 assertEq(0xffffffff ^ x, -1);192 assertEq(x >> 0xffffffff, 0);193 assertEq(0xffffffff >> x, -1);194 assertEq(x >>> 0xffffffff, 0);195 assertEq(0xffffffff >>> x, 4294967295);196 assertEq(x << 0xffffffff, 0);197 assertEq(0xffffffff << x, -1);198 assertEq(x | "10.6", 10);199 assertEq("10.6" | x, 10);200 assertEq(x & "10.6", 0);201 assertEq("10.6" & x, 0);202 assertEq(x ^ "10.6", 10);203 assertEq("10.6" ^ x, 10);204 assertEq(x >> "10.6", 0);205 assertEq("10.6" >> x, 10);206 assertEq(x >>> "10.6", 0);207 assertEq("10.6" >>> x, 10);208 assertEq(x << "10.6", 0);209 assertEq("10.6" << x, 10);210 assertEq(x | 2147483648, -2147483648);211 assertEq(2147483648 | x, -2147483648);212 assertEq(x & 2147483648, 0);213 assertEq(2147483648 & x, 0);214 assertEq(x ^ 2147483648, -2147483648);215 assertEq(2147483648 ^ x, -2147483648);216 assertEq(x >> 2147483648, 0);217 assertEq(2147483648 >> x, -2147483648);218 assertEq(x >>> 2147483648, 0);219 assertEq(2147483648 >>> x, 2147483648);220 assertEq(x << 2147483648, 0);221 assertEq(2147483648 << x, -2147483648);222 assertEq(x | 4294967296, 0);223 assertEq(4294967296 | x, 0);224 assertEq(x & 4294967296, 0);225 assertEq(4294967296 & x, 0);226 assertEq(x ^ 4294967296, 0);227 assertEq(4294967296 ^ x, 0);228 assertEq(x >> 4294967296, 0);229 assertEq(4294967296 >> x, 0);230 assertEq(x >>> 4294967296, 0);231 assertEq(4294967296 >>> x, 0);232 assertEq(x << 4294967296, 0);233 assertEq(4294967296 << x, 0);234 assertEq(x | undefined, 0);235 assertEq(undefined | x, 0);236 assertEq(x & undefined, 0);237 assertEq(undefined & x, 0);238 assertEq(x ^ undefined, 0);239 assertEq(undefined ^ x, 0);240 assertEq(x >> undefined, 0);241 assertEq(undefined >> x, 0);242 assertEq(x >>> undefined, 0);243 assertEq(undefined >>> x, 0);244 assertEq(x << undefined, 0);245 assertEq(undefined << x, 0);246 assertEq(x | null, 0);247 assertEq(null | x, 0);248 assertEq(x & null, 0);249 assertEq(null & x, 0);250 assertEq(x ^ null, 0);251 assertEq(null ^ x, 0);252 assertEq(x >> null, 0);253 assertEq(null >> x, 0);254 assertEq(x >>> null, 0);255 assertEq(null >>> x, 0);256 assertEq(x << null, 0);257 assertEq(null << x, 0);258 assertEq(x | false, 0);259 assertEq(false | x, 0);260 assertEq(x & false, 0);261 assertEq(false & x, 0);262 assertEq(x ^ false, 0);263 assertEq(false ^ x, 0);264 assertEq(x >> false, 0);265 assertEq(false >> x, 0);266 assertEq(x >>> false, 0);267 assertEq(false >>> x, 0);268 assertEq(x << false, 0);269 assertEq(false << x, 0);270 assertEq(x | true, 1);271 assertEq(true | x, 1);272 assertEq(x & true, 0);273 assertEq(true & x, 0);274 assertEq(x ^ true, 1);275 assertEq(true ^ x, 1);276 assertEq(x >> true, 0);277 assertEq(true >> x, 1);278 assertEq(x >>> true, 0);279 assertEq(true >>> x, 1);280 assertEq(x << true, 0);281 assertEq(true << x, 1);282 assertEq(x | -1.5, -1);283 assertEq(-1.5 | x, -1);284 assertEq(x & -1.5, 0);285 assertEq(-1.5 & x, 0);286 assertEq(x ^ -1.5, -1);287 assertEq(-1.5 ^ x, -1);288 assertEq(x >> -1.5, 0);289 assertEq(-1.5 >> x, -1);290 assertEq(x >>> -1.5, 0);291 assertEq(-1.5 >>> x, 4294967295);292 assertEq(x << -1.5, 0);293 assertEq(-1.5 << x, -1);294}295test2(0)296297function test3 (x) {298 assertEq(x | -1, -1);299 assertEq(-1 | x, -1);300 assertEq(x & -1, -1);301 assertEq(-1 & x, -1);302 assertEq(x ^ -1, 0);303 assertEq(-1 ^ x, 0);304 assertEq(x >> -1, -1);305 assertEq(-1 >> x, -1);306 assertEq(x >>> -1, 1);307 assertEq(-1 >>> x, 1);308 assertEq(x << -1, -2147483648);309 assertEq(-1 << x, -2147483648);310 assertEq(x | 1, -1);311 assertEq(1 | x, -1);312 assertEq(x & 1, 1);313 assertEq(1 & x, 1);314 assertEq(x ^ 1, -2);315 assertEq(1 ^ x, -2);316 assertEq(x >> 1, -1);317 assertEq(1 >> x, 0);318 assertEq(x >>> 1, 2147483647);319 assertEq(1 >>> x, 0);320 assertEq(x << 1, -2);321 assertEq(1 << x, -2147483648);322 assertEq(x | 0, -1);323 assertEq(0 | x, -1);324 assertEq(x & 0, 0);325 assertEq(0 & x, 0);326 assertEq(x ^ 0, -1);327 assertEq(0 ^ x, -1);328 assertEq(x >> 0, -1);329 assertEq(0 >> x, 0);330 assertEq(x >>> 0, 4294967295);331 assertEq(0 >>> x, 0);332 assertEq(x << 0, -1);333 assertEq(0 << x, 0);334 assertEq(x | 0xffffffff, -1);335 assertEq(0xffffffff | x, -1);336 assertEq(x & 0xffffffff, -1);337 assertEq(0xffffffff & x, -1);338 assertEq(x ^ 0xffffffff, 0);339 assertEq(0xffffffff ^ x, 0);340 assertEq(x >> 0xffffffff, -1);341 assertEq(0xffffffff >> x, -1);342 assertEq(x >>> 0xffffffff, 1);343 assertEq(0xffffffff >>> x, 1);344 assertEq(x << 0xffffffff, -2147483648);345 assertEq(0xffffffff << x, -2147483648);346 assertEq(x | "10.6", -1);347 assertEq("10.6" | x, -1);348 assertEq(x & "10.6", 10);349 assertEq("10.6" & x, 10);350 assertEq(x ^ "10.6", -11);351 assertEq("10.6" ^ x, -11);352 assertEq(x >> "10.6", -1);353 assertEq("10.6" >> x, 0);354 assertEq(x >>> "10.6", 4194303);355 assertEq("10.6" >>> x, 0);356 assertEq(x << "10.6", -1024);357 assertEq("10.6" << x, 0);358 assertEq(x | 2147483648, -1);359 assertEq(2147483648 | x, -1);360 assertEq(x & 2147483648, -2147483648);361 assertEq(2147483648 & x, -2147483648);362 assertEq(x ^ 2147483648, 2147483647);363 assertEq(2147483648 ^ x, 2147483647);364 assertEq(x >> 2147483648, -1);365 assertEq(2147483648 >> x, -1);366 assertEq(x >>> 2147483648, 4294967295);367 assertEq(2147483648 >>> x, 1);368 assertEq(x << 2147483648, -1);369 assertEq(2147483648 << x, 0);370 assertEq(x | 4294967296, -1);371 assertEq(4294967296 | x, -1);372 assertEq(x & 4294967296, 0);373 assertEq(4294967296 & x, 0);374 assertEq(x ^ 4294967296, -1);375 assertEq(4294967296 ^ x, -1);376 assertEq(x >> 4294967296, -1);377 assertEq(4294967296 >> x, 0);378 assertEq(x >>> 4294967296, 4294967295);379 assertEq(4294967296 >>> x, 0);380 assertEq(x << 4294967296, -1);381 assertEq(4294967296 << x, 0);382 assertEq(x | undefined, -1);383 assertEq(undefined | x, -1);384 assertEq(x & undefined, 0);385 assertEq(undefined & x, 0);386 assertEq(x ^ undefined, -1);387 assertEq(undefined ^ x, -1);388 assertEq(x >> undefined, -1);389 assertEq(undefined >> x, 0);390 assertEq(x >>> undefined, 4294967295);391 assertEq(undefined >>> x, 0);392 assertEq(x << undefined, -1);393 assertEq(undefined << x, 0);394 assertEq(x | null, -1);395 assertEq(null | x, -1);396 assertEq(x & null, 0);397 assertEq(null & x, 0);398 assertEq(x ^ null, -1);399 assertEq(null ^ x, -1);400 assertEq(x >> null, -1);401 assertEq(null >> x, 0);402 assertEq(x >>> null, 4294967295);403 assertEq(null >>> x, 0);404 assertEq(x << null, -1);405 assertEq(null << x, 0);406 assertEq(x | false, -1);407 assertEq(false | x, -1);408 assertEq(x & false, 0);409 assertEq(false & x, 0);410 assertEq(x ^ false, -1);411 assertEq(false ^ x, -1);412 assertEq(x >> false, -1);413 assertEq(false >> x, 0);414 assertEq(x >>> false, 4294967295);415 assertEq(false >>> x, 0);416 assertEq(x << false, -1);417 assertEq(false << x, 0);418 assertEq(x | true, -1);419 assertEq(true | x, -1);420 assertEq(x & true, 1);421 assertEq(true & x, 1);422 assertEq(x ^ true, -2);423 assertEq(true ^ x, -2);424 assertEq(x >> true, -1);425 assertEq(true >> x, 0);426 assertEq(x >>> true, 2147483647);427 assertEq(true >>> x, 0);428 assertEq(x << true, -2);429 assertEq(true << x, -2147483648);430 assertEq(x | -1.5, -1);431 assertEq(-1.5 | x, -1);432 assertEq(x & -1.5, -1);433 assertEq(-1.5 & x, -1);434 assertEq(x ^ -1.5, 0);435 assertEq(-1.5 ^ x, 0);436 assertEq(x >> -1.5, -1);437 assertEq(-1.5 >> x, -1);438 assertEq(x >>> -1.5, 1);439 assertEq(-1.5 >>> x, 1);440 assertEq(x << -1.5, -2147483648);441 assertEq(-1.5 << x, -2147483648);442}443test3(-1)444445function test4 (x) {446 assertEq(x | -1, -1);447 assertEq(-1 | x, -1);448 assertEq(x & -1, -2147483648);449 assertEq(-1 & x, -2147483648);450 assertEq(x ^ -1, 2147483647);451 assertEq(-1 ^ x, 2147483647);452 assertEq(x >> -1, -1);453 assertEq(-1 >> x, -1);454 assertEq(x >>> -1, 1);455 assertEq(-1 >>> x, 4294967295);456 assertEq(x << -1, 0);457 assertEq(-1 << x, -1);458 assertEq(x | 1, -2147483647);459 assertEq(1 | x, -2147483647);460 assertEq(x & 1, 0);461 assertEq(1 & x, 0);462 assertEq(x ^ 1, -2147483647);463 assertEq(1 ^ x, -2147483647);464 assertEq(x >> 1, -1073741824);465 assertEq(1 >> x, 1);466 assertEq(x >>> 1, 1073741824);467 assertEq(1 >>> x, 1);468 assertEq(x << 1, 0);469 assertEq(1 << x, 1);470 assertEq(x | 0, -2147483648);471 assertEq(0 | x, -2147483648);472 assertEq(x & 0, 0);473 assertEq(0 & x, 0);474 assertEq(x ^ 0, -2147483648);475 assertEq(0 ^ x, -2147483648);476 assertEq(x >> 0, -2147483648);477 assertEq(0 >> x, 0);478 assertEq(x >>> 0, 2147483648);479 assertEq(0 >>> x, 0);480 assertEq(x << 0, -2147483648);481 assertEq(0 << x, 0);482 assertEq(x | 0xffffffff, -1);483 assertEq(0xffffffff | x, -1);484 assertEq(x & 0xffffffff, -2147483648);485 assertEq(0xffffffff & x, -2147483648);486 assertEq(x ^ 0xffffffff, 2147483647);487 assertEq(0xffffffff ^ x, 2147483647);488 assertEq(x >> 0xffffffff, -1);489 assertEq(0xffffffff >> x, -1);490 assertEq(x >>> 0xffffffff, 1);491 assertEq(0xffffffff >>> x, 4294967295);492 assertEq(x << 0xffffffff, 0);493 assertEq(0xffffffff << x, -1);494 assertEq(x | "10.6", -2147483638);495 assertEq("10.6" | x, -2147483638);496 assertEq(x & "10.6", 0);497 assertEq("10.6" & x, 0);498 assertEq(x ^ "10.6", -2147483638);499 assertEq("10.6" ^ x, -2147483638);500 assertEq(x >> "10.6", -2097152);501 assertEq("10.6" >> x, 10);502 assertEq(x >>> "10.6", 2097152);503 assertEq("10.6" >>> x, 10);504 assertEq(x << "10.6", 0);505 assertEq("10.6" << x, 10);506 assertEq(x | 2147483648, -2147483648);507 assertEq(2147483648 | x, -2147483648);508 assertEq(x & 2147483648, -2147483648);509 assertEq(2147483648 & x, -2147483648);510 assertEq(x ^ 2147483648, 0);511 assertEq(2147483648 ^ x, 0);512 assertEq(x >> 2147483648, -2147483648);513 assertEq(2147483648 >> x, -2147483648);514 assertEq(x >>> 2147483648, 2147483648);515 assertEq(2147483648 >>> x, 2147483648);516 assertEq(x << 2147483648, -2147483648);517 assertEq(2147483648 << x, -2147483648);518 assertEq(x | 4294967296, -2147483648);519 assertEq(4294967296 | x, -2147483648);520 assertEq(x & 4294967296, 0);521 assertEq(4294967296 & x, 0);522 assertEq(x ^ 4294967296, -2147483648);523 assertEq(4294967296 ^ x, -2147483648);524 assertEq(x >> 4294967296, -2147483648);525 assertEq(4294967296 >> x, 0);526 assertEq(x >>> 4294967296, 2147483648);527 assertEq(4294967296 >>> x, 0);528 assertEq(x << 4294967296, -2147483648);529 assertEq(4294967296 << x, 0);530 assertEq(x | undefined, -2147483648);531 assertEq(undefined | x, -2147483648);532 assertEq(x & undefined, 0);533 assertEq(undefined & x, 0);534 assertEq(x ^ undefined, -2147483648);535 assertEq(undefined ^ x, -2147483648);536 assertEq(x >> undefined, -2147483648);537 assertEq(undefined >> x, 0);538 assertEq(x >>> undefined, 2147483648);539 assertEq(undefined >>> x, 0);540 assertEq(x << undefined, -2147483648);541 assertEq(undefined << x, 0);542 assertEq(x | null, -2147483648);543 assertEq(null | x, -2147483648);544 assertEq(x & null, 0);545 assertEq(null & x, 0);546 assertEq(x ^ null, -2147483648);547 assertEq(null ^ x, -2147483648);548 assertEq(x >> null, -2147483648);549 assertEq(null >> x, 0);550 assertEq(x >>> null, 2147483648);551 assertEq(null >>> x, 0);552 assertEq(x << null, -2147483648);553 assertEq(null << x, 0);554 assertEq(x | false, -2147483648);555 assertEq(false | x, -2147483648);556 assertEq(x & false, 0);557 assertEq(false & x, 0);558 assertEq(x ^ false, -2147483648);559 assertEq(false ^ x, -2147483648);560 assertEq(x >> false, -2147483648);561 assertEq(false >> x, 0);562 assertEq(x >>> false, 2147483648);563 assertEq(false >>> x, 0);564 assertEq(x << false, -2147483648);565 assertEq(false << x, 0);566 assertEq(x | true, -2147483647);567 assertEq(true | x, -2147483647);568 assertEq(x & true, 0);569 assertEq(true & x, 0);570 assertEq(x ^ true, -2147483647);571 assertEq(true ^ x, -2147483647);572 assertEq(x >> true, -1073741824);573 assertEq(true >> x, 1);574 assertEq(x >>> true, 1073741824);575 assertEq(true >>> x, 1);576 assertEq(x << true, 0);577 assertEq(true << x, 1);578 assertEq(x | -1.5, -1);579 assertEq(-1.5 | x, -1);580 assertEq(x & -1.5, -2147483648);581 assertEq(-1.5 & x, -2147483648);582 assertEq(x ^ -1.5, 2147483647);583 assertEq(-1.5 ^ x, 2147483647);584 assertEq(x >> -1.5, -1);585 assertEq(-1.5 >> x, -1);586 assertEq(x >>> -1.5, 1);587 assertEq(-1.5 >>> x, 4294967295);588 assertEq(x << -1.5, 0);589 assertEq(-1.5 << x, -1);590}591test4(2147483648)592593function test5 (x) {594 assertEq(x | -1, -1);595 assertEq(-1 | x, -1);596 assertEq(x & -1, -2147483648);597 assertEq(-1 & x, -2147483648);598 assertEq(x ^ -1, 2147483647);599 assertEq(-1 ^ x, 2147483647);600 assertEq(x >> -1, -1);601 assertEq(-1 >> x, -1);602 assertEq(x >>> -1, 1);603 assertEq(-1 >>> x, 4294967295);604 assertEq(x << -1, 0);605 assertEq(-1 << x, -1);606 assertEq(x | 1, -2147483647);607 assertEq(1 | x, -2147483647);608 assertEq(x & 1, 0);609 assertEq(1 & x, 0);610 assertEq(x ^ 1, -2147483647);611 assertEq(1 ^ x, -2147483647);612 assertEq(x >> 1, -1073741824);613 assertEq(1 >> x, 1);614 assertEq(x >>> 1, 1073741824);615 assertEq(1 >>> x, 1);616 assertEq(x << 1, 0);617 assertEq(1 << x, 1);618 assertEq(x | 0, -2147483648);619 assertEq(0 | x, -2147483648);620 assertEq(x & 0, 0);621 assertEq(0 & x, 0);622 assertEq(x ^ 0, -2147483648);623 assertEq(0 ^ x, -2147483648);624 assertEq(x >> 0, -2147483648);625 assertEq(0 >> x, 0);626 assertEq(x >>> 0, 2147483648);627 assertEq(0 >>> x, 0);628 assertEq(x << 0, -2147483648);629 assertEq(0 << x, 0);630 assertEq(x | 0xffffffff, -1);631 assertEq(0xffffffff | x, -1);632 assertEq(x & 0xffffffff, -2147483648);633 assertEq(0xffffffff & x, -2147483648);634 assertEq(x ^ 0xffffffff, 2147483647);635 assertEq(0xffffffff ^ x, 2147483647);636 assertEq(x >> 0xffffffff, -1);637 assertEq(0xffffffff >> x, -1);638 assertEq(x >>> 0xffffffff, 1);639 assertEq(0xffffffff >>> x, 4294967295);640 assertEq(x << 0xffffffff, 0);641 assertEq(0xffffffff << x, -1);642 assertEq(x | "10.6", -2147483638);643 assertEq("10.6" | x, -2147483638);644 assertEq(x & "10.6", 0);645 assertEq("10.6" & x, 0);646 assertEq(x ^ "10.6", -2147483638);647 assertEq("10.6" ^ x, -2147483638);648 assertEq(x >> "10.6", -2097152);649 assertEq("10.6" >> x, 10);650 assertEq(x >>> "10.6", 2097152);651 assertEq("10.6" >>> x, 10);652 assertEq(x << "10.6", 0);653 assertEq("10.6" << x, 10);654 assertEq(x | 2147483648, -2147483648);655 assertEq(2147483648 | x, -2147483648);656 assertEq(x & 2147483648, -2147483648);657 assertEq(2147483648 & x, -2147483648);658 assertEq(x ^ 2147483648, 0);659 assertEq(2147483648 ^ x, 0);660 assertEq(x >> 2147483648, -2147483648);661 assertEq(2147483648 >> x, -2147483648);662 assertEq(x >>> 2147483648, 2147483648);663 assertEq(2147483648 >>> x, 2147483648);664 assertEq(x << 2147483648, -2147483648);665 assertEq(2147483648 << x, -2147483648);666 assertEq(x | 4294967296, -2147483648);667 assertEq(4294967296 | x, -2147483648);668 assertEq(x & 4294967296, 0);669 assertEq(4294967296 & x, 0);670 assertEq(x ^ 4294967296, -2147483648);671 assertEq(4294967296 ^ x, -2147483648);672 assertEq(x >> 4294967296, -2147483648);673 assertEq(4294967296 >> x, 0);674 assertEq(x >>> 4294967296, 2147483648);675 assertEq(4294967296 >>> x, 0);676 assertEq(x << 4294967296, -2147483648);677 assertEq(4294967296 << x, 0);678 assertEq(x | undefined, -2147483648);679 assertEq(undefined | x, -2147483648);680 assertEq(x & undefined, 0);681 assertEq(undefined & x, 0);682 assertEq(x ^ undefined, -2147483648);683 assertEq(undefined ^ x, -2147483648);684 assertEq(x >> undefined, -2147483648);685 assertEq(undefined >> x, 0);686 assertEq(x >>> undefined, 2147483648);687 assertEq(undefined >>> x, 0);688 assertEq(x << undefined, -2147483648);689 assertEq(undefined << x, 0);690 assertEq(x | null, -2147483648);691 assertEq(null | x, -2147483648);692 assertEq(x & null, 0);693 assertEq(null & x, 0);694 assertEq(x ^ null, -2147483648);695 assertEq(null ^ x, -2147483648);696 assertEq(x >> null, -2147483648);697 assertEq(null >> x, 0);698 assertEq(x >>> null, 2147483648);699 assertEq(null >>> x, 0);700 assertEq(x << null, -2147483648);701 assertEq(null << x, 0);702 assertEq(x | false, -2147483648);703 assertEq(false | x, -2147483648);704 assertEq(x & false, 0);705 assertEq(false & x, 0);706 assertEq(x ^ false, -2147483648);707 assertEq(false ^ x, -2147483648);708 assertEq(x >> false, -2147483648);709 assertEq(false >> x, 0);710 assertEq(x >>> false, 2147483648);711 assertEq(false >>> x, 0);712 assertEq(x << false, -2147483648);713 assertEq(false << x, 0);714 assertEq(x | true, -2147483647);715 assertEq(true | x, -2147483647);716 assertEq(x & true, 0);717 assertEq(true & x, 0);718 assertEq(x ^ true, -2147483647);719 assertEq(true ^ x, -2147483647);720 assertEq(x >> true, -1073741824);721 assertEq(true >> x, 1);722 assertEq(x >>> true, 1073741824);723 assertEq(true >>> x, 1);724 assertEq(x << true, 0);725 assertEq(true << x, 1);726 assertEq(x | -1.5, -1);727 assertEq(-1.5 | x, -1);728 assertEq(x & -1.5, -2147483648);729 assertEq(-1.5 & x, -2147483648);730 assertEq(x ^ -1.5, 2147483647);731 assertEq(-1.5 ^ x, 2147483647);732 assertEq(x >> -1.5, -1);733 assertEq(-1.5 >> x, -1);734 assertEq(x >>> -1.5, 1);735 assertEq(-1.5 >>> x, 4294967295);736 assertEq(x << -1.5, 0);737 assertEq(-1.5 << x, -1);738}739test5(-2147483648)740 ...

Full Screen

Full Screen

xpctest_variant.js

Source:xpctest_variant.js Github

copy

Full Screen

1const TestVariant = Components.Constructor("@mozilla.org/js/xpc/test/TestVariant;1", 2 "nsITestVariant");3var tv = new TestVariant;4const DataTypeArray = [5 Components.interfaces.nsIDataType.VTYPE_INT8 ,6 Components.interfaces.nsIDataType.VTYPE_INT16 ,7 Components.interfaces.nsIDataType.VTYPE_INT32 ,8 Components.interfaces.nsIDataType.VTYPE_INT64 ,9 Components.interfaces.nsIDataType.VTYPE_UINT8 ,10 Components.interfaces.nsIDataType.VTYPE_UINT16 ,11 Components.interfaces.nsIDataType.VTYPE_UINT32 ,12 Components.interfaces.nsIDataType.VTYPE_UINT64 ,13 Components.interfaces.nsIDataType.VTYPE_FLOAT ,14 Components.interfaces.nsIDataType.VTYPE_DOUBLE ,15 Components.interfaces.nsIDataType.VTYPE_BOOL ,16 Components.interfaces.nsIDataType.VTYPE_CHAR ,17 Components.interfaces.nsIDataType.VTYPE_WCHAR ,18 Components.interfaces.nsIDataType.VTYPE_VOID ,19 Components.interfaces.nsIDataType.VTYPE_ID ,20 Components.interfaces.nsIDataType.VTYPE_DOMSTRING ,21 Components.interfaces.nsIDataType.VTYPE_CHAR_STR ,22 Components.interfaces.nsIDataType.VTYPE_WCHAR_STR ,23 Components.interfaces.nsIDataType.VTYPE_INTERFACE ,24 Components.interfaces.nsIDataType.VTYPE_INTERFACE_IS ,25 Components.interfaces.nsIDataType.VTYPE_ARRAY ,26 Components.interfaces.nsIDataType.VTYPE_STRING_SIZE_IS ,27 Components.interfaces.nsIDataType.VTYPE_WSTRING_SIZE_IS ,28 Components.interfaces.nsIDataType.VTYPE_UTF8STRING ,29 Components.interfaces.nsIDataType.VTYPE_CSTRING ,30 Components.interfaces.nsIDataType.VTYPE_ASTRING , 31 Components.interfaces.nsIDataType.VTYPE_EMPTY_ARRAY , 32 Components.interfaces.nsIDataType.VTYPE_EMPTY 33];34const ShortNames = [35 {name: "I1", number: Components.interfaces.nsIDataType.VTYPE_INT8 },36 {name: "I2", number: Components.interfaces.nsIDataType.VTYPE_INT16 },37 {name: "I4", number: Components.interfaces.nsIDataType.VTYPE_INT32 },38 {name: "I8", number: Components.interfaces.nsIDataType.VTYPE_INT64 },39 {name: "U1", number: Components.interfaces.nsIDataType.VTYPE_UINT8 },40 {name: "U2", number: Components.interfaces.nsIDataType.VTYPE_UINT16 },41 {name: "U4", number: Components.interfaces.nsIDataType.VTYPE_UINT32 },42 {name: "U8", number: Components.interfaces.nsIDataType.VTYPE_UINT64 },43 {name: "FL", number: Components.interfaces.nsIDataType.VTYPE_FLOAT },44 {name: "DB", number: Components.interfaces.nsIDataType.VTYPE_DOUBLE },45 {name: "BO", number: Components.interfaces.nsIDataType.VTYPE_BOOL },46 {name: "CH", number: Components.interfaces.nsIDataType.VTYPE_CHAR },47 {name: "WC", number: Components.interfaces.nsIDataType.VTYPE_WCHAR },48 {name: "VD", number: Components.interfaces.nsIDataType.VTYPE_VOID },49 {name: "ID", number: Components.interfaces.nsIDataType.VTYPE_ID },50 {name: "DS", number: Components.interfaces.nsIDataType.VTYPE_DOMSTRING },51 {name: "ST", number: Components.interfaces.nsIDataType.VTYPE_CHAR_STR },52 {name: "WS", number: Components.interfaces.nsIDataType.VTYPE_WCHAR_STR },53 {name: "NS", number: Components.interfaces.nsIDataType.VTYPE_INTERFACE },54 {name: "IF", number: Components.interfaces.nsIDataType.VTYPE_INTERFACE_IS },55 {name: "AR", number: Components.interfaces.nsIDataType.VTYPE_ARRAY },56 {name: "Ss", number: Components.interfaces.nsIDataType.VTYPE_STRING_SIZE_IS },57 {name: "Ws", number: Components.interfaces.nsIDataType.VTYPE_WSTRING_SIZE_IS},58 {name: "US", number: Components.interfaces.nsIDataType.VTYPE_UTF8STRING },59 {name: "CS", number: Components.interfaces.nsIDataType.VTYPE_CSTRING },60 {name: "AS", number: Components.interfaces.nsIDataType.VTYPE_ASTRING },61 {name: "EA", number: Components.interfaces.nsIDataType.VTYPE_EMPTY_ARRAY },62 {name: "EM", number: Components.interfaces.nsIDataType.VTYPE_EMPTY }63];64function getDataTypeName(number) {65 var iface = Components.interfaces.nsIDataType66 for(var n in iface)67 if(iface[n] == number)68 return n;69 return "unknown type!";70}71function getDataTypeShortName(number) {72 for(var i = 0; i < ShortNames.length; i++)73 if(ShortNames[i].number == number)74 return ShortNames[i].name;75 return "???";76}77function eqOp(o1, o2) {return o1 == o2;}78function eqObj(o1, o2) {return o1.equals(o2);}79function eqNumber(o1, o2) {return parseFloat(o1) == parseFloat(o2);}80const eq = {string: "equal result"};81const _e = {string: "exception"};82const NE = {string: "un-equal result"};83const _0 = {string: "zero result"};84const _1 = {string: "one result"};85const _T = {string: "true result"};86const _F = {string: "false result"};87function TestSingleConvert(value, comment, eq_fun, table) {88 print("<h3>convert test for: "+value+" "+comment+"</h3>");89 print('<TABLE BORDER="1" COLS='+table.length+'>');90 print('<TR>');91 for(var i = 0; i < table.length; i++) {92 print('<TH>'+getDataTypeShortName(DataTypeArray[i])+'</TH>');93 }94 print('</TR>');95 96 print('<TR>');97 for(var i = 0; i < table.length; i++) {98 var exception = undefined;99 var value2 = undefined;100 try {101 value2 = tv.copyVariantAsType(value, DataTypeArray[i]);102 var same = eq_fun(value, value2);103 success = (same && table[i] == eq) || 104 (!same && table[i] == NE) ||105 (table[i] == _0 && 0 == value2) ||106 (table[i] == _T && true == value2) ||107 (table[i] == _F && false == value2);108 } catch(e) {109 exception = e;110 success = table[i] == _e;111 } 112 if(success) 113 print('<TD><font color="green">OK</font></TD>');114 else if(exception) {115 var alertText = "Exception thrown. Expected: "+table[i].string;116 print('<TD><font color="red"><A HREF="" '+117 'onclick="alert(\''+alertText+'\'); return false;"'+118 '>X</A></font></TD>');119 }120 else {121 var alertText = "Result = "+value2+". Expected: "+table[i].string;122 print('<TD><font color="red"><A HREF="" '+123 'onclick="alert(\''+alertText+'\'); return false;"'+124 '>X</A></font></TD>');125 } 126 } 127 print('</TR>');128 print('</TABLE>');129}130function TestDoubleConvert(value, comment, eq_fun, table) {131 print("<h3>convert test for: "+value+" "+comment+"</h3>");132 print('<TABLE BORDER="1" COLS='+table.length+2+'>');133 print('<TR>');134 print('<TH></TH>');135 for(var i = 0; i < table.length; i++) {136 print('<TH>'+getDataTypeShortName(DataTypeArray[i])+'</TH>');137 }138 print('<TH></TH>');139 print('</TR>');140 141 for(var i = 0; i < table.length; i++) {142 print('<TR>');143 print('<TD>'+getDataTypeShortName(DataTypeArray[i])+'</TD>');144 for(var k = 0; k < table.length; k++) {145 var exception = undefined;146 var value2 = undefined;147 var expected = table[i][k];148 try {149 value2 = tv.copyVariantAsTypeTwice(value, 150 DataTypeArray[k],151 DataTypeArray[i]);152 var same = eq_fun(value, value2);153 success = (same && expected == eq) || 154 (!same && expected == NE) ||155 (expected == _0 && 0 == value2) ||156 (expected == _T && true == value2) ||157 (expected == _F && false == value2);158 } catch(e) {159 exception = e;160 success = expected == _e;161 } 162 if(success) 163 print('<TD><font color="green">OK</font></TD>');164 else if(exception) {165 var alertText = "Exception thrown. Expected: "+expected.string;166 print('<TD><font color="red"><A HREF="" '+167 'onclick="alert(\''+alertText+'\'); return false;"'+168 '>X</A></font></TD>');169 }170 else {171 var alertText = "Result = was wrong. Expected: "+expected.string;172 print('<TD><font color="red"><A HREF="" '+173 'onclick="alert(\''+alertText+'\'); return false;"'+174 '>X</A></font></TD>');175 } 176 }177 print('<TD>'+getDataTypeShortName(DataTypeArray[i])+'</TD>');178 print('</TR>');179 }180 print('</TABLE>');181}182// 183const SingleConvertResultsTableFor_String_Foo = [184/*I1,I2,I4,I8,U1,U2,U4,U8,FL,DB,BO,CH,WC,VD,ID,DS,ST,WS,NS,IF,AR,Ss,Ws,US,CS,AS,EA,EM */185 _e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e186];187const SingleConvertResultsTableFor_String_5 = [188/*I1,I2,I4,I8,U1,U2,U4,U8,FL,DB,BO,CH,WC,VD,ID,DS,ST,WS,NS,IF,AR,Ss,Ws,US,CS,AS,EA,EM */189 eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e190];191const SingleConvertResultsTableFor_Number_20 = [192/*I1,I2,I4,I8,U1,U2,U4,U8,FL,DB,BO,CH,WC,VD,ID,DS,ST,WS,NS,IF,AR,Ss,Ws,US,CS,AS,EA,EM */193 eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e194];195const DoubleConvertResultsTableFor_String_Foo = [196/* I1,I2,I4,I8,U1,U2,U4,U8,FL,DB,BO,CH,WC,VD,ID,DS,ST,WS,NS,IF,AR,Ss,Ws,US,CS,AS,EA,EM */197/*I1*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*I1*/198/*I2*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*I2*/199/*I4*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*I4*/200/*I8*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*I8*/201/*U1*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*U1*/202/*U2*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*U2*/203/*U4*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*U4*/204/*U8*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*U8*/205/*FL*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*FL*/206/*DB*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*DB*/207/*BO*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*BO*/208/*CH*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*CH*/209/*WC*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*WC*/210/*VD*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*VD*/211/*ID*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*ID*/212/*DS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*DS*/213/*ST*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*ST*/214/*WS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*WS*/215/*NS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*NS*/216/*IF*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*IF*/217/*AR*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*AR*/218/*Ss*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*Ss*/219/*Ws*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*Ws*/220/*US*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*US*/221/*CS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*CS*/222/*AS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*AS*/223/*EA*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*EA*/224/*EM*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e] /*EM*/225];226const DoubleConvertResultsTableFor_String_Five = [227/* I1,I2,I4,I8,U1,U2,U4,U8,FL,DB,BO,CH,WC,VD,ID,DS,ST,WS,NS,IF,AR,Ss,Ws,US,CS,AS,EA,EM */228/*I1*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*I1*/229/*I2*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*I2*/230/*I4*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*I4*/231/*I8*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*I8*/232/*U1*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*U1*/233/*U2*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*U2*/234/*U4*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*U4*/235/*U8*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*U8*/236/*FL*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*FL*/237/*DB*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,_T,eq,eq,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*DB*/238/*BO*/[_T,_T,_T,_T,_T,_T,_T,_T,_T,_T,_T,NE,NE,_e,_e,_T,_T,_T,_e,_e,_e,_T,_T,_T,_T,_T,_e,_e],/*BO*/239/*CH*/[NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,_e,_e,NE,NE,NE,_e,_e,_e,NE,NE,NE,NE,NE,_e,_e],/*CH*/240/*WC*/[NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,NE,_e,_e,NE,NE,NE,_e,_e,_e,NE,NE,NE,NE,NE,_e,_e],/*WC*/241/*VD*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*VD*/242/*ID*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*ID*/243/*DS*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*DS*/244/*ST*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*ST*/245/*WS*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*WS*/246/*NS*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*NS*/247/*IF*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*IF*/248/*AR*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*AR*/249/*Ss*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*Ss*/250/*Ws*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*Ws*/251/*US*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*US*/252/*CS*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*CS*/253/*AS*/[eq,eq,eq,eq,eq,eq,eq,eq,eq,eq,NE,NE,NE,_e,_e,eq,eq,eq,_e,_e,_e,eq,eq,eq,eq,eq,_e,_e],/*AS*/254/*EA*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e],/*EA*/255/*EM*/[_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e,_e] /*EM*/256];257var values = [258 "foo",259 0, 260 5, 261 1.01, 262 Components, 263 {}, 264 Components.interfaces.nsISupports,265 null,266 true,267 undefined268];269var i;270/***************************************************************************/271if(0){272print();273for(i = 0; i < values.length; i++)274 print(getDataTypeName(tv.returnVariantType(values[i])));275print();276print();277for(i = 0; i < values.length; i++)278 print(tv.passThruVariant(values[i]));279print();280print();281for(i = 0; i < values.length; i++)282 print(tv.copyVariant(values[i]));283}284function RunSingleConvertTests() {285 TestSingleConvert("foo", "a string", eqOp, SingleConvertResultsTableFor_String_Foo);286 TestSingleConvert("5", "a string", eqNumber, SingleConvertResultsTableFor_String_5);287 TestSingleConvert(20, "a number", eqNumber, SingleConvertResultsTableFor_Number_20);288 print("<P>");289}290function RunDoubleConvertTests() {291 TestDoubleConvert("foo", "a string", eqOp, DoubleConvertResultsTableFor_String_Foo);292 TestDoubleConvert("5", "a string", eqNumber, DoubleConvertResultsTableFor_String_Five);293 print("<P>");294}295// main...296print("<html><body>")297RunSingleConvertTests();298RunDoubleConvertTests();...

Full Screen

Full Screen

rt_data-battery_32.js

Source:rt_data-battery_32.js Github

copy

Full Screen

...39 $('#device-'+ obj.data_id +' .bat_temp').html(obj.temperature +'°C');40 if(No1){41 var arr = No1.split(',');42 for(var q=0;q<arr.length;q++){43 $('#bat_voltageNo1_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(1)>span:eq(0)').html(obj.voltage[arr[q]] + 'V');44 $('#bat_voltageNo1_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(4)>span:eq(0)').html(obj.voltage[arr[q+1]] + 'V');45 $('#bat_voltageNo1_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(7)>span:eq(0)').html(obj.voltage[arr[q]+2] + 'V');46 $('#bat_voltageNo1_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(10)>span:eq(0)').html(obj.voltage[arr[q]+3] + 'V'); 47 }48 }49 if(No2){50 var arr = No2.split(',');51 for(var q=0;q<arr.length;q++){52 $('#bat_voltageNo2_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(1)>span:eq(0)').html(obj.voltage[arr[q]] + 'V');53 $('#bat_voltageNo2_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(4)>span:eq(0)').html(obj.voltage[arr[q+1]] + 'V');54 $('#bat_voltageNo2_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(7)>span:eq(0)').html(obj.voltage[arr[q]+2] + 'V');55 $('#bat_voltageNo2_'+ obj.data_id).find(' tbody>tr:eq('+q +') td:eq(10)>span:eq(0)').html(obj.voltage[arr[q]+3] + 'V'); 56 }57 }58 if(!No1){59 for(var j = 0 ; j < obj.voltage.length ; j+=4)60 {61 if(j == 0){62 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+j +') td:eq(1)>span:eq(0)').html(obj.voltage[j] + 'V');63 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+j +') td:eq(4)>span:eq(0)').html(obj.voltage[j+1] + 'V');64 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+j +') td:eq(7)>span:eq(0)').html(obj.voltage[j+2] + 'V');65 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+j +') td:eq(10)>span:eq(0)').html(obj.voltage[j+3] + 'V');66 }67 else{68 var k = j - ((j / 4) * 3);69 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+k +') td:eq(1)>span:eq(0)').html(obj.voltage[j] + 'V');70 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+k +') td:eq(4)>span:eq(0)').html(obj.voltage[j+1] + 'V');71 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+k +') td:eq(7)>span:eq(0)').html(obj.voltage[j+2] + 'V');72 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+k +') td:eq(10)>span:eq(0)').html(obj.voltage[j+3] + 'V');73 }74 }75 }76 if( type == "44"){77 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');78 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[1] + 'V');79 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[2] + 'V');80 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[3] + 'V');81 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[6] + 'V');82 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[7] + 'V');83 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[8] + 'V');84 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[9] + 'V');85 86 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[13] + 'V');87 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[14] + 'V');88 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[14] + 'V');89 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[16] + 'V');90 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[19] + 'V');91 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[20] + 'V');92 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[21] + 'V');93 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[22] + 'V');94 }95 if( type == "44i"){96 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');97 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[1] + 'V');98 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[2] + 'V');99 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[3] + 'V');100 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[6] + 'V');101 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[7] + 'V');102 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[8] + 'V');103 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[9] + 'V');104 105 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[12] + 'V');106 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[13] + 'V');107 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[14] + 'V');108 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[15] + 'V');109 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[18] + 'V');110 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[19] + 'V');111 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[20] + 'V');112 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[21] + 'V');113 }114 if( type == "11"){115 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');116 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[1] + 'V');117 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[2] + 'V');118 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[3] + 'V');119 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[4] + 'V');120 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[5] + 'V');121 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[6] + 'V');122 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[7] + 'V');123 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(1)>span:eq(0)').html(obj.voltage[8] + 'V');124 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(4)>span:eq(0)').html(obj.voltage[9] + 'V');125 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(7)>span:eq(0)').html(obj.voltage[10] + 'V');126 127 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[13] + 'V');128 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(4)>span:eq(0)').html(obj.voltage[14] + 'V');129 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(7)>span:eq(0)').html(obj.voltage[15] + 'V');130 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(10)>span:eq(0)').html(obj.voltage[16] + 'V');131 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[17] + 'V');132 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(4)>span:eq(0)').html(obj.voltage[18] + 'V');133 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(7)>span:eq(0)').html(obj.voltage[19] + 'V');134 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(10)>span:eq(0)').html(obj.voltage[20] + 'V');135 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(1)>span:eq(0)').html(obj.voltage[21] + 'V');136 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(4)>span:eq(0)').html(obj.voltage[22] + 'V');137 $('#bat_voltage2_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(7)>span:eq(0)').html(obj.voltage[23] + 'V'); 138 139 }140 $('#bat_pi-' + obj.data_id +' tbody').empty();141 if(obj.pi == null || obj.pi.length == 0){142 $('#bat_pi-' + obj.data_id +' tbody').html('<tr><td colspan="3">无</td></tr>');143 }else{144 for(var j = 0 ; j < obj.pi.length ; j++){145 var piObj = obj.pi[j];146 $('#bat_pi-' + obj.data_id +' tbody').append('<tr><td>'+ (j+1) +'</td><td>'+ piObj.label +'</td><td>'+ piObj.value +'V</td></tr>');147 }148 }149 }150 if(obj.dynamic_config != false)151 {...

Full Screen

Full Screen

rt_data-bat.js

Source:rt_data-bat.js Github

copy

Full Screen

...30 $('#device-' + obj.data_id + ' .group_i').html(obj.group_i +'A');31 $('#device-' + obj.data_id + ' .bat_temp').html(obj.temperature +'°C');32 for(var j = 0 ; j < obj.voltage.length ; j++)33 {34 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+j +') td:eq(1)>span:eq(0)').html(obj.voltage[j] + 'V');35 } 36 37 if( type == "44"){38 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');39 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[1] + 'V');40 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(1)>span:eq(0)').html(obj.voltage[2] + 'V');41 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+3 +') td:eq(1)>span:eq(0)').html(obj.voltage[3] + 'V');42 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+4 +') td:eq(1)>span:eq(0)').html(obj.voltage[6] + 'V');43 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+5 +') td:eq(1)>span:eq(0)').html(obj.voltage[7] + 'V');44 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+6 +') td:eq(1)>span:eq(0)').html(obj.voltage[8] + 'V');45 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+7 +') td:eq(1)>span:eq(0)').html(obj.voltage[9] + 'V');46 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+8 +') td:eq(1)>span:eq(0)').html(obj.voltage[13] + 'V');47 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+9 +') td:eq(1)>span:eq(0)').html(obj.voltage[14] + 'V');48 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+10 +') td:eq(1)>span:eq(0)').html(obj.voltage[15] + 'V');49 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+11 +') td:eq(1)>span:eq(0)').html(obj.voltage[16] + 'V');50 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+12 +') td:eq(1)>span:eq(0)').html(obj.voltage[19] + 'V');51 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+13 +') td:eq(1)>span:eq(0)').html(obj.voltage[20] + 'V');52 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+14 +') td:eq(1)>span:eq(0)').html(obj.voltage[21] + 'V');53 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+15 +') td:eq(1)>span:eq(0)').html(obj.voltage[22] + 'V');54 }55 if( type == "44i"){56 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');57 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[1] + 'V');58 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(1)>span:eq(0)').html(obj.voltage[2] + 'V');59 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+3 +') td:eq(1)>span:eq(0)').html(obj.voltage[3] + 'V');60 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+4 +') td:eq(1)>span:eq(0)').html(obj.voltage[6] + 'V');61 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+5 +') td:eq(1)>span:eq(0)').html(obj.voltage[7] + 'V');62 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+6 +') td:eq(1)>span:eq(0)').html(obj.voltage[8] + 'V');63 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+7 +') td:eq(1)>span:eq(0)').html(obj.voltage[9] + 'V');64 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+8 +') td:eq(1)>span:eq(0)').html(obj.voltage[12] + 'V');65 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+9 +') td:eq(1)>span:eq(0)').html(obj.voltage[13] + 'V');66 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+10 +') td:eq(1)>span:eq(0)').html(obj.voltage[14] + 'V');67 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+11 +') td:eq(1)>span:eq(0)').html(obj.voltage[15] + 'V');68 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+12 +') td:eq(1)>span:eq(0)').html(obj.voltage[18] + 'V');69 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+13 +') td:eq(1)>span:eq(0)').html(obj.voltage[19] + 'V');70 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+14 +') td:eq(1)>span:eq(0)').html(obj.voltage[20] + 'V');71 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+15 +') td:eq(1)>span:eq(0)').html(obj.voltage[21] + 'V');72 }73 if( type == "11"){74 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+0 +') td:eq(1)>span:eq(0)').html(obj.voltage[0] + 'V');75 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+1 +') td:eq(1)>span:eq(0)').html(obj.voltage[1] + 'V');76 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+2 +') td:eq(1)>span:eq(0)').html(obj.voltage[2] + 'V');77 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+3 +') td:eq(1)>span:eq(0)').html(obj.voltage[3] + 'V');78 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+4 +') td:eq(1)>span:eq(0)').html(obj.voltage[4] + 'V');79 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+5 +') td:eq(1)>span:eq(0)').html(obj.voltage[5] + 'V');80 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+6 +') td:eq(1)>span:eq(0)').html(obj.voltage[6] + 'V');81 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+7 +') td:eq(1)>span:eq(0)').html(obj.voltage[7] + 'V');82 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+8 +') td:eq(1)>span:eq(0)').html(obj.voltage[8] + 'V');83 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+9 +') td:eq(1)>span:eq(0)').html(obj.voltage[9] + 'V');84 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+10 +') td:eq()>span:eq(0)').html(obj.voltage[10] + 'V');85 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+11 +') td:eq(1)>span:eq(0)').html(obj.voltage[13] + 'V');86 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+12 +') td:eq(1)>span:eq(0)').html(obj.voltage[14] + 'V');87 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+13 +') td:eq(1)>span:eq(0)').html(obj.voltage[15] + 'V');88 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+14 +') td:eq(1)>span:eq(0)').html(obj.voltage[16] + 'V');89 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+15 +') td:eq(1)>span:eq(0)').html(obj.voltage[17] + 'V');90 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+16 +') td:eq(1)>span:eq(0)').html(obj.voltage[18] + 'V');91 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+17 +') td:eq(1)>span:eq(0)').html(obj.voltage[19] + 'V');92 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+18 +') td:eq(1)>span:eq(0)').html(obj.voltage[20] + 'V');93 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+19 +') td:eq(1)>span:eq(0)').html(obj.voltage[21] + 'V');94 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+20 +') td:eq(1)>span:eq(0)').html(obj.voltage[22] + 'V');95 $('#bat_voltage_'+ obj.data_id).find(' tbody>tr:eq('+21 +') td:eq(1)>span:eq(0)').html(obj.voltage[23] + 'V'); 96 97 }98 99 $('#bat_pi-' + obj.data_id +' tbody').empty();100 if(obj.pi == null || obj.pi.length == 0){101 $('#bat_pi-' + obj.data_id +' tbody').html('<tr><td colspan="3">无</td></tr>');102 }else{103 for(var j = 0 ; j < obj.pi.length ; j++){104 var piObj = obj.pi[j];105 $('#bat_pi-' + obj.data_id +' tbody').append('<tr><td>'+ (j+1) +'</td><td>'+ piObj.label +'</td><td>'+ piObj.value +'V</td></tr>');106 }107 }108 }109 if(obj.dynamic_config != false)...

Full Screen

Full Screen

matrix.js

Source:matrix.js Github

copy

Full Screen

...5 var eq = function(t, a, b){ t.t(2 * Math.abs(a - b) / ((a < 1 && b < 1) ? 1 : a + b) < 1e-6); };6 tests.register("dojox.gfx.tests.matrix", [7 function IdentityTest(t){8 var a = new m.Matrix2D();9 eq(t, a.xx, 1);10 eq(t, a.yy, 1);11 eq(t, a.xy, 0);12 eq(t, a.yx, 0);13 eq(t, a.dx, 0);14 eq(t, a.dy, 0);15 },16 function Rot30gTest(t){17 var a = m.rotateg(30);18 eq(t, a.xx, a.yy);19 eq(t, a.xy, -a.yx);20 eq(t, a.dx, 0);21 eq(t, a.dy, 0);22 eq(t, a.yx, 0.5);23 t.t(a.xy < 0);24 t.t(a.yx > 0);25 },26 function Rot45gTest(t){27 var a = m.rotateg(45);28 eq(t, a.xx, a.yy);29 eq(t, a.xy, -a.yx);30 eq(t, a.dx, 0);31 eq(t, a.dy, 0);32 eq(t, a.xx, a.yx);33 eq(t, a.yy, -a.xy);34 },35 function Rot90gTest(t){36 var a = m.rotateg(90);37 eq(t, a.xx, a.yy);38 eq(t, a.xy, -a.yx);39 eq(t, a.dx, 0);40 eq(t, a.dy, 0);41 eq(t, a.xx, 0);42 eq(t, a.yx, 1);43 },44 function CombineIdentitiesTest(t){45 var a = m.normalize([new m.Matrix2D(), new m.Matrix2D(), new m.Matrix2D()]);46 eq(t, a.xx, 1);47 eq(t, a.yy, 1);48 eq(t, a.xy, 0);49 eq(t, a.yx, 0);50 eq(t, a.dx, 0);51 eq(t, a.dy, 0);52 },53 function CombineExclusiveTest(t){54 var a = m.normalize([m.rotateg(30), m.rotateg(-30)]);55 eq(t, a.xx, 1);56 eq(t, a.yy, 1);57 eq(t, a.xy, 0);58 eq(t, a.yx, 0);59 eq(t, a.dx, 0);60 eq(t, a.dy, 0);61 },62 function CombineInvertedTest(t){63 var a = m.normalize([m.rotateg(30), m.invert(m.rotateg(30))]);64 eq(t, a.xx, 1);65 eq(t, a.yy, 1);66 eq(t, a.xy, 0);67 eq(t, a.yx, 0);68 eq(t, a.dx, 0);69 eq(t, a.dy, 0);70 },71 function Rot90gAtTest(t){72 var a = m.rotategAt(90, 10, 10);73 eq(t, a.xx, a.yy);74 eq(t, a.xy, -a.yx);75 eq(t, a.dx, 20);76 eq(t, a.dy, 0);77 eq(t, a.xx, 0);78 eq(t, a.yx, 1);79 },80 function MultPointTest1(t){81 var b = m.multiplyPoint(m.rotategAt(90, 10, 10), 10, 10);82 eq(t, b.x, 10);83 eq(t, b.y, 10);84 },85 function MultPointTest2(t){86 var b = m.multiplyPoint(m.rotategAt(90, 10, 10), {x: 10, y: 5});87 eq(t, b.x, 15);88 eq(t, b.y, 10);89 },90 function MultPointTest3(t){91 var b = m.multiplyPoint(m.rotategAt(90, 10, 10), 10, 15);92 eq(t, b.x, 5);93 eq(t, b.y, 10);94 },95 function ScaleTest1(t){96 var a = m.normalize([m.scale(2, 1), m.invert(m.rotateg(45))]);97 eq(t, a.xx, 2 * a.yy);98 eq(t, a.xy, -2 * a.yx);99 eq(t, a.dx, 0);100 eq(t, a.dy, 0);101 eq(t, a.xx, a.xy);102 eq(t, a.yy, -a.yx);103 },104 function ScaleTest2(t){105 var a = m.normalize([m.scale(1, 2), m.invert(m.rotateg(45))]);106 eq(t, 2 * a.xx, a.yy);107 eq(t, 2 * a.xy, -a.yx);108 eq(t, a.dx, 0);109 eq(t, a.dy, 0);110 eq(t, a.xx, a.xy);111 eq(t, a.yy, -a.yx);112 },113 function ScaleTest3(t){114 var a = m.normalize([m.rotateg(45), m.scale(2, 1)]);115 eq(t, a.xx, 2 * a.yy);116 eq(t, a.yx, -2 * a.xy);117 eq(t, a.dx, 0);118 eq(t, a.dy, 0);119 eq(t, a.xx, a.yx);120 eq(t, a.yy, -a.xy);121 },122 function ScaleTest4(t){123 var a = m.normalize([m.rotateg(45), m.scale(1, 2)]);124 eq(t, 2 * a.xx, a.yy);125 eq(t, 2 * a.yx, -a.xy);126 eq(t, a.dx, 0);127 eq(t, a.dy, 0);128 eq(t, a.xx, a.yx);129 eq(t, a.yy, -a.xy);130 },131 function ScaleTest5(t){132 var a = m.normalize([m.rotategAt(45, 100, 100), m.scale(2)]);133 eq(t, a.xx, a.yy);134 eq(t, a.xy, -a.yx);135 eq(t, a.xx, a.yx);136 eq(t, a.yy, -a.xy);137 eq(t, a.dx, 100);138 t.t(a.dy < 0);139 var b = m.normalize([m.scale(2), m.rotategAt(45, 100, 100)]);140 eq(t, b.xx, b.yy);141 eq(t, b.xy, -b.yx);142 eq(t, b.xx, b.yx);143 eq(t, b.yy, -b.xy);144 eq(t, b.dx, 200);145 t.t(b.dy < 0);146 eq(t, a.xx, b.xx);147 eq(t, a.xy, b.xy);148 eq(t, a.yx, b.yx);149 eq(t, a.yy, b.yy);150 eq(t, 2 * a.dx, b.dx);151 eq(t, 2 * a.dy, b.dy);152 var c = m.normalize([m.rotateg(45), m.scale(2)]);153 eq(t, c.xx, c.yy);154 eq(t, c.xy, -c.yx);155 eq(t, c.xx, c.yx);156 eq(t, c.yy, -c.xy);157 eq(t, c.dx, 0);158 eq(t, c.dy, 0);159 var d = m.normalize([m.scale(2), m.rotateg(45)]);160 eq(t, d.xx, d.yy);161 eq(t, d.xy, -d.yx);162 eq(t, d.xx, d.yx);163 eq(t, d.yy, -d.xy);164 eq(t, d.dx, 0);165 eq(t, d.dy, 0);166 eq(t, a.xx, c.xx);167 eq(t, a.xy, c.xy);168 eq(t, a.yx, c.yx);169 eq(t, a.yy, c.yy);170 eq(t, a.xx, d.xx);171 eq(t, a.xy, d.xy);172 eq(t, a.yx, d.yx);173 eq(t, a.yy, d.yy);174 },175 function ScaleTest6(t){176 var a = m.normalize(6);177 eq(t, a.xx, 6);178 eq(t, a.yy, 6);179 eq(t, a.xy, 0);180 eq(t, a.yx, 0);181 eq(t, a.dx, 0);182 eq(t, a.dy, 0);183 },184 function ScaleTest7(t){185 var a = m.normalize([2, m.scale(2, 1)]);186 eq(t, a.xx, 4);187 eq(t, a.yy, 2);188 eq(t, a.xy, 0);189 eq(t, a.yx, 0);190 eq(t, a.dx, 0);191 eq(t, a.dy, 0);192 },193 function TranslateTest(t){194 var a = m.normalize({dx: 100, dy: 200});195 eq(t, a.xx, 1);196 eq(t, a.yy, 1);197 eq(t, a.xy, 0);198 eq(t, a.yx, 0);199 eq(t, a.dx, 100);200 eq(t, a.dy, 200);201 },202 function ReflectTest1(t){203 var b = m.multiplyPoint(m.reflect(1, 1), 1, 0);204 eq(t, b.x, 0);205 eq(t, b.y, 1);206 },207 function ReflectTest2(t){208 var b = m.multiplyPoint(m.reflect(1, 1), 0, 1);209 eq(t, b.x, 1);210 eq(t, b.y, 0);211 },212 function ProjectTest1(t){213 var b = m.multiplyPoint(m.project(1, 1), 1, 0);214 eq(t, b.x, 0.5);215 eq(t, b.y, 0.5);216 },217 function ProjectTest2(t){218 var b = m.multiplyPoint(m.project(1, 1), 0, 1);219 eq(t, b.x, 0.5);220 eq(t, b.y, 0.5);221 },222 function IsIdentityTest(t){223 var a = new m.Matrix2D();224 tests.assertTrue(m.isIdentity(a));225 a.xy=1;226 tests.assertFalse(m.isIdentity(a));227 },228 function MultiplyRectangle(t){229 var a = new m.Matrix2D(), 230 r = {x:0,y:0,width:3,height:2},231 res;232 // multiply by identity -> same rect233 res = m.multiplyRectangle(a, r);234 tests.assertTrue(res.x == r.x && res.y == r.y && res.width == r.width && res.height == r.height); 235 res = m.multiplyRectangle(m.scale(2,2), r);236 eq(t, res.x, 0);237 eq(t, res.y, 0);238 eq(t, res.width, 6);239 eq(t, res.height, 4);240 a = m.rotategAt(-45, 0, 0);241 var tl = m.multiplyPoint(a, 0, 0), // top left242 tr = m.multiplyPoint(a, 3, 0), // top right243 br = m.multiplyPoint(a, 3, 2), // bottom right244 bl = m.multiplyPoint(a, 0, 2), // bottom left245 exp = {x : tl.x, y:tr.y, width: br.x, height: bl.y - tr.y}; // expected246 res = m.multiplyRectangle(a, r);247 eq(t, res.x, exp.x);248 eq(t, res.y, exp.y);249 eq(t, res.width, exp.width);250 eq(t, res.height, exp.height);251 // matrices array252 res = m.multiplyRectangle([m.translate(10,10), m.scale(2,2)], r);253 eq(t, res.x, 10);254 eq(t, res.y, 10);255 eq(t, res.width, 6);256 eq(t, res.height, 4);257 }258 259 ]);...

Full Screen

Full Screen

2746-stable-sort.js

Source:2746-stable-sort.js Github

copy

Full Screen

...7 "Initial sort",8 null,9 function () {10 var ret =11 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&12 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&13 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&14 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&15 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';16 return ret;17 }18 );19 20 oTest.fnTest( 21 "Reserve initial sort",22 function () {23 $('#example thead th:eq(0)').click();24 },25 function () {26 var ret =27 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Webkit' &&28 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&29 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Safari 1.2' &&30 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 1.3' &&31 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';32 return ret;33 }34 );35 36 oTest.fnTest( 37 "Reserve to go back to initial sort sort",38 function () {39 $('#example thead th:eq(0)').click();40 },41 function () {42 var ret =43 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&44 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&45 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&46 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&47 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';48 return ret;49 }50 );51 52 oTest.fnTest( 53 "Reserve initial sort again",54 function () {55 $('#example thead th:eq(0)').click();56 },57 function () {58 var ret =59 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Webkit' &&60 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&61 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Safari 1.2' &&62 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 1.3' &&63 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';64 return ret;65 }66 );67 68 oTest.fnTest( 69 "And once more back to the initial sort",70 function () {71 $('#example thead th:eq(0)').click();72 },73 function () {74 var ret =75 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&76 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&77 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Firefox 1.0' &&78 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Firefox 1.5' &&79 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Firefox 2.0';80 return ret;81 }82 );83 84 oTest.fnTest( 85 "Sort on second column",86 function () {87 $('#example thead th:eq(1)').click();88 },89 function () {90 var ret =91 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&92 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&93 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&94 $('#example tbody tr:eq(1) td:eq(1)').html() == 'AOL browser (AOL desktop)' &&95 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.0';96 return ret;97 }98 );99 100 oTest.fnTest( 101 "Reserve sort on second column",102 function () {103 $('#example thead th:eq(1)').click();104 },105 function () {106 var ret =107 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&108 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Webkit' &&109 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1' &&110 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Safari 3.0' &&111 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Safari 2.0';112 return ret;113 }114 );115 116 oTest.fnTest( 117 "And back to asc sorting on second column",118 function () {119 $('#example thead th:eq(1)').click();120 },121 function () {122 var ret =123 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&124 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&125 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&126 $('#example tbody tr:eq(1) td:eq(1)').html() == 'AOL browser (AOL desktop)' &&127 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.0';128 return ret;129 }130 );131 132 oTest.fnTest( 133 "Sort on third column, having now sorted on second",134 function () {135 $('#example thead th:eq(2)').click();136 },137 function () {138 var ret =139 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&140 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Misc' &&141 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&142 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Dillo 0.8' &&143 $('#example tbody tr:eq(2) td:eq(1)').html() == 'NetFront 3.1';144 return ret;145 }146 );147 148 oTest.fnTest( 149 "Reserve sort on third column",150 function () {151 $('#example thead th:eq(2)').click();152 },153 function () {154 var ret =155 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Misc' &&156 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Trident' &&157 $('#example tbody tr:eq(0) td:eq(1)').html() == 'IE Mobile' &&158 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Internet Explorer 7' &&159 $('#example tbody tr:eq(2) td:eq(1)').html() == 'AOL browser (AOL desktop)';160 return ret;161 }162 );163 164 oTest.fnTest( 165 "Return sorting on third column to asc",166 function () {167 $('#example thead th:eq(2)').click();168 },169 function () {170 var ret =171 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Other browsers' &&172 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Misc' &&173 $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others' &&174 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Dillo 0.8' &&175 $('#example tbody tr:eq(2) td:eq(1)').html() == 'NetFront 3.1';176 return ret;177 }178 );179 180 oTest.fnTest( 181 "Sort on first column having sorted on second then third columns",182 function () {183 $('#example thead th:eq(0)').click();184 },185 function () {186 var ret =187 $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko' &&188 $('#example tbody tr:eq(1) td:eq(0)').html() == 'Gecko' &&189 $('#example tbody tr:eq(0) td:eq(1)').html() == 'Epiphany 2.20' &&190 $('#example tbody tr:eq(1) td:eq(1)').html() == 'Camino 1.0' &&191 $('#example tbody tr:eq(2) td:eq(1)').html() == 'Camino 1.5';192 return ret;193 }194 );195 196 197 oTest.fnComplete();...

Full Screen

Full Screen

utils.test.js

Source:utils.test.js Github

copy

Full Screen

...3 { expect } = chai,4 utils = require( '../../src/utils/index' );5module.exports = function() {6 it( 'isNaN', () => {7 expect( utils.isNaN( NaN ) ).to.eq( true );8 expect( utils.isNaN( 1 ) ).to.eq( false );9 expect( utils.isNaN( true ) ).to.eq( false );10 expect( utils.isNaN( undefined ) ).to.eq( false );11 expect( utils.isNaN( null ) ).to.eq( false );12 expect( utils.isNaN( NaN, NaN ) ).to.eq( true );13 expect( utils.isNaN( 1, NaN ) ).to.eq( false );14 expect( utils.isNaN( NaN, NaN, true ) ).to.eq( false );15 } );16 it( 'isUndefined', () => {17 expect( utils.isUndefined( NaN ) ).to.eq( false );18 expect( utils.isUndefined( 1 ) ).to.eq( false );19 expect( utils.isUndefined( true ) ).to.eq( false );20 expect( utils.isUndefined( undefined ) ).to.eq( true );21 expect( utils.isUndefined( null ) ).to.eq( false );22 expect( utils.isUndefined( undefined, undefined ) ).to.eq( true );23 expect( utils.isUndefined( 1, undefined ) ).to.eq( false );24 expect( utils.isUndefined( undefined, undefined, true ) ).to.eq( false );25 } );26 it( 'isNull', () => {27 expect( utils.isNull( NaN ) ).to.eq( false );28 expect( utils.isNull( 1 ) ).to.eq( false );29 expect( utils.isNull( true ) ).to.eq( false );30 expect( utils.isNull( undefined ) ).to.eq( false );31 expect( utils.isNull( null ) ).to.eq( true );32 expect( utils.isNull( null, null ) ).to.eq( true );33 expect( utils.isNull( 1, null ) ).to.eq( false );34 expect( utils.isNull( null, null, false ) ).to.eq( false );35 } );36 it( 'isBoolean', () => {37 expect( utils.isBoolean( NaN ) ).to.eq( false );38 expect( utils.isBoolean( 1 ) ).to.eq( false );39 expect( utils.isBoolean( true ) ).to.eq( true );40 expect( utils.isBoolean( undefined ) ).to.eq( false );41 expect( utils.isBoolean( null ) ).to.eq( false );42 expect( utils.isBoolean( true, false ) ).to.eq( true );43 expect( utils.isBoolean( 1, false ) ).to.eq( false );44 expect( utils.isBoolean( true, false, null ) ).to.eq( false );45 } );46 it( 'isString', () => {47 expect( utils.isString( true ) ).to.eq( false );48 expect( utils.isString( 100 ) ).to.eq( false );49 expect( utils.isString( 'string' ) ).to.eq( true );50 expect( utils.isString( 'string', 'string' ) ).to.eq( true );51 expect( utils.isString( 100, 'string' ) ).to.eq( false );52 expect( utils.isString( 'string', true ) ).to.eq( false );53 } );54 it( 'isNumber', () => {55 expect( utils.isNumber( true ) ).to.eq( false );56 expect( utils.isNumber( 100 ) ).to.eq( true );57 expect( utils.isNumber( 'string' ) ).to.eq( false );58 expect( utils.isNumber( 100, 100 ) ).to.eq( true );59 expect( utils.isNumber( 100, 'string' ) ).to.eq( false );60 expect( utils.isNumber( 'string', true ) ).to.eq( false );61 } );62 it( 'isPrimitive', () => {63 expect( utils.isPrimitive( true ) ).to.eq( true );64 expect( utils.isPrimitive( 100 ) ).to.eq( true );65 expect( utils.isPrimitive( 'string' ) ).to.eq( true );66 expect( utils.isPrimitive( [] ) ).to.eq( false );67 expect( utils.isPrimitive( {} ) ).to.eq( false );68 expect( utils.isPrimitive( true, 1, 'a' ) ).to.eq( true );69 expect( utils.isPrimitive( true, 1, 'a', [] ) ).to.eq( false );70 expect( utils.isPrimitive( {}, true, 1, 'a' ) ).to.eq( false );71 } );72 it( 'isArray', () => {73 expect( utils.isArray( 'string' ) ).to.eq( false );74 expect( utils.isArray( [] ) ).to.eq( true );75 expect( utils.isArray( {} ) ).to.eq( false );76 expect( utils.isArray( [], [], [] ) ).to.eq( true );77 expect( utils.isArray( {}, [], [] ) ).to.eq( false );78 expect( utils.isArray( [], [], {} ) ).to.eq( false );79 } );80 it( 'isObject', () => {81 expect( utils.isObject( 'string' ) ).to.eq( false );82 expect( utils.isObject( [] ) ).to.eq( false );83 expect( utils.isObject( {} ) ).to.eq( true );84 expect( utils.isObject( {}, {}, {} ) ).to.eq( true );85 expect( utils.isObject( {}, [], [] ) ).to.eq( false );86 expect( utils.isObject( [], [], {} ) ).to.eq( false );87 } );88 it( 'isBuffer', () => {89 const buf = Buffer.from( 'string' );90 expect( utils.isBuffer( 'string' ) ).to.eq( false );91 expect( utils.isBuffer( buf ) ).to.eq( true );92 expect( utils.isBuffer( buf, buf, buf ) ).to.eq( true );93 expect( utils.isBuffer( {}, buf, buf ) ).to.eq( false );94 expect( utils.isBuffer( buf, buf, {} ) ).to.eq( false );95 } );96 it( 'isFunction', () => {97 const func = () => {98 };99 const func2 = function() {100 };101 expect( utils.isFunction( 'string' ) ).to.eq( false );102 expect( utils.isFunction( func ) ).to.eq( true );103 expect( utils.isFunction( func2 ) ).to.eq( true );104 expect( utils.isFunction( func, func2, func, func2 ) ).to.eq( true );105 expect( utils.isFunction( {}, func, func2 ) ).to.eq( false );106 expect( utils.isFunction( func, func2, {} ) ).to.eq( false );107 } );108 it( 'isValue', () => {109 expect( utils.isValue( NaN ) ).to.eq( false );110 expect( utils.isValue( undefined ) ).to.eq( false );111 expect( utils.isValue( null ) ).to.eq( false );112 expect( utils.isValue( true ) ).to.eq( true );113 expect( utils.isValue( false ) ).to.eq( true );114 expect( utils.isValue( 100 ) ).to.eq( true );115 expect( utils.isValue( 'string' ) ).to.eq( true );116 expect( utils.isValue( true, false, 100, 'string' ) ).to.eq( true );117 expect( utils.isValue( [], {}, Symbol() ) ).to.eq( true );118 expect( utils.isValue( {}, true, NaN ) ).to.eq( false );119 expect( utils.isValue( undefined, null, 100 ) ).to.eq( false );120 expect( utils.isValue( NaN, undefined, null ) ).to.eq( false );121 } );122 it( 'wait', async () => {123 const x = Date.now();124 const val = await utils.wait( 500, 'abc' );125 const y = Date.now();126 expect( y - x ).to.satisfy( ( n ) => n >= 500 && n < 600 );127 expect( val ).to.eq( 'abc' );128 expect( () => utils.wait( 'abc' ) ).to.throw( 'Argument Error - expected number' );129 } );130 it( 'bytesToSize', async () => {131 expect( utils.bytesToSize() ).to.eq( '0 Byte' );132 expect( utils.bytesToSize( 1073741824 ) ).to.eq( '1 GB' );133 } );...

Full Screen

Full Screen

Jest Testing Tutorial

LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.

Chapters

  1. What is Jest Framework
  2. Advantages of Jest - Jest has 3,898,000 GitHub repositories, as mentioned on its official website. Learn what makes Jest special and why Jest has gained popularity among the testing and developer community.
  3. Jest Installation - All the prerequisites and set up steps needed to help you start Jest automation testing.
  4. Using Jest with NodeJS Project - Learn how to leverage Jest framework to automate testing using a NodeJS Project.
  5. Writing First Test for Jest Framework - Get started with code-based tutorial to help you write and execute your first Jest framework testing script.
  6. Jest Vocabulary - Learn the industry renowned and official jargons of the Jest framework by digging deep into the Jest vocabulary.
  7. Unit Testing with Jest - Step-by-step tutorial to help you execute unit testing with Jest framework.
  8. Jest Basics - Learn about the most pivotal and basic features which makes Jest special.
  9. Jest Parameterized Tests - Avoid code duplication and fasten automation testing with Jest using parameterized tests. Parameterization allows you to trigger the same test scenario over different test configurations by incorporating parameters.
  10. Jest Matchers - Enforce assertions better with the help of matchers. Matchers help you compare the actual output with the expected one. Here is an example to see if the object is acquired from the correct class or not. -

|<p>it('check_object_of_Car', () => {</p><p> expect(newCar()).toBeInstanceOf(Car);</p><p> });</p>| | :- |

  1. Jest Hooks: Setup and Teardown - Learn how to set up conditions which needs to be followed by the test execution and incorporate a tear down function to free resources after the execution is complete.
  2. Jest Code Coverage - Unsure there is no code left unchecked in your application. Jest gives a specific flag called --coverage to help you generate code coverage.
  3. HTML Report Generation - Learn how to create a comprehensive HTML report based on your Jest test execution.
  4. Testing React app using Jest Framework - Learn how to test your react web-application with Jest framework in this detailed Jest tutorial.
  5. Test using LambdaTest cloud Selenium Grid - Run your Jest testing script over LambdaTest cloud-based platform and leverage parallel testing to help trim down your test execution time.
  6. Snapshot Testing for React Front Ends - Capture screenshots of your react based web-application and compare them automatically for visual anomalies with the help of Jest tutorial.
  7. Bonus: Import ES modules with Jest - ES modules are also known as ECMAScript modules. Learn how to best use them by importing in your Jest testing scripts.
  8. Jest vs Mocha vs Jasmine - Learn the key differences between the most popular JavaScript-based testing frameworks i.e. Jest, Mocha, and Jasmine.
  9. Jest FAQs(Frequently Asked Questions) - Explore the most commonly asked questions around Jest framework, with their answers.

Run Jest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful