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).
This commit is contained in:
Igor Minar 2011-09-15 00:44:10 +02:00
parent f9b6b61468
commit 4e8f0d6e9f

View file

@ -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');