@@ -126,7 +126,7 @@ module.exports = {
126
126
// editing triggered by enter
127
127
browser
128
128
. dblClick ( '.todo label' )
129
- enter ( '.todo:nth-child(1) .edit' , 'edited again!' )
129
+ . enterValue ( '.todo:nth-child(1) .edit' , 'edited again!' )
130
130
. assert . count ( '.todo.editing' , 0 )
131
131
. assert . containsText ( '.todo:nth-child(1) label' , 'edited again!' )
132
132
@@ -135,14 +135,14 @@ module.exports = {
135
135
. dblClick ( '.todo label' )
136
136
. clearValue ( '.todo:nth-child(1) .edit' )
137
137
. setValue ( '.todo:nth-child(1) .edit' , 'edited!' )
138
- triggerKeyup ( '.todo:nth-child(1) .edit' , 27 )
138
+ . trigger ( '.todo:nth-child(1) .edit' , 'keyup ', 27 )
139
139
. assert . count ( '.todo.editing' , 0 )
140
140
. assert . containsText ( '.todo:nth-child(1) label' , 'edited again!' )
141
141
142
142
// empty value should remove
143
143
browser
144
144
. dblClick ( '.todo label' )
145
- enter ( '.todo:nth-child(1) .edit' , ' ' )
145
+ . enterValue ( '.todo:nth-child(1) .edit' , ' ' )
146
146
. assert . count ( '.todo' , 3 )
147
147
148
148
// toggle all
@@ -154,23 +154,7 @@ module.exports = {
154
154
. end ( )
155
155
156
156
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 )
174
158
}
175
159
176
160
function removeItemAt ( n ) {
0 commit comments