Commit 99e96b4c authored by Sean Hammond's avatar Sean Hammond

Remove $compile global from tests

parent cbb1d56d
...@@ -6,6 +6,15 @@ var events = require('../../events'); ...@@ -6,6 +6,15 @@ var events = require('../../events');
var module = angular.mock.module; var module = angular.mock.module;
var inject = angular.mock.inject; var inject = angular.mock.inject;
/** Return Angular's $compile service. */
function compileService() {
var $compile;
inject(function(_$compile_) {
$compile = _$compile_;
});
return $compile;
}
describe('annotation.js', function() { describe('annotation.js', function() {
describe('extractDocumentMetadata()', function() { describe('extractDocumentMetadata()', function() {
...@@ -280,7 +289,6 @@ describe('annotation.js', function() { ...@@ -280,7 +289,6 @@ describe('annotation.js', function() {
}); });
describe('AnnotationController', function() { describe('AnnotationController', function() {
var $compile;
var $document; var $document;
var $element; var $element;
var $q; var $q;
...@@ -311,7 +319,7 @@ describe('annotation.js', function() { ...@@ -311,7 +319,7 @@ describe('annotation.js', function() {
createDirective = function() { createDirective = function() {
$element = angular.element('<div annotation="annotation">'); $element = angular.element('<div annotation="annotation">');
$compile($element)($scope); compileService()($element)($scope);
$scope.$digest(); $scope.$digest();
var controller = $element.controller('annotation'); var controller = $element.controller('annotation');
isolateScope = $element.isolateScope(); isolateScope = $element.isolateScope();
...@@ -431,9 +439,8 @@ describe('annotation.js', function() { ...@@ -431,9 +439,8 @@ describe('annotation.js', function() {
beforeEach( beforeEach(
inject( inject(
function(_$compile_, _$document_, _$q_, _$rootScope_, _$timeout_, function(_$document_, _$q_, _$rootScope_, _$timeout_,
_$window_) { _$window_) {
$compile = _$compile_;
$document = _$document_; $document = _$document_;
$window = _$window_; $window = _$window_;
$q = _$q_; $q = _$q_;
...@@ -1235,15 +1242,6 @@ describe('annotation.js', function() { ...@@ -1235,15 +1242,6 @@ describe('annotation.js', function() {
beforeEach(module('h.templates')); beforeEach(module('h.templates'));
/** Return Angular's $compile service. */
function getCompileService() {
var $compile;
inject(function(_$compile_) {
$compile = _$compile_;
});
return $compile;
}
/** Return Angular's $rootScope. */ /** Return Angular's $rootScope. */
function getRootScope() { function getRootScope() {
var $rootScope; var $rootScope;
...@@ -1355,7 +1353,7 @@ describe('annotation.js', function() { ...@@ -1355,7 +1353,7 @@ describe('annotation.js', function() {
$provide.value('localStorage', locals.localStorage); $provide.value('localStorage', locals.localStorage);
}); });
locals.element = angular.element('<div annotation="annotation">'); locals.element = angular.element('<div annotation="annotation">');
var compiledElement = getCompileService()(locals.element); var compiledElement = compileService()(locals.element);
locals.$rootScope = getRootScope(); locals.$rootScope = getRootScope();
locals.parentScope = locals.$rootScope.$new(); locals.parentScope = locals.$rootScope.$new();
locals.parentScope.annotation = args.annotation || {}; locals.parentScope.annotation = args.annotation || {};
......
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