diff options
| author | Rob Spies | 2010-06-22 17:09:55 -0700 |
|---|---|---|
| committer | Rob Spies | 2010-06-22 17:09:55 -0700 |
| commit | 1500e91defa4020bfe9608749b25e585cd1d8e3d (patch) | |
| tree | 8c2872252b62567dc4eb00f7d7547661d5674c55 /scenario | |
| parent | eaa397c76b7d28343cde9f3a0338b9b0e79197c8 (diff) | |
| parent | b129a1094e6b42ed82c3ccecc2f40daaa0a6cb6a (diff) | |
| download | angular.js-1500e91defa4020bfe9608749b25e585cd1d8e3d.tar.bz2 | |
Merge http://github.com/angular/angular.js into angular
Conflicts:
.gitignore
Diffstat (limited to 'scenario')
| -rw-r--r-- | scenario/Runner-compiled.html | 9 | ||||
| -rw-r--r-- | scenario/Runner.html | 9 | ||||
| -rw-r--r-- | scenario/application-account.html | 6 | ||||
| -rw-r--r-- | scenario/application.html | 34 | ||||
| -rw-r--r-- | scenario/cross-site-post/People.json | 4 | ||||
| -rw-r--r-- | scenario/cross-site-post/index.html | 10 | ||||
| -rw-r--r-- | scenario/datastore-scenarios.js | 19 | ||||
| -rw-r--r-- | scenario/datastore.html | 17 | ||||
| -rw-r--r-- | scenario/perf.html | 33 | ||||
| -rw-r--r-- | scenario/style.css | 7 | ||||
| -rw-r--r-- | scenario/widgets-scenario.js | 25 | ||||
| -rw-r--r-- | scenario/widgets-scenarios.old | 49 | ||||
| -rw-r--r-- | scenario/widgets.html | 98 |
13 files changed, 320 insertions, 0 deletions
diff --git a/scenario/Runner-compiled.html b/scenario/Runner-compiled.html new file mode 100644 index 00000000..98dbea69 --- /dev/null +++ b/scenario/Runner-compiled.html @@ -0,0 +1,9 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <script type="text/javascript" src="../angular-scenario.js"></script> + <script type="text/javascript" src="widgets-scenario.js"></script> + </head> + <body> + </body> +</html> diff --git a/scenario/Runner.html b/scenario/Runner.html new file mode 100644 index 00000000..ffa08af9 --- /dev/null +++ b/scenario/Runner.html @@ -0,0 +1,9 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<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-scenario.js"></script> + </head> + <body> + </body> +</html> diff --git a/scenario/application-account.html b/scenario/application-account.html new file mode 100644 index 00000000..a43deffc --- /dev/null +++ b/scenario/application-account.html @@ -0,0 +1,6 @@ +<div ng-controller="AccountController"> +account page goes here! + <input type="text" name="name" value="misko"/> + <button ng-click="hello()">hello</button> +</div> + diff --git a/scenario/application.html b/scenario/application.html new file mode 100644 index 00000000..6b6ced69 --- /dev/null +++ b/scenario/application.html @@ -0,0 +1,34 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <link rel="stylesheet" type="text/css" href="style.css"></link> + <script type="text/javascript" src="../src/angular-bootstrap.js#autobind"></script> + <script> + function AccountController(){ + } + + AccountController.prototype = { + hello: function(){ + alert(this.name); + } + + }; + + </script> + </head> + <body ng-init="$window.$scope = this"> + [ <a href="#login">login</a> + | <a href="#account">account</a> + ] + + <ng:switch on="$location.hashPath"> + <div ng-switch-when="login">login screen</div> + <ng:include ng-switch-when="account" src="'application-account.html'"></ng:include> + </ng:switch> + + + (( input name )) + + <pre>$location={{$location}}</pre> + </body> + </html> diff --git a/scenario/cross-site-post/People.json b/scenario/cross-site-post/People.json new file mode 100644 index 00000000..de51fd83 --- /dev/null +++ b/scenario/cross-site-post/People.json @@ -0,0 +1,4 @@ +[ + { name: 'Misko', favorite: ['water melon', 'persimmon', 'passion fruit'] }, + { name: 'Lenka', favorite: ['strawberry'] } +] diff --git a/scenario/cross-site-post/index.html b/scenario/cross-site-post/index.html new file mode 100644 index 00000000..3ff6af85 --- /dev/null +++ b/scenario/cross-site-post/index.html @@ -0,0 +1,10 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script> + </head> + <body ng:init="$window.$scope = this; People = $resource('People.json')"> + <button ng-click="people = People.query()">Load People</button> + <pre>people = {{people}}</pre> + </body> + </html> diff --git a/scenario/datastore-scenarios.js b/scenario/datastore-scenarios.js new file mode 100644 index 00000000..6038070b --- /dev/null +++ b/scenario/datastore-scenarios.js @@ -0,0 +1,19 @@ +angular.scenarioDef.datastore = { + $before:[ + {Given:"dataset", + dataset:{ + Book:[{$id:'moby', name:"Moby Dick"}, + {$id:'gadsby', name:'Great Gadsby'}] + } + }, + {Given:"browser", at:"datastore.html#book=moby"}, + ], + checkLoadBook:[ + {Then:"drainRequestQueue"}, + + {Then:"text", at:"{{book.$id}}", should_be:"moby"}, + {Then:"text", at:"li[$index=0] {{book.name}}", should_be:"Great Gahdsby"}, + {Then:"text", at:"li[$index=0] {{book.name}}", should_be:"Moby Dick"}, + + ] +}; diff --git a/scenario/datastore.html b/scenario/datastore.html new file mode 100644 index 00000000..525d3636 --- /dev/null +++ b/scenario/datastore.html @@ -0,0 +1,17 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <script type="text/javascript" src="../lib/underscore/underscore.js"></script> + <script type="text/javascript" src="../lib/jquery/jquery-1.3.2.js"></script> + <script type="text/javascript" src="../src/angular-bootstrap.js"></script> + <script type="text/javascript"> + $(document).ready(function(){angular.compile(document).init();}); + </script> + </head> + <body ng-entity="book=Book" ng-init="books=Book.all()"> + <p>{{book.$id}}</p> + <li ng-repeat="book in books.$orderBy('name')"> + <li>{{book.name}}</li> + </li> + </body> + </html> diff --git a/scenario/perf.html b/scenario/perf.html new file mode 100644 index 00000000..cd676918 --- /dev/null +++ b/scenario/perf.html @@ -0,0 +1,33 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <link rel="stylesheet" type="text/css" href="style.css"/> + <script type="text/javascript" src="../src/angular-bootstrap.js#autobind"></script> + <script type="text/javascript"> + function PerfCntl(){} + PerfCntl.prototype = { + createItems: function(){ + var items = []; + for ( var i = 0; i < 1000; i++) { + var item = { + name: "" + Math.random(), + parts: [Math.random(), Math.random()] + }; + items.push(item); + } + return items; + } + }; + </script> + </head> + <body ng:init="$window.$scope = this; items = createItems()" ng-controller="PerfCntl"> + <input type="text" name="text"/> + <hr/> + <ul> + <li Xng-repeat="item in items.$filter('').$orderBy('name')" + ng-repeat="item in items"> + {{item.name}} <a href="#{{item.name}}">{{item.parts.join(', ')}}</a> + </li> + </ul> + </body> + </html> diff --git a/scenario/style.css b/scenario/style.css new file mode 100644 index 00000000..956bdc52 --- /dev/null +++ b/scenario/style.css @@ -0,0 +1,7 @@ +th { + text-align: left; +} + +tr { + border: 1px solid black; +} diff --git a/scenario/widgets-scenario.js b/scenario/widgets-scenario.js new file mode 100644 index 00000000..f4488190 --- /dev/null +++ b/scenario/widgets-scenario.js @@ -0,0 +1,25 @@ +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'); + input('gender').isChecked('female'); + expect('{{gender}}').toEqual('female'); + +// expect('{{tea}}').toBeChecked(); +// input('gender').select('female'); +// expect('{{gender}}').toEqual('female'); + + }); +}); diff --git a/scenario/widgets-scenarios.old b/scenario/widgets-scenarios.old new file mode 100644 index 00000000..a1e6c0ed --- /dev/null +++ b/scenario/widgets-scenarios.old @@ -0,0 +1,49 @@ +angular.scenarioDef.widgets = { + $before:[ + {Given:"browser", at:"widgets.html"} + ], + checkWidgetBinding:[ + {Then:"text", at:"{{text.basic}}", should_be:""}, + {When:"enter", text:"John", at:":input[name=text.basic]"}, + {Then:"text", at:"{{text.basic}}", should_be:"John"}, + + {Then:"text", at:"{{gender}}", should_be:"male"}, + {When:"click", at:"input:radio[value=female]"}, + {Then:"text", at:"{{gender}}", should_be:"female"}, + + {Then:"text", at:"{{tea}}", should_be:"on"}, + {When:"click", at:"input[name=tea]"}, + {Then:"text", at:"{{tea}}", should_be:""}, + + {Then:"text", at:"{{coffee}}", should_be:""}, + {When:"click", at:"input[name=coffee]"}, + {Then:"text", at:"{{coffee}}", should_be:"on"}, + + {Then:"text", at:"{{count}}", should_be:0}, + {When:"click", at:"form :button"}, + {When:"click", at:"form :submit"}, + {When:"click", at:"form :image"}, + {Then:"text", at:"{{count}}", should_be:3}, + + {Then:"text", at:"{{select}}", should_be:"A"}, + {When:"select", at:"select[name=select]", option:"B"}, + {Then:"text", at:"{{select}}", should_be:"B"}, + + {Then:"text", at:"{{multiple}}", should_be:"[]"}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["A"]}, + {When:"select", at:"select[name=multiple]", option:"B"}, + {Then:"text", at:"{{multiple}}", should_be:["A", "B"]}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["B"]}, + + {Then:"text", at:"{{hidden}}", should_be:"hiddenValue"}, + + {Then:"text", at:"{{password}}", should_be:"passwordValue"}, + {When:"enter", text:"reset", at:":input[name=password]"}, + {Then:"text", at:"{{password}}", should_be:"reset"}, + ], + checkNewWidgetEmpty:[ + {Then:"text", at:"{{name}}", should_be:""}, + ] +}; diff --git a/scenario/widgets.html b/scenario/widgets.html new file mode 100644 index 00000000..86269e86 --- /dev/null +++ b/scenario/widgets.html @@ -0,0 +1,98 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <link rel="stylesheet" type="text/css" href="style.css"/> + <script type="text/javascript" src="../src/angular-bootstrap.js#autobind"></script> + </head> + <body ng:init="$window.$scope = this"> + <table> + <tr> + <th width="330">Description</th> + <th>Test</th> + <th>Result</th> + </tr> + <tr><th colspan="3">Input text field</th></tr> + <tr> + <td>basic</td> + <td> + <input type="text" name="text.basic"/> + </td> + <td>text.basic={{text.basic}}</td> + </tr> + <tr> + <td>password</td> + <td><input type="password" name="text.password" /></td> + <td>text.password={{text.password}}</td> + </tr> + <tr> + <td>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> + <td>radio</td> + <td> + <input type="radio" name="gender" value="female"/> Female <br/> + <input type="radio" name="gender" value="male" checked="checked"/> Male + </td> + <td>gender={{gender}}</td> + </tr> + <tr> + <td>checkbox</td> + <td> + <input type="checkbox" name="checkbox.tea" checked value="on"/> Tea<br/> + <input type="checkbox" name="checkbox.coffee" value="on"/> Coffe + </td> + <td> + <pre>checkbox={{checkbox}}</pre> + </td> + </tr> + <tr> + <td>select</td> + <td> + <select name="select"> + <option>A</option> + <option>B</option> + <option>C</option> + </select> + </td> + <td>select={{select}}</td> + </tr> + <tr> + <td>multiselect</td> + <td> + <select name="multiselect" multiple> + <option>A</option> + <option>B</option> + <option>C</option> + </select> + </td> + <td>multiselect={{multiselect}}</td> + </tr> + <tr><th colspan="3">Buttons</th></tr> + <tr> + <td>ng-change<br/>ng-click</td> + <td ng:init="button.count = 0"> + <form> + <input type="button" value="button" ng-change="button.count = button.count + 1"/> <br/> + <input type="submit" value="submit" ng-change="button.count = button.count + 1"/><br/> + <input type="image" src="" ng-change="button.count = button.count + 1"/><br/> + <a href="" ng:click="button.count = button.count + 1">action</a> + </form> + </td> + <td>button={{button}}</td> + </tr> + <tr><th colspan="3">Repeaters</th></tr> + <tr> + <td>ng-repeat</td> + <td> + <ul> + <li ng-repeat="name in ['misko', 'adam']">{{name}}</li> + </ul> + </td> + <td></td> + </tr> + </table> + </body> + </html> |
