diff options
| author | Misko Hevery | 2012-01-06 18:10:47 -0800 |
|---|---|---|
| committer | Misko Hevery | 2012-01-10 22:27:00 -0800 |
| commit | 5143e7bf065a3cbdf8400cf095b653d51bc83b8f (patch) | |
| tree | 980149c365d4cb5586d27975d26366a25ff7be6a /test/scenario | |
| parent | afd25446d23f24872eb20ac79c8fbd2cff203ef0 (diff) | |
| download | angular.js-5143e7bf065a3cbdf8400cf095b653d51bc83b8f.tar.bz2 | |
feat(module): new module loader
Diffstat (limited to 'test/scenario')
| -rw-r--r-- | test/scenario/ApplicationSpec.js | 4 | ||||
| -rw-r--r-- | test/scenario/RunnerSpec.js | 4 | ||||
| -rw-r--r-- | test/scenario/dslSpec.js | 36 | ||||
| -rw-r--r-- | test/scenario/e2e/widgets.html | 4 |
4 files changed, 16 insertions, 32 deletions
diff --git a/test/scenario/ApplicationSpec.js b/test/scenario/ApplicationSpec.js index 86023438..7384ecaa 100644 --- a/test/scenario/ApplicationSpec.js +++ b/test/scenario/ApplicationSpec.js @@ -116,7 +116,7 @@ describe('angular.scenario.Application', function() { var called, polled; var handlers = []; var testWindow = { - document: jqLite('<div class="test-foo"></div>'), + document: jqLite('<div class="test-foo" ng-app></div>')[0], angular: { element: jqLite, service: {} @@ -125,7 +125,7 @@ describe('angular.scenario.Application', function() { $browser.notifyWhenNoOutstandingRequests = function(fn) { handlers.push(fn); }; - testWindow.document.data('$injector', $injector); + jqLite(testWindow.document).data('$injector', $injector); app.getWindow_ = function() { return testWindow; }; diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js index 8d1f832d..15bcc4b0 100644 --- a/test/scenario/RunnerSpec.js +++ b/test/scenario/RunnerSpec.js @@ -46,8 +46,8 @@ describe('angular.scenario.Runner', function() { runner.createSpecRunner_ = function(scope) { return scope.$new(MockSpecRunner); }; - runner.on('SpecError', angular.module.ngMock.rethrow); - runner.on('StepError', angular.module.ngMock.rethrow); + runner.on('SpecError', angular.mock.rethrow); + runner.on('StepError', angular.mock.rethrow); }); afterEach(function() { diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js index 1b0d613c..79d479bb 100644 --- a/test/scenario/dslSpec.js +++ b/test/scenario/dslSpec.js @@ -7,10 +7,10 @@ describe("angular.scenario.dsl", function() { beforeEach(inject(function($injector) { eventLog = []; $window = { - document: jqLite('<div class="document"></div>'), + document: window.document.body, angular: new angular.scenario.testing.MockAngular() }; - $window.document.data('$injector', $injector); + jqLite($window.document).data('$injector', $injector).attr('ng-app', '').addClass('html'); $root = $injector.get('$rootScope'); $root.emit = function(eventName) { eventLog.push(eventName); @@ -35,7 +35,7 @@ describe("angular.scenario.dsl", function() { return fn.call($root).apply($root, arguments); }; }); - $root.application = new angular.scenario.Application($window.document); + $root.application = new angular.scenario.Application(jqLite($window.document)); $root.application.getWindow_ = function() { return $window; }; @@ -46,6 +46,7 @@ describe("angular.scenario.dsl", function() { // Just use the real one since it delegates to this.addFuture $root.addFutureAction = angular.scenario. SpecRunner.prototype.addFutureAction; + jqLite($window.document).html(''); })); afterEach(function(){ @@ -202,27 +203,10 @@ describe("angular.scenario.dsl", function() { describe('Element Finding', function() { var doc; - //TODO(esprehn): Work around a bug in jQuery where attribute selectors - // only work if they are executed on a real document, not an element. - // - // ex. jQuery('#foo').find('[name="bar"]') // fails - // ex. jQuery('#foo [name="bar"]') // works, wtf? - // beforeEach(inject(function($injector) { - doc = _jQuery('<div id="angular-scenario-binding"></div>'); - _jQuery(document.body).html('').append(doc); - - dealoc($window.document); // we are about to override it - $window.document = window.document; - jqLite($window.document).data('$injector', $injector); + doc = _jQuery($window.document).append('<div class="body"></div>').find('.body'); })); - afterEach(function() { - _jQuery(document.body). - find('#angular-scenario-binding'). - remove(); - }); - describe('Select', function() { it('should select single option', function() { doc.append( @@ -232,7 +216,7 @@ describe("angular.scenario.dsl", function() { '</select>' ); $root.dsl.select('test').option('A'); - expect(_jQuery('[ng\\:model="test"]').val()).toEqual('A'); + expect(doc.find('[ng\\:model="test"]').val()).toEqual('A'); }); it('should select option by name', function() { @@ -243,7 +227,7 @@ describe("angular.scenario.dsl", function() { '</select>' ); $root.dsl.select('test').option('one'); - expect(_jQuery('[ng\\:model="test"]').val()).toEqual('A'); + expect(doc.find('[ng\\:model="test"]').val()).toEqual('A'); }); it('should select multiple options', function() { @@ -255,7 +239,7 @@ describe("angular.scenario.dsl", function() { '</select>' ); $root.dsl.select('test').options('A', 'B'); - expect(_jQuery('[ng\\:model="test"]').val()).toEqual(['A','B']); + expect(doc.find('[ng\\:model="test"]').val()).toEqual(['A','B']); }); it('should fail to select multiple options on non-multiple select', function() { @@ -318,7 +302,7 @@ describe("angular.scenario.dsl", function() { it('should set attribute', function() { doc.append('<div id="test" class="foo"></div>'); $root.dsl.element('#test').attr('class', 'bam'); - expect(doc.find('div').attr('class')).toEqual('bam'); + expect(doc.find('#test').attr('class')).toEqual('bam'); }); it('should get property', function() { @@ -330,7 +314,7 @@ describe("angular.scenario.dsl", function() { it('should set property', function() { doc.append('<div id="test" class="foo"></div>'); $root.dsl.element('#test').prop('className', 'bam'); - expect(doc.find('div').prop('className')).toEqual('bam'); + expect(doc.find('#test').prop('className')).toEqual('bam'); }); it('should get css', function() { diff --git a/test/scenario/e2e/widgets.html b/test/scenario/e2e/widgets.html index fb27f72e..40ba0a3a 100644 --- a/test/scenario/e2e/widgets.html +++ b/test/scenario/e2e/widgets.html @@ -1,8 +1,8 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:ng="http://angularjs.org"> - <head> + <head ng:app> <link rel="stylesheet" type="text/css" href="style.css"/> - <script type="text/javascript" src="../../../src/angular-bootstrap.js" ng:autobind></script> + <script type="text/javascript" src="../../../src/angular-bootstrap.js"></script> </head> <body ng:init="$window.$scope = this"> <table> |
