Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e8f0d6

Browse files
committed
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).
1 parent f9b6b61 commit 4e8f0d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/service/locationSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ function spyOnlyCallsWithArgs(obj, method) {
1717
describe('$location', function() {
1818
var url;
1919

20+
afterEach(function() {
21+
// link rewriting used in html5 mode on legacy browsers binds to document.onClick, so we need
22+
// to clean this up after each test.
23+
jqLite(document).unbind('click');
24+
});
25+
2026
describe('NewUrl', function() {
2127
beforeEach(function() {
2228
url = new LocationUrl('http://www.domain.com:9877/path/b?search=a&b=c&d#hash');

0 commit comments

Comments
 (0)