const pubsub = require('./pubsub.js);
class A{
async start( ) {
//some code
pubsub.publish('something');
}
}
module.export = A;
//testfile.js
const pubsub = require('./pubsub);
const A = require('./fileUnderTest.js');
//Inside describe and it
sinon.stub(pubsub, 'publish')
A.start( );
expect(pubsub.publish.calledOnce).to.be.true;
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Transparent Search Box</title>
<link rel="stylesheet" href="searchbox.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css">
</head>
<body>
<div class="wrapper">
<div class="search_box">
<input type="text" placeholder="Search a word here/so`zni bu yerda izla">
<i class="fas fa-search"></i>
</div>
</div>
<div class="div"></div>
</body>
</html>
@import url('https://fonts.googleapis.com/css?family=Roboto');
*{
margin: 0;
padding: 0;
font-family: 'Roboto', sans-serif;
}
.wrapper{
background: url("images/bg.png") no-repeat center ;
width: 100%;
height: 100vh;
background-size: cover;
display: flex;
justify-content: center;
}
.search_box{
width: 50%;
position: relative;
}
.search_box input[type="text"]{
width: 100%;
padding: 20px;
padding-right: 80px;
box-sizing: border-box;
background: rgba(0,0,0,0.3);
border: 2px solid #fff;
border-radius: 10px;
font-size: 18px;
color: #fff;
outline: none;
}
.fa-search{
position: absolute;
transform: translateY(-50%);
right: 25px;
color: #fff;
font-size: 25px;
justify-content: center;
margin-top: 34px;
}
::-webkit-input-placeholder {
/ Chrome/Opera/Safari /
color: #fff;
}
::-moz-placeholder {
/ Firefox 19+ /
color: #fff;
}
:-ms-input-placeholder {
/ IE 10+ /
color: #fff;
}
@media screen and (max-width: 425px){
.search_box{
width: 95%;
}
}
.div {
width: 100%;
padding: 20px;
padding-right: 80px;
box-sizing: border-box;
background: rgba(0,0,0,0.3);
border: 2px solid #fff;
border-radius: 10px;
font-size: 18px;
color: #fff;
outline: none;
width: 100%;
padding: 20px;
padding-right: 80px;
box-sizing: border-box;
background: rgba(0,0,0,0.3);
}
Hi, I am doing a freeCodeCamp challenge. I have got a simple question but I do no understand something in the below function. why var testArr is given in the challenge but then in the function is given as arr and not as testArr? Sorry I know it might sound to simple for all of you. function nextInLine(arr, item) {
arr.push(item);
let removed = arr.shift();
return removed;
}
var testArr = [1,2,3,4,5];
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));