@@ -105,7 +105,7 @@ module.exports = {
105
105
. dblClick ( '.todo:nth-child(1) label' )
106
106
. assert . count ( '.todo.editing' , 1 )
107
107
. assert . focused ( '.todo:nth-child(1) .edit' )
108
- . clearValue ( '.todo:nth-child(1) .edit' )
108
+ deleteValue ( '.todo:nth-child(1) .edit' , 'test2 ')
109
109
. setValue ( '.todo:nth-child(1) .edit' , 'edited!' )
110
110
. click ( 'footer' ) // blur
111
111
. assert . count ( '.todo.editing' , 0 )
@@ -114,14 +114,15 @@ module.exports = {
114
114
// editing triggered by enter
115
115
browser
116
116
. dblClick ( '.todo label' )
117
+ deleteValue ( '.todo:nth-child(1) .edit' , 'edited!' )
117
118
. enterValue ( '.todo:nth-child(1) .edit' , 'edited again!' )
118
119
. assert . count ( '.todo.editing' , 0 )
119
120
. assert . containsText ( '.todo:nth-child(1) label' , 'edited again!' )
120
121
121
122
// cancel
122
123
browser
123
124
. dblClick ( '.todo label' )
124
- . clearValue ( '.todo:nth-child(1) .edit' )
125
+ deleteValue ( '.todo:nth-child(1) .edit' , 'edited again! ')
125
126
. setValue ( '.todo:nth-child(1) .edit' , 'edited!' )
126
127
. trigger ( '.todo:nth-child(1) .edit' , 'keyup' , 27 )
127
128
. assert . count ( '.todo.editing' , 0 )
@@ -130,6 +131,7 @@ module.exports = {
130
131
// empty value should remove
131
132
browser
132
133
. dblClick ( '.todo label' )
134
+ deleteValue ( '.todo:nth-child(1) .edit' , 'edited again!' )
133
135
. enterValue ( '.todo:nth-child(1) .edit' , ' ' )
134
136
. assert . count ( '.todo' , 3 )
135
137
@@ -150,5 +152,9 @@ module.exports = {
150
152
. moveToElement ( '.todo:nth-child(' + n + ')' , 10 , 10 )
151
153
. click ( '.todo:nth-child(' + n + ') .destroy' )
152
154
}
155
+
156
+ function deleteValue ( el , text ) {
157
+ return browser . setValue ( el , text . split ( '' ) . map ( ( ) => '\u0008' ) )
158
+ }
153
159
}
154
160
}
0 commit comments