aboutsummaryrefslogtreecommitdiffstats
path: root/src/scenario/angular.suffix
diff options
context:
space:
mode:
authorElliott Sprehn2010-10-08 16:43:40 -0700
committerElliott Sprehn2010-10-14 09:47:39 -0700
commit03df6cbddbb80186caf571e29957370b2ef9881c (patch)
treed5a321c8b207b464a5c8a300c422186e20e8ae31 /src/scenario/angular.suffix
parent0f104317dff5628765e26cc68df7dd1175b2aa5e (diff)
downloadangular.js-03df6cbddbb80186caf571e29957370b2ef9881c.tar.bz2
New Angular Scenario runner and DSL system with redesigned HTML UI.
Uses the Jasmine syntax for tests, ex: describe('widgets', function() { it('should verify that basic widgets work', function(){ navigateTo('widgets.html'); input('text.basic').enter('Carlos'); expect(binding('text.basic')).toEqual('Carlos'); input('text.basic').enter('Carlos Santana'); expect(binding('text.basic')).not().toEqual('Carlos Boozer'); input('text.password').enter('secret'); expect(binding('text.password')).toEqual('secret'); expect(binding('text.hidden')).toEqual('hiddenValue'); expect(binding('gender')).toEqual('male'); input('gender').select('female'); expect(binding('gender')).toEqual('female'); }); }); Note: To create new UI's implement the interface shown in angular.scenario.ui.Html.
Diffstat (limited to 'src/scenario/angular.suffix')
-rw-r--r--src/scenario/angular.suffix28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/scenario/angular.suffix b/src/scenario/angular.suffix
index fc861cbf..53d99dd2 100644
--- a/src/scenario/angular.suffix
+++ b/src/scenario/angular.suffix
@@ -1,11 +1,31 @@
+ var $scenario = new angular.scenario.Runner(window);
- var $scenarioRunner = new angular.scenario.Runner(window, jQuery);
-
- window.onload = function(){
+ window.onload = function() {
try {
if (previousOnLoad) previousOnLoad();
} catch(e) {}
- $scenarioRunner.run(jQuery(window.document.body));
+ jQuery(document.body).append(
+ '<div id="runner"></div>' +
+ '<div id="frame"></div>'
+ );
+ var frame = jQuery('#frame');
+ var runner = jQuery('#runner');
+ var application = new angular.scenario.Application(frame);
+ var ui = new angular.scenario.ui.Html(runner);
+ $scenario.run(ui, application, function(error) {
+ frame.remove();
+ if (error) {
+ if (window.console) {
+ console.log(error);
+ if (error.stack) {
+ console.log(error.stack);
+ }
+ } else {
+ // Do something for IE
+ alert(error);
+ }
+ }
+ });
};
})(window, document, window.onload);