Skip to content

Commit 7b3cb27

Browse files
committed
update nightwatch-helpers
1 parent 04e2b53 commit 7b3cb27

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"karma-webpack": "^1.7.0",
7676
"lodash": "^4.13.1",
7777
"nightwatch": "^0.9.0",
78-
"nightwatch-helpers": "^1.0.0",
78+
"nightwatch-helpers": "^1.2.0",
7979
"phantomjs-prebuilt": "^2.1.1",
8080
"rollup": "^0.33.0",
8181
"rollup-plugin-alias": "^1.2.0",

test/e2e/specs/todomvc.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ module.exports = {
126126
// editing triggered by enter
127127
browser
128128
.dblClick('.todo label')
129-
enter('.todo:nth-child(1) .edit', 'edited again!')
129+
.enterValue('.todo:nth-child(1) .edit', 'edited again!')
130130
.assert.count('.todo.editing', 0)
131131
.assert.containsText('.todo:nth-child(1) label', 'edited again!')
132132

@@ -135,14 +135,14 @@ module.exports = {
135135
.dblClick('.todo label')
136136
.clearValue('.todo:nth-child(1) .edit')
137137
.setValue('.todo:nth-child(1) .edit', 'edited!')
138-
triggerKeyup('.todo:nth-child(1) .edit', 27)
138+
.trigger('.todo:nth-child(1) .edit', 'keyup', 27)
139139
.assert.count('.todo.editing', 0)
140140
.assert.containsText('.todo:nth-child(1) label', 'edited again!')
141141

142142
// empty value should remove
143143
browser
144144
.dblClick('.todo label')
145-
enter('.todo:nth-child(1) .edit', ' ')
145+
.enterValue('.todo:nth-child(1) .edit', ' ')
146146
.assert.count('.todo', 3)
147147

148148
// toggle all
@@ -154,23 +154,7 @@ module.exports = {
154154
.end()
155155

156156
function createNewItem (text) {
157-
return enter('.new-todo', text)
158-
}
159-
160-
function enter (selector, text) {
161-
browser
162-
.clearValue(selector)
163-
.setValue(selector, text)
164-
return triggerKeyup(selector, 13)
165-
}
166-
167-
function triggerKeyup (selector, code) {
168-
return browser.execute(function (selector, code) {
169-
var e = document.createEvent('HTMLEvents')
170-
e.initEvent('keyup', true, true)
171-
e.keyCode = code
172-
document.querySelector(selector).dispatchEvent(e)
173-
}, [selector, code])
157+
return browser.enterValue('.new-todo', text)
174158
}
175159

176160
function removeItemAt (n) {

0 commit comments

Comments
 (0)