@@ -144,23 +144,27 @@ describe('ionList directive', function() {
144
144
} ) ;
145
145
146
146
it ( 'should watch ctrl.showDelete when true' , inject ( function ( $animate ) {
147
- var el = setup ( '' , '<div class="item-delete item-left-edit ng-hide"></div><div></div>' ) ;
147
+ var el = setup ( '' , '<div class="item-delete item-left-edit ng-hide"></div><div></div><div class="item-content"></div></div> ' ) ;
148
148
flush ( ) ;
149
149
150
150
spyOn ( el . controller ( 'ionList' ) , 'closeOptionButtons' ) ;
151
151
152
152
el . controller ( 'ionList' ) . showDelete ( true ) ;
153
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( true ) ;
153
154
el . scope ( ) . $apply ( ) ;
154
155
156
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( false ) ;
155
157
expect ( el . controller ( 'ionList' ) . closeOptionButtons ) . toHaveBeenCalled ( ) ;
156
158
var deleteButtons = angular . element ( el [ 0 ] . querySelectorAll ( '.item-delete.item-left-edit' ) ) ;
157
159
expect ( deleteButtons . length ) . not . toBe ( 0 ) ;
158
160
expect ( deleteButtons . hasClass ( 'ng-hide' ) ) . toBe ( false ) ;
159
161
expect ( el . children ( ) . hasClass ( 'list-left-editing' ) ) . toBe ( true ) ;
162
+ var content = angular . element ( el [ 0 ] . querySelectorAll ( '.item-content' ) ) ;
163
+ expect ( content . attr ( 'data-tap-disabled' ) ) . toEqual ( 'true' ) ;
160
164
} ) ) ;
161
165
162
166
it ( 'should watch ctrl.showDelete when false from true' , inject ( function ( $animate ) {
163
- var el = setup ( '' , '<div class="item-delete item-left-edit"></div><div></div>' ) ;
167
+ var el = setup ( '' , '<div class="item-delete item-left-edit"></div><div></div><div class="item-content"> ' ) ;
164
168
flush ( ) ;
165
169
166
170
spyOn ( el . controller ( 'ionList' ) , 'closeOptionButtons' ) ;
@@ -170,27 +174,34 @@ describe('ionList directive', function() {
170
174
el . controller ( 'ionList' ) . showDelete ( false ) ;
171
175
el . scope ( ) . $apply ( ) ;
172
176
177
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( true ) ;
173
178
expect ( el . controller ( 'ionList' ) . closeOptionButtons . callCount ) . toBe ( 1 ) ;
174
179
var deleteButtons = angular . element ( el [ 0 ] . querySelectorAll ( '.item-delete.item-left-edit' ) ) ;
175
180
expect ( deleteButtons . hasClass ( 'ng-hide' ) ) . toBe ( true ) ;
176
181
expect ( deleteButtons . length ) . not . toBe ( 0 ) ;
177
182
expect ( el . children ( ) . hasClass ( 'list-left-editing' ) ) . toBe ( false ) ;
183
+ var content = angular . element ( el [ 0 ] . querySelectorAll ( '.item-content' ) ) ;
184
+ expect ( content . attr ( 'data-tap-disabled' ) ) . toBeFalsy ( ) ;
178
185
} ) ) ;
179
186
180
187
it ( 'should watch ctrl.showReorder when true' , inject ( function ( $animate ) {
181
- var el = setup ( 'show-reorder="shouldReorder"' , '<div class="item-reorder item-right-edit ng-hide"></div><div></div>' ) ;
188
+ var el = setup ( 'show-reorder="shouldReorder"' , '<div class="item-reorder item-right-edit ng-hide"></div><div class="item-content"></div><div ></div>' ) ;
182
189
flush ( ) ;
183
190
184
191
spyOn ( el . controller ( 'ionList' ) , 'closeOptionButtons' ) ;
185
192
186
193
el . controller ( 'ionList' ) . showReorder ( true ) ;
194
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( true ) ;
187
195
el . scope ( ) . $apply ( ) ;
188
196
189
197
expect ( el . controller ( 'ionList' ) . closeOptionButtons ) . toHaveBeenCalled ( ) ;
198
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( false ) ;
190
199
var reorderButtons = angular . element ( el [ 0 ] . querySelectorAll ( '.item-reorder.item-right-edit' ) ) ;
191
200
expect ( reorderButtons . length ) . not . toBe ( 0 ) ;
192
201
expect ( reorderButtons . hasClass ( 'ng-hide' ) ) . toBe ( false ) ;
193
202
expect ( el . children ( ) . hasClass ( 'list-right-editing' ) ) . toBe ( true ) ;
203
+ var content = angular . element ( el [ 0 ] . querySelectorAll ( '.item-content' ) ) ;
204
+ expect ( content . attr ( 'data-tap-disabled' ) ) . toEqual ( 'true' ) ;
194
205
} ) ) ;
195
206
196
207
it ( 'should watch ctrl.showReorder when false from true' , inject ( function ( $animate ) {
@@ -204,11 +215,14 @@ describe('ionList directive', function() {
204
215
el . controller ( 'ionList' ) . showReorder ( false ) ;
205
216
el . scope ( ) . $apply ( ) ;
206
217
218
+ expect ( el . controller ( 'ionList' ) . canSwipeItems ( ) ) . toBe ( true ) ;
207
219
expect ( el . controller ( 'ionList' ) . closeOptionButtons . callCount ) . toBe ( 1 ) ;
208
220
var reorderButtons = angular . element ( el [ 0 ] . querySelectorAll ( '.item-reorder.item-right-edit' ) ) ;
209
221
expect ( reorderButtons . length ) . not . toBe ( 0 ) ;
210
222
expect ( reorderButtons . hasClass ( 'ng-hide' ) ) . toBe ( true ) ;
211
223
expect ( el . children ( ) . hasClass ( 'list-right-editing' ) ) . toBe ( false ) ;
224
+ var content = angular . element ( el [ 0 ] . querySelectorAll ( '.item-content' ) ) ;
225
+ expect ( content . attr ( 'data-tap-disabled' ) ) . toBeFalsy ( ) ;
212
226
} ) ) ;
213
227
} ) ;
214
228
0 commit comments