@@ -280,6 +280,38 @@ describe("angular.scenario.dsl", function() {
280
280
dealoc ( elm ) ;
281
281
} ) ;
282
282
283
+ it ( 'should execute dblclick' , function ( ) {
284
+ var clicked ;
285
+ // Hash is important, otherwise we actually
286
+ // go to a different page and break the runner
287
+ doc . append ( '<a href="#"></a>' ) ;
288
+ doc . find ( 'a' ) . dblclick ( function ( ) {
289
+ clicked = true ;
290
+ } ) ;
291
+ $root . dsl . element ( 'a' ) . dblclick ( ) ;
292
+ } ) ;
293
+
294
+ it ( 'should navigate page if dblclick on anchor' , function ( ) {
295
+ expect ( $window . location ) . not . toEqual ( '#foo' ) ;
296
+ doc . append ( '<a href="#foo"></a>' ) ;
297
+ $root . dsl . element ( 'a' ) . dblclick ( ) ;
298
+ expect ( $window . location ) . toMatch ( / # f o o $ / ) ;
299
+ } ) ;
300
+
301
+ it ( 'should not navigate if dblclick event was cancelled' , function ( ) {
302
+ var initLocation = $window . location ,
303
+ elm = jqLite ( '<a href="#foo"></a>' ) ;
304
+
305
+ doc . append ( elm ) ;
306
+ elm . bind ( 'dblclick' , function ( event ) {
307
+ event . preventDefault ( ) ;
308
+ } ) ;
309
+
310
+ $root . dsl . element ( 'a' ) . dblclick ( ) ;
311
+ expect ( $window . location ) . toBe ( initLocation ) ;
312
+ dealoc ( elm ) ;
313
+ } ) ;
314
+
283
315
it ( 'should count matching elements' , function ( ) {
284
316
doc . append ( '<span></span><span></span>' ) ;
285
317
$root . dsl . element ( 'span' ) . count ( ) ;
0 commit comments