Best JavaScript code snippet using qawolf
staveconnector_tests.js
Source:staveconnector_tests.js
...50Vex.Flow.Test.StaveConnector.drawSingle = function(options, contextBuilder) {51 var ctx = new contextBuilder(options.canvas_sel, 400, 300);52 var stave = new Vex.Flow.Stave(25, 10, 300);53 var stave2 = new Vex.Flow.Stave(25, 120, 300);54 stave.setContext(ctx);55 stave2.setContext(ctx);56 var connector = new Vex.Flow.StaveConnector(stave, stave2);57 connector.setType(Vex.Flow.StaveConnector.type.SINGLE);58 connector.setContext(ctx);59 stave.draw();60 stave2.draw();61 connector.draw();62 ok(true, "all pass");63}64Vex.Flow.Test.StaveConnector.drawSingle1pxBarlines = function(options, contextBuilder) {65 Vex.Flow.STAVE_LINE_THICKNESS = 1;66 var ctx = new contextBuilder(options.canvas_sel, 400, 300);67 var stave = new Vex.Flow.Stave(25, 10, 300);68 var stave2 = new Vex.Flow.Stave(25, 120, 300);69 stave.setContext(ctx);70 stave2.setContext(ctx);71 var connector = new Vex.Flow.StaveConnector(stave, stave2);72 connector.setType(Vex.Flow.StaveConnector.type.SINGLE);73 connector.setContext(ctx);74 stave.draw();75 stave2.draw();76 connector.draw();77 Vex.Flow.STAVE_LINE_THICKNESS = 2;78 ok(true, "all pass");79}80Vex.Flow.Test.StaveConnector.drawSingleBoth = function(options, contextBuilder) {81 var ctx = new contextBuilder(options.canvas_sel, 400, 300);82 var stave = new Vex.Flow.Stave(25, 10, 300);83 var stave2 = new Vex.Flow.Stave(25, 120, 300);84 stave.setContext(ctx);85 stave2.setContext(ctx);86 var connector = new Vex.Flow.StaveConnector(stave, stave2);87 connector.setType(Vex.Flow.StaveConnector.type.SINGLE_LEFT);88 connector.setContext(ctx);89 var connector2 = new Vex.Flow.StaveConnector(stave, stave2);90 connector2.setType(Vex.Flow.StaveConnector.type.SINGLE_RIGHT);91 connector2.setContext(ctx);92 stave.draw();93 stave2.draw();94 connector.draw();95 connector2.draw();96 ok(true, "all pass");97}98Vex.Flow.Test.StaveConnector.drawDouble = function(options, contextBuilder) {99 var ctx = new contextBuilder(options.canvas_sel, 400, 300);100 var stave = new Vex.Flow.Stave(25, 10, 300);101 var stave2 = new Vex.Flow.Stave(25, 120, 300);102 stave.setContext(ctx);103 stave2.setContext(ctx);104 var connector = new Vex.Flow.StaveConnector(stave, stave2);105 var line = new Vex.Flow.StaveConnector(stave, stave2);106 connector.setType(Vex.Flow.StaveConnector.type.DOUBLE);107 connector.setContext(ctx);108 line.setType(Vex.Flow.StaveConnector.type.SINGLE);109 connector.setContext(ctx);110 line.setContext(ctx);111 stave.draw();112 stave2.draw();113 connector.draw(); 114 line.draw();115 ok(true, "all pass");116}117Vex.Flow.Test.StaveConnector.drawBrace = function(options, contextBuilder) {118 var ctx = new contextBuilder(options.canvas_sel, 450, 300);119 var stave = new Vex.Flow.Stave(100, 10, 300);120 var stave2 = new Vex.Flow.Stave(100, 120, 300);121 stave.setContext(ctx);122 stave2.setContext(ctx);123 var connector = new Vex.Flow.StaveConnector(stave, stave2);124 var line = new Vex.Flow.StaveConnector(stave, stave2);125 connector.setType(Vex.Flow.StaveConnector.type.BRACE);126 connector.setContext(ctx);127 connector.setText('Piano');128 line.setType(Vex.Flow.StaveConnector.type.SINGLE);129 connector.setContext(ctx);130 line.setContext(ctx);131 stave.draw();132 stave2.draw();133 connector.draw();134 line.draw();135 ok(true, "all pass");136}137Vex.Flow.Test.StaveConnector.drawBraceWide = function(options, contextBuilder) {138 var ctx = new contextBuilder(options.canvas_sel, 400, 300);139 var stave = new Vex.Flow.Stave(25, -20, 300);140 var stave2 = new Vex.Flow.Stave(25, 200, 300);141 stave.setContext(ctx);142 stave2.setContext(ctx);143 var connector = new Vex.Flow.StaveConnector(stave, stave2);144 var line = new Vex.Flow.StaveConnector(stave, stave2);145 connector.setType(Vex.Flow.StaveConnector.type.BRACE);146 connector.setContext(ctx);147 line.setType(Vex.Flow.StaveConnector.type.SINGLE);148 connector.setContext(ctx);149 line.setContext(ctx);150 stave.draw();151 stave2.draw();152 connector.draw();153 line.draw();154 ok(true, "all pass");155}156Vex.Flow.Test.StaveConnector.drawBracket = function(options, contextBuilder) {157 var ctx = new contextBuilder(options.canvas_sel, 400, 300);158 var stave = new Vex.Flow.Stave(25, 10, 300);159 var stave2 = new Vex.Flow.Stave(25, 120, 300);160 stave.setContext(ctx);161 stave2.setContext(ctx);162 var connector = new Vex.Flow.StaveConnector(stave, stave2);163 var line = new Vex.Flow.StaveConnector(stave, stave2);164 connector.setType(Vex.Flow.StaveConnector.type.BRACKET);165 connector.setContext(ctx);166 line.setType(Vex.Flow.StaveConnector.type.SINGLE);167 connector.setContext(ctx);168 line.setContext(ctx);169 stave.draw();170 stave2.draw();171 connector.draw();172 line.draw();173 ok(true, "all pass");174}175Vex.Flow.Test.StaveConnector.drawRepeatBegin = function(options, contextBuilder) {176 var ctx = new contextBuilder(options.canvas_sel, 400, 300);177 var stave = new Vex.Flow.Stave(25, 10, 300);178 var stave2 = new Vex.Flow.Stave(25, 120, 300);179 stave.setContext(ctx);180 stave2.setContext(ctx);181 stave.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);182 stave2.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);183 var line = new Vex.Flow.StaveConnector(stave, stave2);184 line.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);185 line.setContext(ctx);186 stave.draw();187 stave2.draw();188 line.draw();189 ok(true, "all pass");190}191Vex.Flow.Test.StaveConnector.drawRepeatEnd = function(options, contextBuilder) {192 var ctx = new contextBuilder(options.canvas_sel, 400, 300);193 var stave = new Vex.Flow.Stave(25, 10, 300);194 var stave2 = new Vex.Flow.Stave(25, 120, 300);195 stave.setContext(ctx);196 stave2.setContext(ctx);197 stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);198 stave2.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);199 var line = new Vex.Flow.StaveConnector(stave, stave2);200 line.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);201 line.setContext(ctx);202 stave.draw();203 stave2.draw();204 line.draw();205 ok(true, "all pass");206}207Vex.Flow.Test.StaveConnector.drawThinDouble= function(options, contextBuilder) {208 var ctx = new contextBuilder(options.canvas_sel, 400, 300);209 var stave = new Vex.Flow.Stave(25, 10, 300);210 var stave2 = new Vex.Flow.Stave(25, 120, 300);211 stave.setContext(ctx);212 stave2.setContext(ctx);213 stave.setEndBarType(Vex.Flow.Barline.type.DOUBLE);214 stave2.setEndBarType(Vex.Flow.Barline.type.DOUBLE);215 var line = new Vex.Flow.StaveConnector(stave, stave2);216 line.setType(Vex.Flow.StaveConnector.type.THIN_DOUBLE);217 line.setContext(ctx);218 stave.draw();219 stave2.draw();220 line.draw();221 ok(true, "all pass");222}223Vex.Flow.Test.StaveConnector.drawRepeatAdjacent = function(options, contextBuilder) {224 var ctx = new contextBuilder(options.canvas_sel, 400, 300);225 var stave = new Vex.Flow.Stave(25, 10, 150);226 var stave2 = new Vex.Flow.Stave(25, 120, 150);227 var stave3 = new Vex.Flow.Stave(175, 10, 150);228 var stave4 = new Vex.Flow.Stave(175, 120, 150);229 stave.setContext(ctx);230 stave2.setContext(ctx);231 stave3.setContext(ctx);232 stave4.setContext(ctx);233 stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);234 stave2.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);235 stave3.setEndBarType(Vex.Flow.Barline.type.END);236 stave4.setEndBarType(Vex.Flow.Barline.type.END);237 stave.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);238 stave2.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);239 stave3.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);240 stave4.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);241 var connector = new Vex.Flow.StaveConnector(stave, stave2);242 var connector2 = new Vex.Flow.StaveConnector(stave, stave2);243 var connector3 = new Vex.Flow.StaveConnector(stave3, stave4);244 var connector4 = new Vex.Flow.StaveConnector(stave3, stave4);245 connector.setContext(ctx);246 connector2.setContext(ctx);247 connector3.setContext(ctx);248 connector4.setContext(ctx);249 connector.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);250 connector2.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);251 connector3.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);252 connector4.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);253 stave.draw();254 stave2.draw();255 stave3.draw();256 stave4.draw();257 connector.draw();258 connector2.draw();259 connector3.draw();260 connector4.draw();261 ok(true, "all pass");262}263Vex.Flow.Test.StaveConnector.drawRepeatOffset2 = function(options, contextBuilder) {264 var ctx = new contextBuilder(options.canvas_sel, 400, 300);265 var stave = new Vex.Flow.Stave(25, 10, 150);266 var stave2 = new Vex.Flow.Stave(25, 120, 150);267 var stave3 = new Vex.Flow.Stave(175, 10, 150);268 var stave4 = new Vex.Flow.Stave(175, 120, 150);269 stave.setContext(ctx);270 stave2.setContext(ctx);271 stave3.setContext(ctx);272 stave4.setContext(ctx);273 stave.addClef('treble');274 stave2.addClef('bass');275 stave3.addClef('alto');276 stave4.addClef('treble');277 stave.addTimeSignature('4/4');278 stave2.addTimeSignature('4/4');279 stave3.addTimeSignature('6/8');280 stave4.addTimeSignature('6/8');281 stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);282 stave2.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);283 stave3.setEndBarType(Vex.Flow.Barline.type.END);284 stave4.setEndBarType(Vex.Flow.Barline.type.END);285 stave.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);286 stave2.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);287 stave3.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);288 stave4.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);289 var connector = new Vex.Flow.StaveConnector(stave, stave2);290 var connector2 = new Vex.Flow.StaveConnector(stave, stave2);291 var connector3 = new Vex.Flow.StaveConnector(stave3, stave4);292 var connector4 = new Vex.Flow.StaveConnector(stave3, stave4);293 var connector5 = new Vex.Flow.StaveConnector(stave3, stave4);294 connector.setContext(ctx);295 connector2.setContext(ctx);296 connector3.setContext(ctx);297 connector4.setContext(ctx);298 connector5.setContext(ctx);299 connector.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);300 connector2.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);301 connector3.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);302 connector4.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);303 connector5.setType(Vex.Flow.StaveConnector.type.SINGLE_LEFT);304 connector.setXShift(stave.getModifierXShift());305 connector3.setXShift(stave3.getModifierXShift());306 stave.draw();307 stave2.draw();308 stave3.draw();309 stave4.draw();310 connector.draw();311 connector2.draw();312 connector3.draw();313 connector4.draw();314 connector5.draw();315 ok(true, "all pass");316}317Vex.Flow.Test.StaveConnector.drawRepeatOffset = function(options, contextBuilder) {318 var ctx = new contextBuilder(options.canvas_sel, 400, 300);319 var stave = new Vex.Flow.Stave(25, 10, 150);320 var stave2 = new Vex.Flow.Stave(25, 120, 150);321 var stave3 = new Vex.Flow.Stave(175, 10, 150);322 var stave4 = new Vex.Flow.Stave(175, 120, 150);323 stave.setContext(ctx);324 stave2.setContext(ctx);325 stave3.setContext(ctx);326 stave4.setContext(ctx);327 stave.addClef('bass');328 stave2.addClef('alto');329 stave3.addClef('treble');330 stave4.addClef('tenor');331 stave3.addKeySignature('Ab');332 stave4.addKeySignature('Ab');333 stave.addTimeSignature('4/4');334 stave2.addTimeSignature('4/4');335 stave3.addTimeSignature('6/8');336 stave4.addTimeSignature('6/8');337 stave.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);338 stave2.setEndBarType(Vex.Flow.Barline.type.REPEAT_END);339 stave3.setEndBarType(Vex.Flow.Barline.type.END);340 stave4.setEndBarType(Vex.Flow.Barline.type.END);341 stave.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);342 stave2.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);343 stave3.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);344 stave4.setBegBarType(Vex.Flow.Barline.type.REPEAT_BEGIN);345 var connector = new Vex.Flow.StaveConnector(stave, stave2);346 var connector2 = new Vex.Flow.StaveConnector(stave, stave2);347 var connector3 = new Vex.Flow.StaveConnector(stave3, stave4);348 var connector4 = new Vex.Flow.StaveConnector(stave3, stave4);349 var connector5 = new Vex.Flow.StaveConnector(stave3, stave4);350 connector.setContext(ctx);351 connector2.setContext(ctx);352 connector3.setContext(ctx);353 connector4.setContext(ctx);354 connector5.setContext(ctx);355 connector.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);356 connector2.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);357 connector3.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_LEFT);358 connector4.setType(Vex.Flow.StaveConnector.type.BOLD_DOUBLE_RIGHT);359 connector5.setType(Vex.Flow.StaveConnector.type.SINGLE_LEFT);360 connector.setXShift(stave.getModifierXShift());361 connector3.setXShift(stave3.getModifierXShift());362 stave.draw();363 stave2.draw();364 stave3.draw();365 stave4.draw();366 connector.draw();367 connector2.draw();368 connector3.draw();369 connector4.draw();370 connector5.draw();371 ok(true, "all pass");372}373Vex.Flow.Test.StaveConnector.drawCombined = function(options, contextBuilder) {374 var ctx = new contextBuilder(options.canvas_sel, 550, 700);375 var stave = new Vex.Flow.Stave(150, 10, 300);376 var stave2 = new Vex.Flow.Stave(150, 100, 300);377 var stave3 = new Vex.Flow.Stave(150, 190, 300);378 var stave4 = new Vex.Flow.Stave(150, 280, 300);379 var stave5 = new Vex.Flow.Stave(150, 370, 300);380 var stave6 = new Vex.Flow.Stave(150, 460, 300);381 var stave7 = new Vex.Flow.Stave(150, 560, 300);382 stave.setText('Violin', Vex.Flow.Modifier.Position.LEFT);383 stave.setContext(ctx);384 stave2.setContext(ctx);385 stave3.setContext(ctx);386 stave4.setContext(ctx);387 stave5.setContext(ctx);388 stave6.setContext(ctx);389 stave7.setContext(ctx);390 var conn_single = new Vex.Flow.StaveConnector(stave, stave7);391 var conn_double = new Vex.Flow.StaveConnector(stave2, stave3);392 var conn_bracket = new Vex.Flow.StaveConnector(stave4, stave5);393 var conn_brace = new Vex.Flow.StaveConnector(stave6, stave7);394 conn_single.setType(Vex.Flow.StaveConnector.type.SINGLE);395 conn_double.setType(Vex.Flow.StaveConnector.type.DOUBLE);396 conn_bracket.setType(Vex.Flow.StaveConnector.type.BRACKET);397 conn_brace.setType(Vex.Flow.StaveConnector.type.BRACE);398 conn_double.setText('Piano');399 conn_bracket.setText('Celesta');400 conn_brace.setText('Harpsichord');401 conn_single.setContext(ctx);402 conn_double.setContext(ctx);403 conn_bracket.setContext(ctx);404 conn_brace.setContext(ctx);405 stave.draw();406 stave2.draw();407 stave3.draw();408 stave4.draw();409 stave5.draw();410 stave6.draw();411 stave7.draw();412 conn_single.draw();413 conn_double.draw();414 conn_bracket.draw();415 conn_brace.draw();416 ok(true, "all pass");...
rect.debug.js
Source:rect.debug.js
1import * as src from "./rect.src.js";2import {assert, clearContext, setContext, optional} from "../../core/core.lib.js";3//Dot product4function dot(vec1, vec2) {5 setContext("dot(vec1, vec2)", arguments);6 assert.realArray("vec1");7 assert.realArray("vec2", vec1.length);8 clearContext();9 return src.dot(vec1, vec2);10}11function dot2(vec1, vec2) {12 setContext("dot2(vec1, vec2)", arguments);13 assert.realArray("vec1", 2);14 assert.realArray("vec2", 2);15 clearContext();16 return src.dot2(vec1, vec2);17}18function dot3(vec1, vec2) {19 setContext("dot3(vec1, vec2)", arguments);20 assert.realArray("vec1", 3);21 assert.realArray("vec2", 3);22 clearContext();23 return src.dot3(vec1, vec2);24}25function dot4(vec1, vec2) {26 setContext("dot4(vec1, vec2)", arguments);27 assert.realArray("vec1", 4);28 assert.realArray("vec2", 4);29 clearContext();30 return src.dot4(vec1, vec2);31}32//Cross product33function cross3(vec1, vec2, target) {34 setContext("cross3(vec1, vec2, ?target)", arguments);35 assert.realArray("vec1", 3);36 assert.realArray("vec2", 3);37 optional.target('target', 3);38 clearContext();39 return src.cross3(vec1, vec2, target);40}41//Addition42function add(vec1, vec2, target) {43 setContext("add(vec1, vec2, ?target)", arguments);44 assert.realArray("vec1");45 assert.realArray("vec2", vec1.length);46 optional.target('target', vec1.length);47 clearContext();48 return src.add(vec1, vec2, target);49}50function add2(vec1, vec2, target) {51 setContext("add2(vec1, vec2, ?target)", arguments);52 assert.realArray("vec1", 2);53 assert.realArray("vec2", 2);54 optional.target('target', 2);55 clearContext();56 return src.add2(vec1, vec2, target);57}58function add3(vec1, vec2, target) {59 setContext("add3(vec1, vec2, ?target)", arguments);60 assert.realArray("vec1", 3);61 assert.realArray("vec2", 3);62 optional.target('target', 3);63 clearContext();64 return src.add3(vec1, vec2, target);65}66function add4(vec1, vec2, target) {67 setContext("add4(vec1, vec2, ?target)", arguments);68 assert.realArray("vec1", 4);69 assert.realArray("vec2", 4);70 optional.target('target', 4);71 clearContext();72 return src.add4(vec1, vec2, target);73}74//Subtraction75function sub(vec1, vec2, target) {76 setContext("sub(vec1, vec2, ?target)", arguments);77 assert.realArray("vec1", 2);78 assert.realArray("vec2", vec1.length);79 optional.target('target', vec1.length);80 clearContext();81 return src.sub(vec1, vec2, target);82}83function sub2(vec1, vec2, target) {84 setContext("sub2(vec1, vec2, ?target)", arguments);85 assert.realArray("vec1", 2);86 assert.realArray("vec2", 2);87 optional.target('target', 2);88 clearContext();89 return src.sub2(vec1, vec2, target);90}91function sub3(vec1, vec2, target) {92 setContext("sub3(vec1, vec2, ?target)", arguments);93 assert.realArray("vec1", 3);94 assert.realArray("vec2", 3);95 optional.target('target', 3);96 clearContext();97 return src.sub3(vec1, vec2, target);98}99function sub4(vec1, vec2, target) {100 setContext("sub4(vec1, vec2, ?target)", arguments);101 assert.realArray("vec1", 4);102 assert.realArray("vec2", 4);103 optional.target('target', 4);104 clearContext();105 return src.sub4(vec1, vec2, target);106}107//Magnitude108function mag(vec) {109 setContext("mag(vec)", arguments);110 assert.realArray("vec");111 clearContext();112 return src.mag(vec);113}114function mag2(vec) {115 setContext("mag2(vec)", arguments);116 assert.realArray("vec", 2);117 clearContext();118 return src.mag2(vec);119}120function mag3(vec) {121 setContext("mag3(vec)", arguments);122 assert.realArray("vec", 3);123 clearContext();124 return src.mag3(vec);125}126function mag4(vec) {127 setContext("mag4(vec)", arguments);128 assert.realArray("vec", 4);129 clearContext();130 return src.mag4(vec);131}132//Scaling133function scale(vec, k, target) {134 setContext("scale(vec, k, ?target)", arguments);135 assert.realArray("vec");136 assert.realNumber("k");137 optional.target('target', vec.length);138 return src.scale(vec, k, target);139}140function scale2(vec, k, target) {141 setContext("scale2(vec, k, ?target)", arguments);142 assert.realArray("vec", 2);143 assert.realNumber("k");144 optional.target('target', 2);145 return src.scale2(vec, k, target);146}147function scale3(vec, k, target) {148 setContext("scale3(vec, k, ?target)", arguments);149 assert.realArray("vec", 3);150 assert.realNumber("k");151 optional.target('target', 3);152 return src.scale3(vec, k, target);153}154function scale4(vec, k, target) {155 setContext("scale4(vec, k, ?target)", arguments);156 assert.realArray("vec", 4);157 assert.realNumber("k");158 optional.target('target', 4);159 return src.scale4(vec, k, target);160}161function normalize(vec, target) { //'target' intentionally defaults to undefined162 setContext("normalize(vec, ?target)", arguments);163 assert.realArray("vec");164 optional.target('target', vec.length);165 return src.normalize(vec, target);166}167function normalize2(vec, target) {168 setContext("normalize2(vec, ?target)", arguments);169 assert.realArray("vec", 2);170 optional.target('target', 2);171 return src.normalize2(vec, target);172}173function normalize3(vec, target) {174 setContext("normalize3(vec, ?target)", arguments);175 assert.realArray("vec", 3);176 optional.target('target', 3);177 return src.normalize3(vec, target);178}179function normalize4(vec, target) {180 setContext("normalize4(vec, ?target)", arguments);181 assert.realArray("vec", 4);182 optional.target('target', 4);183 return src.normalize4(vec, target);184}185//Angles & rotations186function angle(vec1, vec2) {187 setContext("angle(vec1, vec2)", arguments);188 assert.realArray("vec1");189 assert.realArray("vec2", vec1.length);190 return src.angle(vec1, vec2);191}192function angle2(vec1, vec2) {193 setContext("angle2(vec1, vec2)", arguments);194 assert.realArray("vec1", 2);195 assert.realArray("vec2", 2);196 return src.angle2(vec1, vec2);197}198function angle3(vec1, vec2) {199 setContext("angle3(vec1, vec2)", arguments);200 assert.realArray("vec1", 3);201 assert.realArray("vec2", 3);202 return src.angle3(vec1, vec2);203}204function angle4(vec1, vec2) {205 setContext("angle4(vec1, vec2)", arguments);206 assert.realArray("vec1", 4);207 assert.realArray("vec2", 4);208 return src.angle4(vec1, vec2);209}210//Other component-wise operations211function fract(vec, target) {212 setContext("fract(vec, ?target)", arguments);213 assert.realArray("vec");214 optional.target("target", vec.length);215 return src.fract(vec, target);216}217function fract2(vec, target) {218 setContext("fract2(vec, ?target)", arguments);219 assert.realArray("vec", 2);220 optional.target("target", 2);221 return src.fract2(vec, target);222}223function fract3(vec, target) {224 setContext("fract3(vec, ?target)", arguments);225 assert.realArray("vec", 3);226 optional.target("target", 3);227 return src.fract3(vec, target);228}229function fract4(vec, target) {230 setContext("fract4(vec, ?target)", arguments);231 assert.realArray("vec", 4);232 optional.target("target", 4);233 return src.fract4(vec, target);234}235function toPolar2(vec, target) {236 setContext("polar2(vec, ?target)", arguments);237 assert.realArray("vec", 2);238 optional.target("target", 2);239 return src.toPolar2(vec, target);240}241// Freeze exports242Object.freeze(dot);243Object.freeze(dot2);244Object.freeze(dot3);245Object.freeze(dot4);246Object.freeze(cross3);247Object.freeze(add);248Object.freeze(add2);249Object.freeze(add3);250Object.freeze(add4);...
routes.ts
Source:routes.ts
1import { Application, Request, Response } from 'express';2import { Verify } from "../modules/auth/auth";34import Context from "../middleware/context.middleware";56import AddressCtrl from './../modules/address/controller';7import CityCtrl from './../modules/city/controller';8import CompanyCtrl from './../modules/company/controller';9import NoteCtrl from './../modules/note/controller';10import PersonCtrl from './../modules/person/controller';11import SaleCtrl from './../modules/sale/controller';12import StateCtrl from './../modules/state/controller';13import UserCtrl from './../modules/user/controller';1415export const AddressRoutes = (express: Application) => {16 express.route('/api/v1/address').all(Verify).post(Context.setContext, AddressCtrl.create);17 express.route('/api/v1/address/createbulk').all(Verify).post(Context.setContext, AddressCtrl.createBulk);1819 express.route('/api/v1/address/:id').all(Verify).put(Context.setContext, AddressCtrl.update);2021 express.route('/api/v1/address/:id').all(Verify).delete(Context.setContext, AddressCtrl.remove);22}2324export const CompanyRoutes = (express: Application) => {25 express.route('/api/v1/company/user').all(Verify).get(Context.setContext, CompanyCtrl.findByUserId);2627 express.route('/api/v1/company').all(Verify).post(Context.setContext, CompanyCtrl.create);28}2930export const NoteRoutes = (express: Application) => {31 express.route('/api/v1/note/person/:companyId/:personId').all(Verify).get(Context.setContext, NoteCtrl.findByPerson);32 express.route('/api/v1/note/company/:companyId').all(Verify).get(Context.setContext, NoteCtrl.findAll);3334 express.route('/api/v1/note').all(Verify).post(Context.setContext, NoteCtrl.create);3536 express.route('/api/v1/note/:id').all(Verify).put(Context.setContext, NoteCtrl.update);37}3839export const PersonRoutes = (express: Application) => {40 express.route('/api/v1/person/company/:companyId').get(Context.setContext, PersonCtrl.findAll);4142 express.route('/api/v1/person').all(Verify).post(Context.setContext, PersonCtrl.create);4344 express.route('/api/v1/person/:id').all(Verify).put(Context.setContext, PersonCtrl.update);45}4647export const SaleRoutes = (express: Application) => {48 express.route('/api/v1/sale/companies/:companyId?').all(Verify).get(Context.setContext, SaleCtrl.findAllCompanyUsers);4950 express.route('/api/v1/sale').all(Verify).post(Context.setContext, SaleCtrl.create);5152 express.route('/api/v1/sale/:id').all(Verify).put(Context.setContext, SaleCtrl.update);53}5455export const UserRoutes = (express: Application) => {56 express.route('/api/v1/user/username/:username').get(Context.setContext, UserCtrl.findByUsername);5758 express.route('/api/v1/user/email').post(Context.setContext, UserCtrl.findByEmail);59 express.route('/api/v1/user').post(Context.setContext, UserCtrl.create);60 express.route('/api/v1/user/auth').post(Context.setContext, UserCtrl.auth)6162 express.route('/api/v1/user').all(Verify).get(Context.setContext, UserCtrl.findById);6364 express.route('/api/v1/user').all(Verify).put(Context.setContext, UserCtrl.update);65 express.route('/api/v1/user/password').all(Verify).put(Context.setContext, UserCtrl.updatePassword);66}6768export const CityRoutes = (express: Application) => { 69 express.route('/api/v1/city').all(Verify).get(Context.setContext,CityCtrl.findAll)70}7172export const StateRoutes = (express: Application) => { 73 express.route('/api/v1/state').all(Verify).get(Context.setContext,StateCtrl.findAll)
...
examples.js
Source:examples.js
...24 * Front matter25 */26var context = new Context();27// context28// .setContext('defaults', 120)29// .setContext('.create()', 110)30// .setContext('.engine() locals', 100)31// .setContext('.engine() options', 90)32// .setContext('.engine()', 80)33// .setContext('page', 70)34// .setContext('partial', 60)35// .setContext('layout', 50)36// .setContext('front matter', 40)37// .setContext('template locals', 30)38// .setContext('template data', 20)39// .setContext('.compile()', 10)40// .setContext('.render()', 0)41// context42// .extendContext('defaults', {title: 'defaults'})43// .extendContext('.create()', {title: '.create()'})44// .extendContext('.engine() locals', {title: '.engine() locals'})45// .extendContext('.engine() options', {title: '.engine() options'})46// .extendContext('.engine()', {title: '.engine()'})47// .extendContext('page', {title: 'page'})48// .extendContext('partial', {title: 'partial'})49// .extendContext('layout', {title: 'layout'})50// .extendContext('front matter', {title: 'front matter'})51// .extendContext('template locals', {title: 'template locals'})52// .extendContext('template data', {title: 'template data'})53// .extendContext('.compile()', {title: '.compile()'})54// .extendContext('.render()', {title: '.render()'});55// // console.log(context.get());56// // console.log(context.calculate());57// // console.log(context.calculate(['defaults', 'data']));58// // console.log(context.sortedKeys());59// // context.reset('partial');60// // context.extendContext('partial', {});61// // var c = context.calculate(['defaults', 'data', 'partial'], {fn: sortDesc});62// // var c = context.calculate(['defaults', 'layout', '.render()'], sortDesc);63// // var c = context.calculate(['defaults', 'layout', '.render()']);64// // var c = context.calculate(sortAsc);65// var c = context.calculate();66// console.log(c);67context68 .setContext('a', 1)69 .setContext('b', 2)70 .setContext('c', 3)71 .setContext('d', 4)72 .setContext('e', 5)73context74 .extendContext('a', {title: 'a'})75 .extendContext('b', {title: 'b'})76 .extendContext('c', {title: 'c'})77 .extendContext('d', {title: 'd'})78 .extendContext('e', {title: 'e'});79var ctx = context.calculate(function (a, b) {80 return context.ctx[a] - context.ctx[b];81});...
Using AI Code Generation
1const { setContext } = require("qawolf");2setContext({ device: "iPhone X" });3const { setContext } = require("qawolf");4setContext({ device: "iPhone X" });5const { setContext } = require("qawolf");6setContext({ device: "iPhone X" });7const { setContext } = require("qawolf");8setContext({ device: "iPhone X" });9const { setContext } = require("qawolf");10setContext({ device: "iPhone X" });11const { setContext } = require("qawolf");12setContext({ device: "iPhone X" });13const { setContext } = require("qawolf");14setContext({ device: "iPhone X" });15const { setContext } = require("qawolf");16setContext({ device: "iPhone X" });17const { setContext } = require("qawolf");18setContext({ device: "iPhone X" });19const { setContext } = require("qawolf");20setContext({ device: "iPhone X" });21const { setContext } = require("qawolf");22setContext({ device: "iPhone X" });23const { setContext } = require("qawolf");24setContext({ device: "iPhone X" });25const { setContext } = require("qawolf");26setContext({ device: "iPhone X" });27const { setContext } = require("qawolf");28setContext({ device: "iPhone X" });29const { setContext } = require("qawolf");30setContext({ device: "iPhone X" });
Using AI Code Generation
1const { setContext } = require("qawolf");2setContext({ launchOptions: { headless: false } });3const qawolf = require("qawolf");4const browser = await qawolf.launch();5const page = await qawolf.createPage(browser);6await qawolf.stopVideos();7const qawolf = require("qawolf");8const browser = await qawolf.launch();9const page = await qawolf.createPage(browser);10await qawolf.stopVideos();11const qawolf = require("qawolf");12const browser = await qawolf.launch();13const page = await qawolf.createPage(browser);14await qawolf.stopVideos();15const qawolf = require("qawolf");16const browser = await qawolf.launch();17const page = await qawolf.createPage(browser);18await qawolf.stopVideos();19const qawolf = require("qawolf");20const browser = await qawolf.launch();21const page = await qawolf.createPage(browser);22await qawolf.stopVideos();23const qawolf = require("qawolf");24const browser = await qawolf.launch();25const page = await qawolf.createPage(browser);26await qawolf.stopVideos();27const qawolf = require("qawolf");28const browser = await qawolf.launch();29const page = await qawolf.createPage(browser);30await qawolf.stopVideos();31const qawolf = require("qawolf");32const browser = await qawolf.launch();33const page = await qawolf.createPage(browser);34await qawolf.stopVideos();35const qawolf = require("qawolf");36const browser = await qawolf.launch();
Using AI Code Generation
1const { setContext } = require("qawolf");2setContext({3 launchOptions: {4 }5});6const { create } = require("qawolf");7const browser = await create();8const page = await browser.newPage();9await page.type("#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input", "qawolf");10await page.click("#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input.gNO89b");11await page.waitForSelector("#rso > div:nth-child(1) > div > div > div > div > div.r > a > h3");12await page.click("#rso > div:nth-child(1) > div > div > div > div > div.r > a > h3");13await page.waitForSelector("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");14await page.click("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");15await page.waitForSelector("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");16await page.click("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");17await page.waitForSelector("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");18await page.click("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");19await page.waitForSelector("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");20await page.click("#main > div > div > div > div > div > div > div > div > div > div > div > div > div > h1");21await page.waitForSelector("#main
Using AI Code Generation
1const qawolf = require("qawolf");2const browser = await qawolf.launch();3await qawolf.createContext(browser, { name: "test context" });4await browser.close();5await qawolf.stopVideos();6const qawolf = require("qawolf");7const browser = await qawolf.launch();8await qawolf.createContext(browser, { name: "test context" });9await browser.close();10await qawolf.stopVideos();11## [Image: :point_right:] [Follow this link to view the full issue](github.com/qawolf/qawolf/issu...)
Using AI Code Generation
1const { setContext } = require('qawolf')2setContext({ page, browser })3const { test, expect } = require('@playwright/test');4test('example', async ({ page }) => {5 await page.fill('input[name="q"]', 'test');6 await page.press('input[name="q"]', 'Enter');7 await page.click('text="QA Wolf: Test automation for the modern web"');8 await page.click('text="Create a free account"');9 await page.fill('input[name="email"]', '
Using AI Code Generation
1const { setContext } = require("qawolf");2setContext({3 launchOptions: {4 },5});6const { setContext } = require("qawolf");7setContext({8 launchOptions: {9 },10});11const { setContext } = require("qawolf");12setContext({13 launchOptions: {14 },15});16const { setContext } = require("qawolf");17setContext({18 launchOptions: {19 },20});
Using AI Code Generation
1const { setContext } = require('qawolf');2setContext(context);3const { setContext } = require('qawolf');4setContext(context);5const { setContext } = require('qawolf');6setContext(context);7const { setContext } = require('qawolf');8setContext(context);9const { setContext } = require('qawolf');10setContext(context);11const { setContext } = require('qawolf');12setContext(context);13const { setContext } = require('qawolf');14setContext(context);15const { setContext } = require('qawolf');16setContext(context);17const { setContext } = require('qawolf');18setContext(context);19const { setContext } = require('qawolf');20setContext(context);21const { setContext } = require('qawolf');
Using AI Code Generation
1const { setContext } = require('qawolf');2setContext({3 extraHttpHeaders: {4 }5});6const qawolf = require('qawolf');7const browser = await qawolf.launch();8const page = await qawolf.createPage(browser);9await qawolf.stopVideos();10const { setContext } = require('qawolf');11setContext({12 extraHttpHeaders: {13 }14});15const qawolf = require('qawolf');16const browser = await qawolf.launch();17const page = await qawolf.createPage(browser);18await qawolf.stopVideos();19const { setContext } = require('qawolf');20setContext({21 extraHttpHeaders: {22 }23});24const qawolf = require('qawolf');25const browser = await qawolf.launch();26const page = await qawolf.createPage(browser);27await qawolf.stopVideos();28const { setContext } = require('qawolf');29setContext({30 extraHttpHeaders: {31 }32});33const qawolf = require('qawolf');34const browser = await qawolf.launch();35const page = await qawolf.createPage(browser);36await qawolf.stopVideos();37const { setContext } = require('qawolf');38setContext({39 extraHttpHeaders: {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!