diff options
| author | Misko Hevery | 2012-03-23 14:03:24 -0700 |
|---|---|---|
| committer | Misko Hevery | 2012-03-28 11:16:35 -0700 |
| commit | 2430f52bb97fa9d682e5f028c977c5bf94c5ec38 (patch) | |
| tree | e7529b741d70199f36d52090b430510bad07f233 /test/scenario/output | |
| parent | 944098a4e0f753f06b40c73ca3e79991cec6c2e2 (diff) | |
| download | angular.js-2430f52bb97fa9d682e5f028c977c5bf94c5ec38.tar.bz2 | |
chore(module): move files around in preparation for more modules
Diffstat (limited to 'test/scenario/output')
| -rw-r--r-- | test/scenario/output/HtmlSpec.js | 126 | ||||
| -rw-r--r-- | test/scenario/output/jsonSpec.js | 37 | ||||
| -rw-r--r-- | test/scenario/output/objectSpec.js | 40 | ||||
| -rw-r--r-- | test/scenario/output/xmlSpec.js | 36 |
4 files changed, 0 insertions, 239 deletions
diff --git a/test/scenario/output/HtmlSpec.js b/test/scenario/output/HtmlSpec.js deleted file mode 100644 index 442e596d..00000000 --- a/test/scenario/output/HtmlSpec.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -describe('angular.scenario.output.html', function() { - var runner, model, spec, step, listeners, ui, context; - - beforeEach(function() { - listeners = []; - spec = { - name: 'test spec', - definition: { - id: 10, - name: 'child', - children: [], - parent: { - id: 20, - name: 'parent', - children: [] - } - } - }; - step = { - name: 'some step', - line: function() { return 'unknown:-1'; } - }; - runner = new angular.scenario.testing.MockRunner(); - model = new angular.scenario.ObjectModel(runner); - context = _jQuery("<div></div>"); - ui = angular.scenario.output.html(context, runner, model); - }); - - it('should create nested describe context', function() { - runner.emit('SpecBegin', spec); - expect(context.find('#describe-20 #describe-10 > h2').text()). - toEqual('describe: child'); - expect(context.find('#describe-20 > h2').text()).toEqual('describe: parent'); - expect(context.find('#describe-10 .tests > li .test-info .test-name').text()). - toEqual('test spec'); - expect(context.find('#describe-10 .tests > li').hasClass('status-pending')). - toBeTruthy(); - }); - - it('should add link on InteractivePause', function() { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - runner.emit('StepBegin', spec, step); - runner.emit('InteractivePause', spec, step); - expect(context.find('.test-actions .test-title:first').text()).toEqual('some step'); - expect(lowercase(context.find('.test-actions .test-title:last').html())).toEqual( - 'paused... <a href="javascript:resume()">resume</a> when ready.' - ); - }); - - it('should update totals when steps complete', function() { - // Failure - for (var i=0; i < 3; ++i) { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepFailure', spec, step, 'error'); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - } - - // Error - runner.emit('SpecBegin', spec); - runner.emit('SpecError', spec, 'error'); - runner.emit('SpecEnd', spec); - - // Error - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepError', spec, step, 'error'); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - - // Success - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - - expect(parseInt(context.find('#status-legend .status-failure').text(), 10)). - toEqual(3); - expect(parseInt(context.find('#status-legend .status-error').text(), 10)). - toEqual(2); - expect(parseInt(context.find('#status-legend .status-success').text(), 10)). - toEqual(1); - }); - - it('should update timer when test completes', function() { - // Success - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - - // Failure - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepFailure', spec, step, 'error'); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - - // Error - runner.emit('SpecBegin', spec); - runner.emit('SpecError', spec, 'error'); - runner.emit('SpecEnd', spec); - - context.find('#describe-10 .tests > li .test-info .timer-result'). - each(function(index, timer) { - expect(timer.innerHTML).toMatch(/ms$/); - }); - }); - - it('should include line if provided', function() { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepFailure', spec, step, 'error'); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - - var errorHtml = context.find('#describe-10 .tests li pre').html(); - expect(errorHtml.indexOf('unknown:-1')).toEqual(0); - }); - -}); diff --git a/test/scenario/output/jsonSpec.js b/test/scenario/output/jsonSpec.js deleted file mode 100644 index 06caf91c..00000000 --- a/test/scenario/output/jsonSpec.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -describe('angular.scenario.output.json', function() { - var output, context; - var runner, model, $window; - var spec, step; - - beforeEach(function() { - $window = {}; - context = _jQuery('<div></div>'); - runner = new angular.scenario.testing.MockRunner(); - model = new angular.scenario.ObjectModel(runner); - output = angular.scenario.output.json(context, runner, model); - spec = { - name: 'test spec', - definition: { - id: 10, - name: 'describe' - } - }; - step = { - name: 'some step', - line: function() { return 'unknown:-1'; } - }; - }); - - it('should put json in context on RunnerEnd', function() { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - runner.emit('RunnerEnd'); - - expect(angular.fromJson(context.html()).children['describe'] - .specs['test spec'].status).toEqual('success'); - }); -}); diff --git a/test/scenario/output/objectSpec.js b/test/scenario/output/objectSpec.js deleted file mode 100644 index d92c939d..00000000 --- a/test/scenario/output/objectSpec.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -describe('angular.scenario.output.object', function() { - var output; - var runner, model, $window; - var spec, step; - - beforeEach(function() { - $window = {}; - runner = new angular.scenario.testing.MockRunner(); - model = new angular.scenario.ObjectModel(runner); - runner.$window = $window; - output = angular.scenario.output.object(null, runner, model); - spec = { - name: 'test spec', - definition: { - id: 10, - name: 'describe', - children: [] - } - }; - step = { - name: 'some step', - line: function() { return 'unknown:-1'; } - }; - }); - - it('should create a global variable $result', function() { - expect($window.$result).toBeDefined(); - }); - - it('should maintain live state in $result', function() { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - - expect($window.$result.children['describe'] - .specs['test spec'].steps[0].duration).toBeDefined(); - }); -}); diff --git a/test/scenario/output/xmlSpec.js b/test/scenario/output/xmlSpec.js deleted file mode 100644 index 94c3cb5a..00000000 --- a/test/scenario/output/xmlSpec.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -describe('angular.scenario.output.json', function() { - var output, context; - var runner, model, $window; - var spec, step; - - beforeEach(function() { - $window = {}; - context = _jQuery('<div></div>'); - runner = new angular.scenario.testing.MockRunner(); - model = new angular.scenario.ObjectModel(runner); - output = angular.scenario.output.xml(context, runner, model); - spec = { - name: 'test spec', - definition: { - id: 10, - name: 'describe' - } - }; - step = { - name: 'some step', - line: function() { return 'unknown:-1'; } - }; - }); - - it('should create XML nodes for object model', function() { - runner.emit('SpecBegin', spec); - runner.emit('StepBegin', spec, step); - runner.emit('StepEnd', spec, step); - runner.emit('SpecEnd', spec); - runner.emit('RunnerEnd'); - expect(context.find('it').attr('status')).toEqual('success'); - expect(context.find('it step').attr('status')).toEqual('success'); - }); -}); |
