aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPedro Del Gallego2012-08-29 15:39:34 +0200
committerMisko Hevery2012-09-06 16:06:24 -0700
commit8cb9c99ec064fd95567118d29bfa4a19b8613ab3 (patch)
treefafdbbe4de34497e5771265469af301f8570f96a /test
parent9473780e77a960ba27644ca76c2413924cc8972e (diff)
downloadangular.js-8cb9c99ec064fd95567118d29bfa4a19b8613ab3.tar.bz2
feat(scenario): add dblclick method to the ngScenario dsl
Diffstat (limited to 'test')
-rw-r--r--test/ngScenario/dslSpec.js32
1 files changed, 32 insertions, 0 deletions
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('<a href="#"></a>');
+ 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('<a href="#foo"></a>');
+ $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('<a href="#foo"></a>');
+
+ 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('<span></span><span></span>');
$root.dsl.element('span').count();