diff options
| author | Andres Ornelas | 2010-05-24 15:25:30 -0700 |
|---|---|---|
| committer | Andres Ornelas | 2010-05-24 15:25:30 -0700 |
| commit | 3fab5d9879272b9f991a67c8135754f00c055834 (patch) | |
| tree | 2f33b6de3e3d0900c0bdba3b198e15dceac63712 /scenario | |
| parent | f6c67e28c94033edf6a16eb6508de54679cb49db (diff) | |
| download | angular.js-3fab5d9879272b9f991a67c8135754f00c055834.tar.bz2 | |
added error handling on scenario definition
Diffstat (limited to 'scenario')
| -rw-r--r-- | scenario/Runner.html | 2 | ||||
| -rw-r--r-- | scenario/widgets-scenario.js | 20 | ||||
| -rw-r--r-- | scenario/widgets-scenario2.js | 55 | ||||
| -rw-r--r-- | scenario/widgets-scenarios.old (renamed from scenario/widgets-scenarios.js) | 0 | ||||
| -rw-r--r-- | scenario/widgets.html | 4 |
5 files changed, 23 insertions, 58 deletions
diff --git a/scenario/Runner.html b/scenario/Runner.html index 5502283a..ffa08af9 100644 --- a/scenario/Runner.html +++ b/scenario/Runner.html @@ -2,7 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript" src="../src/scenario/bootstrap.js"></script> - <script type="text/javascript" src="widgets-scenario2.js"></script> + <script type="text/javascript" src="widgets-scenario.js"></script> </head> <body> </body> diff --git a/scenario/widgets-scenario.js b/scenario/widgets-scenario.js new file mode 100644 index 00000000..9e23d4df --- /dev/null +++ b/scenario/widgets-scenario.js @@ -0,0 +1,20 @@ +describe('widgets', function(){ + it('should verify that basic widgets work', function(){ + browser.navigateTo('widgets.html'); + + expect('{{text.basic}}').toEqual(''); + input('text.basic').enter('John'); + expect('{{text.basic}}').toEqual('John'); + + expect('{{text.password}}').toEqual(''); + input('text.password').enter('secret'); + expect('{{text.password}}').toEqual('secret'); + + expect('{{text.hidden}}').toEqual('hiddenValue'); + + expect('{{gender}}').toEqual('male'); + input('gender').select('female'); + expect('{{gender}}').toEqual('female'); + + }); +}); diff --git a/scenario/widgets-scenario2.js b/scenario/widgets-scenario2.js deleted file mode 100644 index b966b270..00000000 --- a/scenario/widgets-scenario2.js +++ /dev/null @@ -1,55 +0,0 @@ -browser = { - navigateTo: function(url){ - $scenario.addStep('Navigate to: ' + url, function(done){ - var self = this; - self.testFrame.load(function(){ - self.testFrame.unbind(); - self.testDocument = jQuery(self.testWindow.document); - done(); - }); - if (this.testFrame.attr('src') == url) { - this.testWindow.location.reload(); - } else { - this.testFrame.attr('src', url); - } - }); - } -}; - -function input(selector) { - return { - enter: function(value){ - $scenario.addStep("Set input text of '" + selector + "' to value '" + value + "'", function(done){ - var input = this.testDocument.find('input[name=' + selector + ']'); - input.val(value); - input.trigger('change'); - this.testWindow.angular.element(input[0]).trigger('change'); - done(); - }); - } - }; -} - -function expect(selector) { - return { - toEqual: function(expected) { - $scenario.addStep("Expect that " + selector + " equals '" + expected + "'", function(done){ - var attrName = selector.substring(2, selector.length - 2); - var binding = this.testDocument.find('span[ng-bind=' + attrName + ']'); - if (binding.text() != expected) { - this.result.fail("Expected '" + expected + "' but was '" + binding.text() + "'"); - } - done(); - }); - } - }; -} - -describe('widgets', function(){ - it('should verify that basic widgets work', function(){ - browser.navigateTo('widgets.html'); - expect('{{text.basic}}').toEqual(''); - input('text.basic').enter('John'); - expect('{{text.basic}}').toEqual('John'); - }); -}); diff --git a/scenario/widgets-scenarios.js b/scenario/widgets-scenarios.old index a1e6c0ed..a1e6c0ed 100644 --- a/scenario/widgets-scenarios.js +++ b/scenario/widgets-scenarios.old diff --git a/scenario/widgets.html b/scenario/widgets.html index 4d0f30b0..86269e86 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -26,8 +26,8 @@ </tr> <tr> <td>hidden</td> - <td><input type="hidden" name="hidden" value="hiddenValue" /></td> - <td>hidden={{hidden}}</td> + <td><input type="hidden" name="text.hidden" value="hiddenValue" /></td> + <td>text.hidden={{text.hidden}}</td> </tr> <tr><th colspan="3">Input selection field</th></tr> <tr> |
