Comments (2)
describe('index', () => {
describe('getFirstSelector(selector)', () => {
it('returns the first element that matches the selector', () => {
expect(getFirstSelector('div').id).toEqual('nested')
expect(getFirstSelector('.ranked-list')).toEqual(document.querySelector('.ranked-list'))
})
})
describe('nestedTarget()', () => {
it('pulls a .target out of #nested', () => {
expect(nestedTarget()).toEqual(document.querySelector('#nested .target'))
})
})
describe('deepestChild()', () => {
it('returns the most deeply nested child in #grand-node', () => {
console.log(deepestChild().innerHTML)
expect(deepestChild()).toEqual(document.querySelector('#grand-node div div div div'))
})
})
describe('increaseRankBy(n)', () => {
it('increases ranks in .ranked-list by n', () => {
increaseRankBy(3)
const rankedLists = document.querySelectorAll('.ranked-list')
const firstList = rankedLists[0]
const secondList = rankedLists[1]
let children = firstList.children
let start = 1
expect(children.length).toEqual(2);
for (let i = 0, l = children.length; i < l; i++) {
expect(parseInt(children[i].innerHTML)).toEqual(start + i + 3)
}
children = secondList.children
start = 12
expect(children.length).toEqual(3);
for (let i = 0, l = children.length; i < l; i++) {
expect(parseInt(children[i].innerHTML)).toEqual(start - i + 3)
}
})
})
})
from javascript-hide-and-seek.
Furthermore, when testing in the Learn IDE, .toEqual()
needs to be changed back to .to.equal()
for learn test
and learn submit
to run.
from javascript-hide-and-seek.
Related Issues (20)
- Yarn Error HOT 1
- Feedback on 4th bullet / task HOT 1
- div#grand-node HOT 1
- open index.html command doesn't word in the ide's command line HOT 1
- Open command doesn't work with in browser IDE HOT 1
- mocha.run() doesn't pass tests even though they pass when running learn HOT 2
- "before all" hook Uncaught SecrityError: localStorage is not available for opaque origins HOT 5
- Syntax error in test causes failures for working code. HOT 2
- Test Error HOT 1
- Bad link in Git instructions for standalone editors HOT 1
- Suggestion for In-Browser Learn IDE users starting httpserver HOT 1
- How to restore // ♥ prompt to terminal after creating server with "httpserver"? HOT 1
- Confusing Examples HOT 1
- Creating and Inserting Nodes Lab
- Instructions after httpserver HOT 1
- Open IDE Button Not Working
- Console.log not printing to the console HOT 1
- redacted
- Specs do not match readme HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript-hide-and-seek.