From 4e8f0d6e9ff1b852de9de9da72d0fac138bcd1a7 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 15 Sep 2011 00:44:10 +0200 Subject: fix($location) $location specs must unbind document listener link rewriting used in html5 mode on legacy browsers binds to document.onClick - we need to destroy this listener after each test to prevent test collisions (global state is evil). --- test/service/locationSpec.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/service/locationSpec.js b/test/service/locationSpec.js index e798aa81..a312c1b2 100644 --- a/test/service/locationSpec.js +++ b/test/service/locationSpec.js @@ -17,6 +17,12 @@ function spyOnlyCallsWithArgs(obj, method) { describe('$location', function() { var url; + afterEach(function() { + // link rewriting used in html5 mode on legacy browsers binds to document.onClick, so we need + // to clean this up after each test. + jqLite(document).unbind('click'); + }); + describe('NewUrl', function() { beforeEach(function() { url = new LocationUrl('http://www.domain.com:9877/path/b?search=a&b=c&d#hash'); -- cgit v1.2.3