aboutsummaryrefslogtreecommitdiffstats
path: root/scenario
diff options
context:
space:
mode:
authorAdam Abrons2010-03-15 17:02:54 -0700
committerAdam Abrons2010-03-15 17:02:54 -0700
commit39c6c5975bedf6e1610f7328a088acda9ab3406a (patch)
treec49a499733b7a3ec3547c64ff4d3ba5f9381dfa7 /scenario
parent79b743e52feb2c57ba0ae42d6d2742bc2189b22f (diff)
downloadangular.js-39c6c5975bedf6e1610f7328a088acda9ab3406a.tar.bz2
get scenarios running again - open Runner.html in a browser to run them
Diffstat (limited to 'scenario')
-rw-r--r--scenario/Runner.html10
-rw-r--r--scenario/datastore-scenarios.js19
-rw-r--r--scenario/datastore.html12
-rw-r--r--scenario/widgets-scenarios.js49
-rw-r--r--scenario/widgets.html58
5 files changed, 148 insertions, 0 deletions
diff --git a/scenario/Runner.html b/scenario/Runner.html
new file mode 100644
index 00000000..fb4b0f8f
--- /dev/null
+++ b/scenario/Runner.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/scenario/bootstrap.js"></script>
+ <script type="text/javascript" src="widgets-scenarios.js"></script>
+ <!--<script type="text/javascript" src="datastore-scenarios.js"></script>-->
+ </head>
+ <body>
+ </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..355d151c
--- /dev/null
+++ b/scenario/datastore.html
@@ -0,0 +1,12 @@
+<!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-bootstrap.js#database=$MEMORY"></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/widgets-scenarios.js b/scenario/widgets-scenarios.js
new file mode 100644
index 00000000..663b06da
--- /dev/null
+++ b/scenario/widgets-scenarios.js
@@ -0,0 +1,49 @@
+angular.scenarioDef.widgets = {
+ $before:[
+ {Given:"browser", at:"widgets.html"}
+ ],
+ checkWidgetBinding:[
+ {Then:"text", at:"{{name}}", should_be:""},
+ {When:"enter", text:"John", at:":input[name=name]"},
+ {Then:"text", at:"{{name}}", should_be:"John"},
+
+ {Then:"text", at:"{{gender}}", should_be:""},
+ {When:"click", at:"input:radio[value=male]"},
+ {Then:"text", at:"{{gender}}", should_be:"male"},
+
+ {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..cb28e78c
--- /dev/null
+++ b/scenario/widgets.html
@@ -0,0 +1,58 @@
+<!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>
+ <p>
+ name: <input type="text" name="name" /> name={{name}} <br/>
+ </p>
+ <p>
+ <input type="radio" name="gender" value="female"/> Female
+ <input type="radio" name="gender" value="male"/> Male
+ gender={{gender}}
+ </p>
+ <p>
+ <input type="checkbox" name="tea" checked value="on"/> tea={{tea}} <br/>
+ <input type="checkbox" name="coffee" value="on"/> coffee={{coffee}} <br/>
+ </p>
+ <p ng-init="count = 0">
+ <form>
+ <input type="button" value="button" ng-action="count = count + 1"/>
+ <input type="submit" value="submit" ng-action="count = count + 1"/>
+ <input type="image" src="" ng-action="count = count + 1"/>
+ <a href="#ERROR" ng-action="count=count+1">action</a>
+ count={{count}}
+ </form>
+ </p>
+ <p>
+ <select name="select">
+ <option>A</option>
+ <option>B</option>
+ <option>C</option>
+ </select>
+ select={{select}}
+ </p>
+ <p>
+ <select name="multiple" multiple>
+ <option>A</option>
+ <option>B</option>
+ <option>C</option>
+ </select>
+ multiple={{multiple}}
+ </p>
+ <p>
+ <input type="hidden" name="hidden" value="hiddenValue" />
+ Hidden field = {{hidden}}
+ </p>
+ <p>
+ <input type="password" name="password" value="passwordValue" />
+ Password field = {{password}}
+ </p>
+ </body>
+ </html>