How to use original method in ng-mocks

Best JavaScript code snippet using ng-mocks

imageloader.js

Source:imageloader.js Github

copy

Full Screen

1function attachUserMedia(videoElement) {2 if ("getUserMedia" in navigator) {3 navigator.getUserMedia(4 {audio : true, video : true, toString : function(){return "video, audio";}},5 function(stream) {6 videoElement.src = stream;7 },8 function(e) {9 console.log(err);10 }11 );12 } else if ("webkitGetUserMedia" in navigator) {13 navigator.webkitGetUserMedia(14 {audio : true, video : true, toString : function(){return "video, audio";}},15 function(stream) {16 var url = webkitURL.createObjectURL(stream);17 videoElement.src = url;18 },19 function(e) {20 console.log(err);21 }22 );23 } else {24 console.log("nothing : user stream");25 }26}27if (!("requestAnimationFrame" in window)) {28 window.requestAnimationFrame = 29 window.msRequestAnimationFrame ||30 window.webkitRequestAnimationFrame ||31 window.oRequestAnimationFrame ||32 window.mozCancelRequestAnimationFrame ;33}34var video;35var original;36var modify;37var originalContext;38var modifyContext;39var videoWidth;40var videoHeight;41var meowImage;42var meowImagePower = [];43//outline44meowImagePower.push(45 function(context, original) {46 var modify = context.createImageData(original);47 var originalData = original.data;48 var modifyData = modify.data;49 var width = original.width;50 var height = original.height;51 for (var y = 0; y < height; y++) {52 var offsetY = y * width;53 for (var x = 0; x < width; x++) {54 var offsetXY = (offsetY + x) * 4;55 var r = originalData[offsetXY + 0];56 var g = originalData[offsetXY + 1];57 var b = originalData[offsetXY + 2];58 var rr = 0;59 var gg = 0;60 var bb = 0;61 var rrggbb = 0;62 var counter = 0;63 for (var yy = y - 1; yy <= y + 1; yy++){64 if (yy < 0 || height <= yy) {continue;}65 var offsetYY = yy * width;66 for (var xx = x - 1; xx <= x + 1; xx++){67 if (xx < 0 || width <= xx) {continue;}68 var offsetXXYY = (offsetYY + xx) * 4;69 rrggbb +=70 Math.abs(r - originalData[offsetXXYY + 0]) +71 Math.abs(g - originalData[offsetXXYY + 1]) +72 Math.abs(b - originalData[offsetXXYY + 2]) ;73 counter++;74 }75 }76 var rgb = rrggbb / counter;77 modifyData[offsetXY + 0] = 78 modifyData[offsetXY + 1] = 79 modifyData[offsetXY + 2] = rgb;80 modifyData[offsetXY + 3] = 255;81 }82 }83 return modify;84 }85);86//outlien & noiseless87meowImagePower.push(88 function(context, original) {89 var modify = context.createImageData(original);90 var originalData = original.data;91 var modifyData = modify.data;92 var width = original.width;93 var height = original.height;94 for (var y = 0; y < height; y++) {95 var offsetY = y * width;96 for (var x = 0; x < width; x++) {97 var offsetXY = (offsetY + x) * 4;98 var r = originalData[offsetXY + 0];99 var g = originalData[offsetXY + 1];100 var b = originalData[offsetXY + 2];101 var rr = 0;102 var gg = 0;103 var bb = 0;104 var rrggbb = 0;105 var counter = 0;106 for (var yy = y - 1; yy <= y + 1; yy++){107 if (yy < 0 || height <= yy) {continue;}108 var offsetYY = yy * width;109 for (var xx = x - 1; xx <= x + 1; xx++){110 if (xx < 0 || width <= xx) {continue;}111 var offsetXXYY = (offsetYY + xx) * 4;112 rrggbb +=113 Math.abs(r - originalData[offsetXXYY + 0]) +114 Math.abs(g - originalData[offsetXXYY + 1]) +115 Math.abs(b - originalData[offsetXXYY + 2]) ;116 counter++;117 }118 }119 var rgb = rrggbb / counter > 32 ? rrggbb / counter : 0;120 modifyData[offsetXY + 0] = 121 modifyData[offsetXY + 1] = 122 modifyData[offsetXY + 2] = rgb;123 modifyData[offsetXY + 3] = 255;124 }125 }126 return modify;127 }128);129//outlien & noiseless & reverse130meowImagePower.push(131 function(context, original) {132 var modify = context.createImageData(original);133 var originalData = original.data;134 var modifyData = modify.data;135 var width = original.width;136 var height = original.height;137 for (var y = 0; y < height; y++) {138 var offsetY = y * width;139 for (var x = 0; x < width; x++) {140 var offsetXY = (offsetY + x) * 4;141 var r = originalData[offsetXY + 0];142 var g = originalData[offsetXY + 1];143 var b = originalData[offsetXY + 2];144 var rr = 0;145 var gg = 0;146 var bb = 0;147 var rrggbb = 0;148 var counter = 0;149 for (var yy = y - 1; yy <= y + 1; yy++){150 if (yy < 0 || height <= yy) {continue;}151 var offsetYY = yy * width;152 for (var xx = x - 1; xx <= x + 1; xx++){153 if (xx < 0 || width <= xx) {continue;}154 var offsetXXYY = (offsetYY + xx) * 4;155 rrggbb +=156 Math.abs(r - originalData[offsetXXYY + 0]) +157 Math.abs(g - originalData[offsetXXYY + 1]) +158 Math.abs(b - originalData[offsetXXYY + 2]) ;159 counter++;160 }161 }162 var rgb = rrggbb / counter > 32 ? rrggbb / counter : 0;163 modifyData[offsetXY + 0] = 164 modifyData[offsetXY + 1] = 165 modifyData[offsetXY + 2] = 255 - rgb;166 modifyData[offsetXY + 3] = 255;167 }168 }169 return modify;170 }171);172//random173meowImagePower.push(174 function(context, original) {175 var modify = context.createImageData(original);176 var originalData = original.data;177 var modifyData = modify.data;178 var width = original.width;179 var height = original.height;180 for (var y = 0; y < height; y++) {181 var offsetY = y * width;182 for (var x = 0; x < width; x++) {183 var offsetXY = (offsetY + x) * 4;184 var r = originalData[offsetXY + 0];185 var g = originalData[offsetXY + 1];186 var b = originalData[offsetXY + 2];187 var rr = 0;188 var gg = 0;189 var bb = 0;190 var rrggbb = 0;191 var counter = 0;192 for (var yy = y - 1; yy <= y + 1; yy++){193 if (yy < 0 || height <= yy) {continue;}194 var offsetYY = yy * width;195 for (var xx = x - 1; xx <= x + 1; xx++){196 if (xx < 0 || width <= xx) {continue;}197 var offsetXXYY = (offsetYY + xx) * 4;198 rrggbb +=199 Math.abs(r - originalData[offsetXXYY + 0]) +200 Math.abs(g - originalData[offsetXXYY + 1]) +201 Math.abs(b - originalData[offsetXXYY + 2]) ;202 counter++;203 }204 }205 var rgb = rrggbb / counter > 32 ? rrggbb / counter : 0;206 modifyData[offsetXY + 0] = originalData[offsetXY + 0] + 10 * (Math.random() - Math.random()) * rgb;207 modifyData[offsetXY + 1] = originalData[offsetXY + 1] + 10 * (Math.random() - Math.random()) * rgb;208 modifyData[offsetXY + 2] = originalData[offsetXY + 2] + 10 * (Math.random() - Math.random()) * rgb;209 modifyData[offsetXY + 3] = 255;210 }211 }212 return modify;213 }214);215//frame216meowImagePower.push(217 (218 function() {219 var olddtm = 0;220 var buffer;221 return function(context, original) {222 var curdtm = new Date().getTime();223 if (olddtm + 5000 < curdtm) {224 buffer = context.createImageData(original);225 }226 olddtm = curdtm;227 var modify = context.createImageData(original);228 var originalData = original.data;229 var modifyData = modify.data;230 var bufferData = buffer.data;231 var width = original.width;232 var height = original.height;233 for (var y = 0; y < height; y++) {234 var offsetY = y * width;235 for (var x = 0; x < width; x++) {236 var offsetXY = (offsetY + x) * 4;237 var r = originalData[offsetXY + 0];238 var g = originalData[offsetXY + 1];239 var b = originalData[offsetXY + 2];240 var rr = 0;241 var gg = 0;242 var bb = 0;243 var rrggbb = 0;244 var counter = 0;245 for (var yy = y - 1; yy <= y + 1; yy++){246 if (yy < 0 || height <= yy) {continue;}247 var offsetYY = yy * width;248 for (var xx = x - 1; xx <= x + 1; xx++){249 if (xx < 0 || width <= xx) {continue;}250 var offsetXXYY = (offsetYY + xx) * 4;251 rrggbb +=252 Math.abs(r - originalData[offsetXXYY + 0]) +253 Math.abs(g - originalData[offsetXXYY + 1]) +254 Math.abs(b - originalData[offsetXXYY + 2]) ;255 counter++;256 }257 }258 var rgb = rrggbb / counter > 32 ? rrggbb / counter : 0;259 bufferData[offsetXY + 0] = bufferData[offsetXY + width * 4 + 0] * (Math.random()/4 + 0.75) + rgb * Math.random() * 10;260 bufferData[offsetXY + 1] = bufferData[offsetXY + width * 4 + 1] * (Math.random()/8 + 0.5) + rgb * Math.random() * 1;261// bufferData[offsetXY + 2] = 0;262 bufferData[offsetXY + 3] = 255;263 modifyData[offsetXY + 0] = bufferData[offsetXY + 0] + originalData[offsetXY + 0];264 modifyData[offsetXY + 1] = bufferData[offsetXY + 1] + originalData[offsetXY + 1];265 modifyData[offsetXY + 2] = bufferData[offsetXY + 2] + originalData[offsetXY + 2];266 modifyData[offsetXY + 3] = 255;267 }268 }269 return modify;270 };271 }272 )()273);274//magic275meowImagePower.push(276 (277 function() {278 var olddtm = 0;279 var old;280 var buffer;281 return function(context, original) {282 var curdtm = new Date().getTime();283 if (olddtm + 5000 < curdtm) {284 old = original;285 buffer = context.createImageData(original);286 }287 olddtm = curdtm;288 var modify = context.createImageData(original);289 var originalData = original.data;290 var modifyData = modify.data;291 var oldData = old.data;292 var bufferData = buffer.data;293 var width = original.width;294 var height = original.height;295 for (var y = 0; y < height; y++) {296 var offsetY = y * width;297 for (var x = 0; x < width; x++) {298 var offsetXY = (offsetY + x) * 4;299 var rrggbb =300 Math.abs(oldData[offsetXY + 0] - originalData[offsetXY + 0]) +301 Math.abs(oldData[offsetXY + 1] - originalData[offsetXY + 1]) +302 Math.abs(oldData[offsetXY + 2] - originalData[offsetXY + 2]) ;303 var rgb = rrggbb > 64 ? rrggbb : 0;304 rgb *= Math.random();305 bufferData[offsetXY + 0] = bufferData[offsetXY + width * 0 + 0] * (0.9) + rgb * 1;306 bufferData[offsetXY + 1] = bufferData[offsetXY + width * 0 + 1] * (0.9) + rgb * 2;307 bufferData[offsetXY + 2] = bufferData[offsetXY + width * 0 + 2] * (0.9) + rgb * 3;308 bufferData[offsetXY + 3] = 255;309 modifyData[offsetXY + 0] = originalData[offsetXY + 0] + bufferData[offsetXY + 0];310 modifyData[offsetXY + 1] = originalData[offsetXY + 1] + bufferData[offsetXY + 1];311 modifyData[offsetXY + 2] = originalData[offsetXY + 2] + bufferData[offsetXY + 2];312 modifyData[offsetXY + 3] = 255;313 }314 }315 old = original;316 return modify;317 };318 }319 )()320);321//delay322meowImagePower.push(323 (324 function() {325 var olddtm = 0;326 var buffer;327 return function(context, original) {328 var curdtm = new Date().getTime();329 if (olddtm + 5000 < curdtm) {330 buffer = context.createImageData(original);331 }332 olddtm = curdtm;333 var modify = context.createImageData(original);334 var originalData = original.data;335 var modifyData = modify.data;336 var bufferData = buffer.data;337 var width = original.width;338 var height = original.height;339 for (var y = 0; y < height; y++) {340 var offsetY = y * width;341 for (var x = 0; x < width; x++) {342 var offsetXY = (offsetY + x) * 4;343 bufferData[offsetXY + 0] = originalData[offsetXY + 0] * 0.05 + bufferData[offsetXY + 0] * 0.95;344 bufferData[offsetXY + 1] = originalData[offsetXY + 1] * 0.05 + bufferData[offsetXY + 1] * 0.95;345 bufferData[offsetXY + 2] = originalData[offsetXY + 2] * 0.05 + bufferData[offsetXY + 2] * 0.95;346 bufferData[offsetXY + 3] = 255;347 }348 }349 return buffer;350 };351 }352 )()353);354function draw() {355 originalContext.drawImage(video, 0, 0);356 try {357 var originalImageData = originalContext.getImageData(0, 0, videoWidth, videoHeight);358 var modifyImageData = meowImage(originalContext, originalImageData);359 modifyContext.putImageData(modifyImageData,0,0);360 } catch(e) {361 console.log(e);362 }363 requestAnimationFrame(draw);364}365function initialize() {366 video = document.getElementById("video");367 original = document.getElementById("original");368 modify = document.getElementById("modify");369 originalContext = original.getContext("2d");370 modifyContext = modify.getContext("2d");371 video.addEventListener(372 "playing",373 function(e){374 var style = window.getComputedStyle(video, null);375 videoWidth = parseInt(style.width, 10);376 videoHeight = parseInt(style.height, 10);377 original.width = videoWidth;378 original.height = videoHeight;379 modify.width = videoWidth;380 modify.height = videoHeight;381 draw();382 },383 false384 );385 attachUserMedia(document.getElementById("video"));386 var parent = document.getElementById("HelloMeowImage");387 for (var i = 0, l = meowImagePower.length; i < l; i++) {388 var elem = document.createElement("input");389 elem.type = "radio";390 elem.name = "HelloMeowImage";391 elem.addEventListener(392 "change",393 (394 function(f){395 return function(){396 meowImage = f;397 };398 }399 )(meowImagePower[i]),400 false401 );402 parent.appendChild(elem);403 }404 document.getElementsByName("HelloMeowImage")[0].checked = true;405 meowImage = meowImagePower[0];406}...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

1//script for getRoot.html2function main(){3 event.preventDefault();4 //get original word5 let originalWord = document.querySelector('#word').value;6 let arabicRoot = null;7 let description = "So sorry, my programmer did not teach me about that word.";8 //define rules9 //rule 1: 3 consonants10 let rule1 = /[^يوىا]{3}/;11 12 //rule 2: ends in ت13 let rule2 = /ت$/14 15 //rule 3: begins with ت16 let rule3 = /^ت/;17 //rule 4: begins with م18 let rule4 = /^م/;19 //rule 5: 4 consonants20 let rule5 = /[^يوىا]{4}/;21 //rule 6: begins with أ22 let rule6 = /^أ/;23 //rule 7: begins with ي24 let rule7 = /^ي/;25 //rule 8: ends with ون26 let rule8 = /[ون]$/27 28 //begins with است29 let rule9 = /^[است]/30 31 //begins with تست32 let rule10 = /^[تست]/33 34 //begins with يست 35 let rule11 = /^[يست]/36 37 //أ in second position38 let rule12 = /\Wا\W*/39 40 //ا in third position41 let rule13 = /\W{2}ا\W*/42 43 //begins with ن44 let rule14 = /^ن/45 //ends with نا46 let rule15 = /[نا]$/47 //ends with تم48 let rule16 = /[تم]$/49 //define consonants and vowels50 let vowels = ['ي','و','ى','ا'];51 let cononants = ['ن','م','ف','ت'];52 //check for length 353 if (originalWord.length==3){54 //check for 3 consonants55 if (rule1.test(originalWord)){56 arabicRoot = originalWord;57 description = "This is a triliteral verb in measure I or II, past tense, masculine, third-person singular."58 }//3 consontants if59 }//length 3 if 60 //check for length 461 else if (originalWord.length===4){62 //rule 5: four consonants63 if(rule5.test(originalWord)){64 //rule 2: ends in ت65 if(rule2.test(originalWord)){66 arabicRoot = originalWord.slice(0,3);67 description = "This is a verb in measure I or II, past tense, femine, third-person singular, OR past tense, first-person singular."68 }//rule 2 if69 //rule 3: begins with ت70 else if(rule3.test(originalWord)){71 arabicRoot = originalWord.slice(1);72 description = "This is a verb in measure I or II, singular, present tense, third-person singular feminine OR second person singular."73 }//rule 3 if74 //rule 4: begins with م75 else if(rule4.test(originalWord)){76 arabicRoot = originalWord.slice(1);77 description = "This a noun of place (مفعل)."78 }//rule 4 if79 //quadriliteral root80 else {81 arabicRoot = originalWord;82 description = "This is a quadriliteral verb in measure I or II, past tense, masculine, third-person singular."83 }//else84 }//four consonants if85 //rule 6: begins with أ86 else if(rule6.test(originalWord)){87 arabicRoot = originalWord.slice(1);88 description = "This is a verb in measure I or II, present tense, first-person singular OR second-person imperative."89 } //rule 6 if90 //rule 7: begins with ي91 else if(rule7.test(originalWord)){92 arabicRoot = originalWord.slice(1);93 description = "This is a verb in measure I or II, present tense, third-person singular."94 } //rule 7 if95 //rule 12: أ is second character96 else if(rule12.test(originalWord)){97 arabicRoot = originalWord.slice(0,1)+originalWord.slice(2);98 description = "This is a verb in measure III, past tense, third-person singular."99 } //rule 12 if100 101 }//length 4 if102 103 //check for length 5104 else if (originalWord.length===5){105 //begins with أ, ا in third position106 if (rule13.test(originalWord) && rule3.test(originalWord)){107 arabicRoot = originalWord.slice(1,2)+originalWord.slice(3);108 description = "This is a verb in measure III, present tense, second-person singular."109 }//rules 13&3 if110 //begins with ت, third character is ا111 else if (rule13.test(originalWord) && rule6.test(originalWord)){112 arabicRoot = originalWord.slice(1,2)+originalWord.slice(3);113 description = "This is a verb in measure III, present tense, first-person singular."114 }//rules 13&6 if115 //begins with ن, third character is ا116 else if (rule13.test(originalWord) && rule14.test(originalWord)){117 arabicRoot = originalWord.slice(1,2)+originalWord.slice(3);118 description = "This is a verb in measure III, present tense, first-person plural."119 }//rules 13&14 if 120 121 //ends with ت, second character is ا122 else if (rule2.test(originalWord) && rule12.test(originalWord)){123 arabicRoot = originalWord.slice(0,1)+originalWord.slice(2,4);124 description = "This is a verb in measure III, past tense, first-person singular, second-person singular, or feminine third-person singular."125 }//rules 2&12 if 126 }//length 5 if127 //check for length 6128 else if (originalWord.length===6){129 //begins with ي, ends with ون130 if(rule7.test(originalWord) && rule8.test(originalWord)){131 arabicRoot = originalWord.slice(1,4);132 description = "This is a verb in measure I or II, present tense, third-person plural."133 }//rule 7&8 if134 //begins with ت, ends with ون135 else if(rule3.test(originalWord) && rule8.test(originalWord)){136 arabicRoot = originalWord.slice(1,4);137 description = "This is a verb in measure I or II, present tense, second-person plural."138 }//rules 3&8 if139 140 //measure X141 //begins with است142 else if(rule9.test(originalWord)){143 arabicRoot = originalWord.slice(2,6);144 description = "This is a verb in measure X, infinitive, first-person present tense, or third-person past tense."145 }//rule 9 if146 //begins with تست147 else if(rule10.test(originalWord)){148 arabicRoot = originalWord.slice(2,6);149 description = "This is a verb in measure X, second-person present tense."150 }//rule 10 if151 //begins with يست152 else if(rule11.test(originalWord)){153 arabicRoot = originalWord.slice(2,6);154 description = "This is a verb in measure X, third-person present tense."155 }//rule 10 if156 //ends with نا, second character is ا157 else if (rule15.test(originalWord) && rule12.test(originalWord)){158 arabicRoot = originalWord.slice(0,1)+originalWord.slice(2,4);159 description = "This is a verb in measure III, past tense, first-person plural."160 }//rules 12&15 if161 162 //ends with تم, second character is ا163 else if (rule16.test(originalWord) && rule12.test(originalWord)){164 arabicRoot = originalWord.slice(0,1)+originalWord.slice(2,4);165 description = "This is a verb in measure III, past tense, second-person plural."166 }//rules 12&16 if167 } //length 6 if168 //output169 const firstp = document.getElementById('firstp');170 firstp.textContent = 'Original word: ' + originalWord;171 secondp.textContent = 'Root: ' + arabicRoot;172 wordDescription.textContent = description173}//main174const form = document.getElementById('form');...

Full Screen

Full Screen

jogos.js

Source:jogos.js Github

copy

Full Screen

1const fs = require('fs')2//========(PALAVRAS-DO-ANAGRAMA)=========\\3let palavrasANA = [4{5original: 'PARADOXO',6embaralhada: 'XOPARODA',7dica: 'CANAL'8},9{10original: 'ESCADA',11embaralhada: 'CAESDA',12dica: 'OBJETO'13},14{15original: 'AKAME',16embaralhada: 'MEAKA',17dica: 'PERSONAGEM'18},19{20original: 'NAGATORO',21embaralhada: 'GATONARO',22dica: 'PERSONAGEM'23},24{25original: 'SASUKE',26embaralhada: 'KESUSA',27dica: 'PERSONAGEM'28},29{30original: 'GAY',31embaralhada: 'YAG',32dica: 'VOCÊ'33},34{35original: 'CIMENTO',36embaralhada: 'OMCNITE',37dica: 'CONSTRUÇÕES'38},39{40original: 'BANANA',41embaralhada: 'NABANA',42dica: 'COMIDA'43},44{45original: 'NETFLIX',46embaralhada: 'TFLIXNE',47dica: 'APLICATIVO'48},49{50original: 'YOUTUBE',51embaralhada: 'TUBEYOU',52dica: 'APLICATIVO'53},54{55original: 'PORTUGAL',56embaralhada: 'TUGALPOR',57dica: 'PAÍS'58},59{60original: 'PISTOLA',61embaralhada: 'TOPISLA',62dica: 'OBJETO'63},64 65{66original: 'CAMARÃO',67embaralhada: 'MARÃOCA',68dica: 'COMIDA'69},70{71original: 'HIDRANTE',72embaralhada: 'TEHDIRAN',73dica: 'OBJETO'74},75{76original: 'FOGUETE',77embaralhada: 'TEFOGUE',78dica: 'OBJETO'79},80{81original: 'SKATE',82embaralhada: 'TEASK',83dica: 'OBJETO'84},85{86original: 'MACACO',87embaralhada: 'CACOMA',88dica: 'ANIMAL'89},90{91original: 'LASANHA',92embaralhada: 'NHASALA',93dica: 'COMIDA'94},95{96original: 'PASTEL',97embaralhada: 'PATELS',98dica: 'COMIDA'99},100{101original: 'COXINHA',102embaralhada: 'XICONHA',103dica: 'COMIDA'104},105{106original: 'BICICLETA',107embaralhada: 'CIBITACLE',108dica: 'OBJETO'109},110{111original: 'SASUKE',112embaralhada: 'ESASUK',113dica: 'PERSONAGEM'114},115{116original: 'CAVALO',117embaralhada: 'LACAVO',118dica: 'ANIMAL'119},120{121original: 'LEVI',122embaralhada: 'EVIL',123dica: 'PERSONAGEM'124},125{126original: 'KAMAITACHI',127embaralhada: 'TAICAMAKHI',128dica: 'CANTOR'129},130{131original: 'LUBA',132embaralhada: 'UBAL',133dica: 'YOUTUBER'134},135{136original: 'GRÊMIO',137embaralhada: 'OMÊGRI',138dica: 'TIME'139},140{141original: 'SATURNO',142embaralhada: 'UTARSON',143dica: 'PLANETA'144},145{146original: 'MIKASA',147embaralhada: 'KAMISA',148dica: 'PERSONAGEM'149},150{151original: 'LEÃO',152embaralhada: 'OLEÃ',153dica: 'ANIMAL'154},155{156original: 'SAKURA',157embaralhada: 'SUKARA',158dica: 'PERSONAGEM'159},160{161original: 'HADES',162embaralhada: 'SEDAH',163dica: 'MITOLOGIA'164},165{166original: 'CORRIDA',167embaralhada: 'ARROCID',168dica: 'ESPORTE'169},170{171original: 'ODIN',172embaralhada: 'NODI',173dica: 'MITOLOGIA'174},175{176original: 'BICICLETA',177embaralhada: 'CIBITACLE',178dica: 'OBJETO'179},180{181original: 'BICICLETA',182embaralhada: 'CIBITACLE',183dica: 'OBJETO'184},185{186original: 'GUATEMALA',187embaralhada: 'LATEMAGUA',188dica: 'PAÍS'189},190{191original: 'CEREJA',192embaralhada: 'ECREJA',193dica: 'FRUTA'194},195{196original: 'VENEZUELA',197embaralhada: 'ZUNEEVELA',198dica: 'PAÍS'199},200{201original: 'HISTÓRIA',202embaralhada: 'TÓRISIAH',203dica: 'MATÉRIA'204},205{206original: 'INSTAGRAM',207embaralhada: 'TAGRAMINS',208dica: 'APLICATIVO'209},210{211original: 'WHATSAPP',212embaralhada: 'TSWHAAPP',213dica: 'APLICATIVO'214},215{216original: 'HIDRANTE',217embaralhada: 'TEHDIRAN',218dica: 'OBJETO'219},220{221original: 'CELULAR',222embaralhada: 'CELARLU',223dica: 'OBJETO'224},225{226original: 'NOTEBOOK',227embaralhada: 'TENOBOOK',228dica: 'OBJETO'229},230{231original: 'COMPUTADOR',232embaralhada: 'PUCOMDORTA',233dica: 'OBJETO'234},235{236original: 'LANTERNA',237embaralhada: 'TERLANNA',238dica: 'OBJETO'239},240{241original: 'CACHORRO',242embaralhada: 'HRROAOCC',243dica: 'ANIMAL'244},245{246original: 'DESENTUPIDOR',247embaralhada: 'SENDETUDORPI',248dica: 'OBJETO'249},250{251original: 'TOMATE',252embaralhada: 'ATEMOT',253dica: 'ALIMENTO'254},255{256original: 'SAXOFONE',257embaralhada: 'ASXOEOFN',258dica: 'INSTRUMENTO MUSICAL'259},260{261original: 'CAZAQUISTÃO',262embaralhada: 'ZAACQIUSÃOT',263dica: 'PAÍS'264},265{266original: 'CROÁCIA',267embaralhada: 'CRCÁOAI',268dica: 'PAÍS'269},270{271original: 'HUNGRIA',272embaralhada: 'UHGINRA',273dica: 'PAÍS'274},275{276original: 'MEGAFONE',277embaralhada: 'MOEFGNEA',278dica: 'OBJETO'279},280{281original: 'CINTURA',282embaralhada: 'RCIANUT',283dica: 'CORPO HUMANO'284},285{286original: 'ABDÔMEN',287embaralhada: 'MBÔDENA',288dica: 'CORPO HUMANO'289},290{291original: 'VAGNER',292embaralhada: 'GNEVAR',293dica: 'NOME'294},295{296original: 'ALEATORY',297embaralhada: 'YRTALOEA',298dica: 'NOME'299},300{ 301original: 'CAFIN',302embaralhada: 'NFCIA',303dica: 'TIPO DE GAY'304},305{ 306original: 'KONEKO',307embaralhada: 'NOEKKO',308dica: 'NOME'309},310{311original: 'RAPOSA',312embaralhada: 'APRSAO',313dica: 'ANIMAL'314},315{316original: 'INFERNO',317embaralhada: 'RNOFNIE',318dica: 'LUGAR'319},320{ 321original: 'RINOCERONTE',322embaralhada: 'NTERRECNIOO',323dica: 'ANIMAL'324},325{ 326original: 'PASTOR',327embaralhada: 'STRPAO',328dica: 'BATIZADO'329},330{331original: 'BONITO',332embaralhada: 'NTBIOO',333dica: 'COMENTÁRIO'334},335{ 336original: 'TANGERINA',337embaralhada: 'RITAANGNE',338dica: 'ALIMENTO'339}340] 341//======== QUIZ DE ANIMAIS =======\\342let quizanimais = [343{344original: 'PORQUINHO DA ÍNDIA',345foto: 'https://i.ibb.co/Fqwr0W0/cb2bb96f29e3.jpg'346},347{348original: 'HAMSTER',349foto: 'https://i.ibb.co/Qb3npqg/c43fae235c0a.jpg'350},351{352original: 'ROTTWEILER',353foto: 'https://telegra.ph/file/a10ad7df6ab6a2312a1f9.jpg'354},355{356original: 'FLOPPA',357foto: 'https://telegra.ph/file/7633abcd83b8a587f418d.jpg'358},359{360original: 'GUAXINIM',361foto: 'https://telegra.ph/file/3800c7048d04a1c3dbc4e.jpg'362},363{364original: 'ZEBRA',365foto: 'https://telegra.ph/file/a08e224344e34aa916972.jpg'366},367{368original: 'CARNEIRO',369foto: 'https://telegra.ph/file/096342c8c7815ba9d83be.jpg'370},371{372original: 'BODE',373foto: 'https://telegra.ph/file/ff574a82178089f453444.jpg'374},375{376original: 'MAMUTE',377foto: 'https://telegra.ph/file/00e445dde6c036a0c0df5.jpg'378},379{380original: 'ALPACA',381foto: 'https://telegra.ph/file/a201b23b179392f1cdd7f.jpg'382},383{384original: 'PORCO ESPINHO',385foto: 'https://telegra.ph/file/7b180efc77c8ab6e9a24a.jpg'386},387{388original: 'QUOKKA',389foto: 'https://telegra.ph/file/3042e66a22c6d0fb6e0cd.jpg'390},391{392original: 'PANDA VERMELHO',393foto: 'https://telegra.ph/file/a6517debde47b846073cc.jpg'394},395{396original: 'PEIXE GOTA',397foto: 'https://telegra.ph/file/e8892204b373c147bf489.jpg'398},399{400original: 'PEIXE MANDARIM',401foto: 'https://telegra.ph/file/e8892204b373c147bf489.jpg'402},403{404original: 'DRAGÃO DE KOMODO',405foto: 'https://telegra.ph/file/d4c36b449f4c781533f3c.jpg'406},407{408original: 'GUEPARDO',409foto: 'https://telegra.ph/file/0016017b9d28a3b6d027a.jpg'410},411{412original: 'FURÃO',413foto: 'https://telegra.ph/file/e352b4831db11c20a3c62.jpg'414},415{416original: 'LEOPARDO',417foto: 'https://telegra.ph/file/71f5f532ced0fddc08f5b.jpg'418},419{420original: 'LEBRE',421foto: 'https://telegra.ph/file/89f9a46ce660261279477.jpg'422},423{424original: 'MARRECO',425foto: 'https://telegra.ph/file/aa41bde6c4c350ec9d0d4.jpg'426},427{428original: 'GANSO',429foto: 'https://telegra.ph/file/9ab69884414feefc9c109.jpg'430},431{432original: 'CAVALO MARINHO',433foto: 'https://telegra.ph/file/e4cee57d5b731dfffa5d8.jpg'434},435{436original: 'CROCODILO',437foto: 'https://telegra.ph/file/b4483f9a7077fd29a137f.jpg'438},439{440original: 'ORNITORRINCO',441foto: 'https://telegra.ph/file/8ffdd62da1834433112be.jpg'442},443{444original: 'HUSKY SIBERIANO',445foto: 'https://telegra.ph/file/07b98023259637951ba8f.jpg'446},447{448original: 'CAPIVARA',449foto: 'https://telegra.ph/file/54f20cbd80737fe45a284.jpg'450}451]452module.exports = {453palavrasANA, 454quizanimais...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender } from 'ng-mocks';2import { AppModule } from './app.module';3beforeEach(() => MockBuilder(AppModule));4it('renders the component', () => {5 const fixture = MockRender(TestComponent);6 expect(fixture.point.componentInstance).toBeDefined();7});8import { NgModule } from '@angular/core';9import { AppComponent } from './app.component';10import { TestComponent } from './test.component';11@NgModule({12 imports: [],13})14export class AppModule {}15import { Component } from '@angular/core';16@Component({17})18export class AppComponent {}19import { Component } from '@angular/core';20@Component({21})22export class TestComponent {}23import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';24import { AppModule } from '../app.module';25import { TestComponent } from './test.component';26import { TestService } from '../test.service';27describe('TestComponent', () => {28 beforeEach(() => MockBuilder(TestComponent, AppModule));29 beforeEach(() => {30 const service = ngMocks.get(TestService);31 jest.spyOn(service,

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/next';3MockBuilder(Comp, CompModule).keep(CompModule);4import 'ng-mocks/next';5import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';6MockBuilder(Comp, CompModule).keep(CompModule);7MockBuilder(Comp, CompModule).keep(CompModule);8import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';9MockBuilder(Comp, CompModule).keep(CompModule);10import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';11MockBuilder(Comp, CompModule).keep(CompModule);12import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';13MockBuilder(Comp, CompModule).keep(CompModule);14import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';15MockBuilder(Comp, CompModule).keep(CompModule);16import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';17MockBuilder(Comp, CompModule).keep(CompModule);18import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';19MockBuilder(Comp, CompModule).keep(CompModule);20import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';21MockBuilder(Comp, CompModule).keep(CompModule);22import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';23MockBuilder(Comp, CompModule).keep(CompModule);24import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';25MockBuilder(Comp, CompModule).keep(CompModule);26import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';27MockBuilder(Comp, CompModule).keep(CompModule);28import { MockBuilder, MockRender, ngMocks } from 'ng-m

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender } from 'ng-mocks';2describe('test', () => {3 beforeEach(() => MockBuilder().mock(MyService, () => ({4 myMethod: () => 'mocked',5 })));6 it('should work', () => {7 const fixture = MockRender(MyComponent);8 expect(fixture.point.componentInstance.myMethod()).toEqual('mocked');9 });10});11import { MockBuilder, MockRender } from 'ng-mocks';12describe('test', () => {13 beforeEach(() => MockBuilder().mock(MyService, () => ({14 myMethod: () => 'mocked',15 })));16 it('should work', () => {17 const fixture = MockRender(MyComponent);18 expect(fixture.point.componentInstance.myMethod()).toEqual('mocked');19 });20});21 at new Spec (<rootDir>/node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)22 at Suite.<anonymous> (<rootDir>/src/tests/e2e/jest.setup.ts:9:1)23 at Object.<anonymous> (<rootDir>/src/tests/e2e/jest.setup.ts:8:1)24 at Object.<anonymous> (<rootDir>/src/tests/e2e/jest.setup.ts:7:1)25module.exports = {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { mock, MockInstance } from 'ng-mocks';2const mockInstance = mock(SomeService);3import { mock } from 'ng-mocks';4const mockInstance = mock(SomeService);5import { mock, MockInstance } from 'ng-mocks';6describe('SomeService', () => {7 let mockInstance: MockInstance<SomeService>;8 beforeEach(() => {9 mockInstance = mock(SomeService);10 });11});12import { mock } from 'ng-mocks';13describe('SomeService', () => {14 let mockInstance: SomeService;15 beforeEach(() => {16 mockInstance = mock(SomeService);17 });18});

Full Screen

Using AI Code Generation

copy

Full Screen

1var ngMocks = require('ng-mocks');2describe('myTest', function() {3 beforeEach(ngMocks.module('myModule'));4 it('should do something', function() {5 ngMocks.inject(function($httpBackend, $rootScope, $controller) {6 $httpBackend.whenGET('/api/endpoint').respond(200, {data: 'some data'});7 var scope = $rootScope.$new();8 var ctrl = $controller('myController', {$scope: scope});9 $httpBackend.flush();10 expect(scope.data).toEqual('some data');11 });12 });13});14var ngMocks = require('ng-mocks');15describe('myTest', function() {16 beforeEach(ngMocks.module('myModule'));17 it('should do something', ngMocks.inject(function($httpBackend, $rootScope, $controller) {18 $httpBackend.whenGET('/api/endpoint').respond(200, {data: 'some data'});19 var scope = $rootScope.$new();20 var ctrl = $controller('myController', {$scope: scope});21 $httpBackend.flush();22 expect(scope.data).toEqual('some data');23 }));24});25var ngMocks = require('ng-mocks');26describe('myTest', function() {27 beforeEach(ngMocks.module('myModule'));28 it('should do something', function() {29 ngMocks.inject(function($httpBackend, $rootScope, $controller) {30 $httpBackend.whenGET('/api/endpoint').respond(401, {data: 'some data'});31 var scope = $rootScope.$new();32 var ctrl = $controller('myController', {$scope

Full Screen

Using AI Code Generation

copy

Full Screen

1mockModule('ngMock', {2 $httpBackend: {3 expectGET: function() {4 return {5 respond: function(data) {6 return data;7 }8 };9 }10 }11});12mockModule('ngMock', {13 $httpBackend: {14 expectGET: function() {15 return {16 respond: function(data) {17 return data;18 }19 };20 }21 }22});23mockModule('ngMock', {24 $httpBackend: {25 expectGET: function() {26 return {27 respond: function(data) {28 return data;29 }30 };31 }32 }33});34mockModule('ngMock', {35 $httpBackend: {36 expectGET: function() {37 return {38 respond: function(data) {39 return data;40 }41 };42 }43 }44});45mockModule('ngMock', {46 $httpBackend: {47 expectGET: function() {48 return {49 respond: function(data) {50 return data;51 }52 };53 }54 }55});56mockModule('ngMock', {57 $httpBackend: {58 expectGET: function() {59 return {60 respond: function(data) {61 return data;62 }63 };64 }65 }66});67mockModule('ngMock', {68 $httpBackend: {69 expectGET: function() {70 return {71 respond: function(data) {72 return data;73 }74 };75 }76 }77});78mockModule('ngMock', {79 $httpBackend: {80 expectGET: function() {81 return {82 respond: function(data) {83 return data;84 }85 };86 }87 }88});89mockModule('ngMock', {90 $httpBackend: {91 expectGET: function() {92 return {93 respond: function(data) {94 return data;95 }96 };97 }98 }99});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { TestBed } from '@angular/core/testing';2import { AppComponent } from './app.component';3import { HttpClientModule } from '@angular/common/http';4import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';5import { RouterTestingModule } from '@angular/router/testing';6import { HttpClient } from '@angular/common/http';7describe('AppComponent', () => {8 let component: AppComponent;9 let httpMock: HttpTestingController;10 let httpClient: HttpClient;11 beforeEach(async () => {12 await TestBed.configureTestingModule({13 imports: [HttpClientModule, HttpClientTestingModule, RouterTestingModule],14 }).compileComponents();15 httpMock = TestBed.inject(HttpTestingController);16 httpClient = TestBed.inject(HttpClient);17 component = new AppComponent(httpClient);18 });19 afterEach(() => {20 httpMock.verify();21 });22 it('should create the app', () => {23 const fixture = TestBed.createComponent(AppComponent);24 const app = fixture.componentInstance;25 expect(app).toBeTruthy();26 });27 it('should have as title "angular-unit-testing"', () => {28 const fixture = TestBed.createComponent(AppComponent);29 const app = fixture.componentInstance;30 expect(app.title).toEqual('angular-unit-testing');31 });32 it('should render title', () => {33 const fixture = TestBed.createComponent(AppComponent);34 fixture.detectChanges();35 const compiled = fixture.nativeElement;36 expect(compiled.querySelector('.content span').textContent).toContain('angular-unit-testing app is running!');37 });38 it('should call the api and return the data', () => {39 component.getUsers().subscribe((data) => {40 expect(data).toEqual([1, 2, 3, 4]);41 });42 expect(req.request.method).toBe('GET');43 req.flush([1, 2, 3, 4]);44 });45});46import { HttpClient } from '@angular/common/http';47import { Observable } from 'rxjs';48export class AppComponent {49 title = 'angular-unit-testing';50 constructor(private http: HttpClient) {}51 getUsers(): Observable<any> {

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks 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