mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-05-12 11:21:35 +08:00
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.
This commit is contained in:
@@ -22,6 +22,19 @@ beforeEach(function(){
|
||||
return "Expected to not have class 'ng-validation-error' but found.";
|
||||
};
|
||||
return !hasClass;
|
||||
},
|
||||
|
||||
toEqualData: function(expected) {
|
||||
return equals(this.actual, expected);
|
||||
},
|
||||
|
||||
toHaveClass: function(clazz) {
|
||||
this.message = function(){
|
||||
return "Expected '" + sortedHtml(this.actual) + "' to have class '" + clazz + "'.";
|
||||
};
|
||||
return this.actual.hasClass ?
|
||||
this.actual.hasClass(clazz) :
|
||||
jqLite(this.actual).hasClass(clazz);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -194,3 +207,9 @@ function click(element) {
|
||||
JQLite.prototype.trigger.call(element, 'click');
|
||||
}
|
||||
}
|
||||
|
||||
function rethrow(e) {
|
||||
if(e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user