Skip to content

Commit

Permalink
add integration tests for new element methods
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Nov 7, 2016
1 parent 51d6f79 commit aa1d027
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion .eslintignore
@@ -1,4 +1,3 @@
build/
examples/
bin/
./*.js
2 changes: 2 additions & 0 deletions test/.eslintrc
Expand Up @@ -18,6 +18,8 @@
"chai-expect/no-inner-compare": [2]
},
"globals": {
"$": true,
"$$": true,
"browser": false,
"browserA": false,
"browserB": false,
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/specs/element.spec.js
Expand Up @@ -136,4 +136,18 @@ describe('element as first class citizen', () => {
'("#notExisting").')
})
})

describe('$ and $$ helper methods', () => {
it('should provide helper method $ to fetch single element', () => {
let header = $('header h1')
expect(header.getTagName()).to.be.equal('h1')
expect($('header h1').getTagName()).to.be.equal('h1')
})

it('should provide helper method $$ to fetch multiple elements', () => {
const colors = ['#ff0000', '#008000', '#ffff00', '#000000', '#800080']
$$('.box').forEach((box, i) => expect(box.getCssProperty('background').parsed.hex).to.be.equal(colors[i]))
expect(browser.elements('.box').getCssProperty('background').map((c) => c.parsed.hex)).to.be.deep.equal(colors)
})
})
})

0 comments on commit aa1d027

Please sign in to comment.