diff options
Diffstat (limited to 'test/scenario/dslSpec.js')
| -rw-r--r-- | test/scenario/dslSpec.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js index 411320e8..29956801 100644 --- a/test/scenario/dslSpec.js +++ b/test/scenario/dslSpec.js @@ -4,13 +4,14 @@ describe("angular.scenario.dsl", function() { var $window, $root; var application, eventLog; - beforeEach(function() { + beforeEach(inject(function($injector) { eventLog = []; $window = { - document: _jQuery("<div></div>"), + document: jqLite('<div class="document"></div>'), angular: new angular.scenario.testing.MockAngular() }; - $root = angular.injector('NG')('$rootScope'); + $window.document.data('$injector', $injector); + $root = $injector('$rootScope'); $root.emit = function(eventName) { eventLog.push(eventName); }; @@ -45,6 +46,10 @@ describe("angular.scenario.dsl", function() { // Just use the real one since it delegates to this.addFuture $root.addFutureAction = angular.scenario. SpecRunner.prototype.addFutureAction; + })); + + afterEach(function(){ + jqLite($window.document).removeData('$injector'); }); describe('Pause', function() { @@ -201,11 +206,14 @@ describe("angular.scenario.dsl", function() { // ex. jQuery('#foo').find('[name="bar"]') // fails // ex. jQuery('#foo [name="bar"]') // works, wtf? // - beforeEach(function() { + beforeEach(inject(function($injector) { doc = _jQuery('<div id="angular-scenario-binding"></div>'); _jQuery(document.body).html('').append(doc); - $window.document = window.document; - }); + + dealoc($window.document); // we are about to override it + $window.document = window.document; + jqLite($window.document).data('$injector', $injector); + })); afterEach(function() { _jQuery(document.body). |
