eslint for e2e tests

This commit is contained in:
Evan You 2015-07-02 21:04:38 +08:00
parent deac205843
commit 9291815f85
8 changed files with 27 additions and 26 deletions

View File

@ -14,7 +14,8 @@
"beforeEach": true,
"afterEach": true,
"spyOn": true,
"hasWarned": true
"hasWarned": true,
"casper": true
},
"rules": {

View File

@ -3,7 +3,7 @@ casper.on('remote.message', function (e) {
})
casper.test.begin('commits', 26, function (test) {
casper
.start('../../examples/commits/index.html')
.then(function () {
@ -45,4 +45,4 @@ casper.test.begin('commits', 26, function (test) {
test.done()
})
})
})

View File

@ -1,5 +1,5 @@
casper.test.begin('grid', 73, function (test) {
casper
.start('../../examples/grid/index.html')
.then(function () {
@ -104,11 +104,11 @@ casper.test.begin('grid', 73, function (test) {
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < columns.length; j++) {
test.assertSelectorHasText(
'tr:nth-child(' + (i+1) + ') td:nth-child(' + (j+1) + ')',
'tr:nth-child(' + (i + 1) + ') td:nth-child(' + (j + 1) + ')',
data[i][columns[j]]
)
}
}
}
})
})

View File

@ -1,5 +1,5 @@
casper.test.begin('markdown', 5, function (test) {
casper
.start('../../examples/markdown/index.html')
.then(function () {
@ -31,8 +31,8 @@ casper.test.begin('markdown', 5, function (test) {
.wait(300) // wait for debounce
.then(function () {
test.assertEval(function () {
return document.querySelector('textarea').value
=== '## yo\n\n- test\n- hi\n\n# hello'
return document.querySelector('textarea').value ===
'## yo\n\n- test\n- hi\n\n# hello'
})
test.assertEval(function () {
return document.querySelector('#editor div')
@ -47,4 +47,4 @@ casper.test.begin('markdown', 5, function (test) {
test.done()
})
})
})

View File

@ -2,7 +2,7 @@
// testing the content transclusion here
casper.test.begin('slider', 2, function (test) {
casper
.start('../../examples/slider/index.html')
.then(function () {
@ -24,4 +24,4 @@ casper.test.begin('slider', 2, function (test) {
test.done()
})
})
})

View File

@ -1,7 +1,7 @@
/* global stats, valueToPoint */
casper.test.begin('svg', 18, function (test) {
casper
.start('../../examples/svg/index.html')
.then(function () {
@ -56,4 +56,4 @@ casper.test.begin('svg', 18, function (test) {
test.done()
})
})
})

View File

@ -1,7 +1,7 @@
/* global __utils__ */
casper.test.begin('todomvc', 69, function (test) {
casper
.start('../../examples/todomvc/index.html')
.then(function () {
@ -36,7 +36,7 @@ casper.test.begin('todomvc', 69, function (test) {
test.assertVisible('#main', '#main should now be visible')
test.assertVisible('#footer', '#footer should now be visible')
test.assertNotVisible('#clear-completed', '#clear-completed should be hidden')
test.assertField({type:'css',path:'#new-todo'}, '', 'new todo input should be reset')
test.assertField({type: 'css', path: '#new-todo'}, '', 'new todo input should be reset')
})
@ -244,7 +244,7 @@ casper.test.begin('todomvc', 69, function (test) {
test.assertElementCount('.todo', 3, 'item should have been deleted')
})
//test toggle all
// test toggle all
.thenClick('#toggle-all', function () {
test.assertElementCount('.todo.completed', 3, 'should toggle all items to completed')
})
@ -265,8 +265,8 @@ casper.test.begin('todomvc', 69, function (test) {
}
casper.evaluate(function () {
// casper.mouseEvent can't set keyCode
var field = document.getElementById('new-todo'),
e = document.createEvent('HTMLEvents')
var field = document.getElementById('new-todo')
var e = document.createEvent('HTMLEvents')
e.initEvent('keyup', true, true)
e.keyCode = 13
field.dispatchEvent(e)
@ -275,8 +275,8 @@ casper.test.begin('todomvc', 69, function (test) {
function doubleClick (selector) {
casper.evaluate(function (selector) {
var el = document.querySelector(selector),
e = document.createEvent('MouseEvents')
var el = document.querySelector(selector)
var e = document.createEvent('MouseEvents')
e.initMouseEvent('dblclick', true, true, null, 1, 0, 0, 0, 0, false, false, false, false, 0, null)
el.dispatchEvent(e)
}, selector)
@ -284,8 +284,8 @@ casper.test.begin('todomvc', 69, function (test) {
function keyUp (code) {
casper.evaluate(function (code) {
var input = document.querySelector('.todo:nth-child(1) .edit'),
e = document.createEvent('HTMLEvents')
var input = document.querySelector('.todo:nth-child(1) .edit')
var e = document.createEvent('HTMLEvents')
e.initEvent('keyup', true, true)
e.keyCode = code
input.dispatchEvent(e)
@ -299,4 +299,4 @@ casper.test.begin('todomvc', 69, function (test) {
})
}
})
})

View File

@ -1,5 +1,5 @@
casper.test.begin('tree', 22, function (test) {
casper
.start('../../examples/tree/index.html')
.then(function () {
@ -52,4 +52,4 @@ casper.test.begin('tree', 22, function (test) {
test.done()
})
})
})