Commit f48298a5 authored by Sean Hammond's avatar Sean Hammond

Remove $document global from tests

parent 99e96b4c
...@@ -15,6 +15,15 @@ function compileService() { ...@@ -15,6 +15,15 @@ function compileService() {
return $compile; return $compile;
} }
/** Return Angular's $document service. */
function documentService() {
var $document;
inject(function(_$document_) {
$document = _$document_;
});
return $document;
}
describe('annotation.js', function() { describe('annotation.js', function() {
describe('extractDocumentMetadata()', function() { describe('extractDocumentMetadata()', function() {
...@@ -289,7 +298,6 @@ describe('annotation.js', function() { ...@@ -289,7 +298,6 @@ describe('annotation.js', function() {
}); });
describe('AnnotationController', function() { describe('AnnotationController', function() {
var $document;
var $element; var $element;
var $q; var $q;
var $rootScope; var $rootScope;
...@@ -439,9 +447,8 @@ describe('annotation.js', function() { ...@@ -439,9 +447,8 @@ describe('annotation.js', function() {
beforeEach( beforeEach(
inject( inject(
function(_$document_, _$q_, _$rootScope_, _$timeout_, function(_$q_, _$rootScope_, _$timeout_,
_$window_) { _$window_) {
$document = _$document_;
$window = _$window_; $window = _$window_;
$q = _$q_; $q = _$q_;
$timeout = _$timeout_; $timeout = _$timeout_;
...@@ -836,7 +843,7 @@ describe('annotation.js', function() { ...@@ -836,7 +843,7 @@ describe('annotation.js', function() {
dialog.find('button').click(); dialog.find('button').click();
isolateScope.$digest(); isolateScope.$digest();
assert.ok(dialog.hasClass('open')); assert.ok(dialog.hasClass('open'));
$document.click(); documentService().click();
assert.notOk(dialog.hasClass('open')); assert.notOk(dialog.hasClass('open'));
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment