From 8cb9c99ec064fd95567118d29bfa4a19b8613ab3 Mon Sep 17 00:00:00 2001 From: Pedro Del Gallego Date: Wed, 29 Aug 2012 15:39:34 +0200 Subject: feat(scenario): add dblclick method to the ngScenario dsl --- test/ngScenario/dslSpec.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test') diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js index eef8c907..9c7893fd 100644 --- a/test/ngScenario/dslSpec.js +++ b/test/ngScenario/dslSpec.js @@ -280,6 +280,38 @@ describe("angular.scenario.dsl", function() { dealoc(elm); }); + it('should execute dblclick', function() { + var clicked; + // Hash is important, otherwise we actually + // go to a different page and break the runner + doc.append(''); + doc.find('a').dblclick(function() { + clicked = true; + }); + $root.dsl.element('a').dblclick(); + }); + + it('should navigate page if dblclick on anchor', function() { + expect($window.location).not.toEqual('#foo'); + doc.append(''); + $root.dsl.element('a').dblclick(); + expect($window.location).toMatch(/#foo$/); + }); + + it('should not navigate if dblclick event was cancelled', function() { + var initLocation = $window.location, + elm = jqLite(''); + + doc.append(elm); + elm.bind('dblclick', function(event) { + event.preventDefault(); + }); + + $root.dsl.element('a').dblclick(); + expect($window.location).toBe(initLocation); + dealoc(elm); + }); + it('should count matching elements', function() { doc.append(''); $root.dsl.element('span').count(); -- cgit v1.2.3