mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 15:40:22 +00:00
Revert click dsl, since what is returned by element is a jquery object
This commit is contained in:
parent
449d2ef724
commit
f6527bd53c
2 changed files with 12 additions and 30 deletions
|
|
@ -103,28 +103,17 @@ angular.scenario.dsl.repeater = function(selector) {
|
|||
|
||||
angular.scenario.dsl.element = function(selector) {
|
||||
var nameSuffix = "element '" + selector + "'";
|
||||
return {
|
||||
find: function() {
|
||||
return $scenario.addFuture('Find ' + nameSuffix, function(done) {
|
||||
var self = this, repeaterArray = [], ngBindPattern;
|
||||
var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
|
||||
if (startIndex >= 0) {
|
||||
ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
|
||||
var element = this.testDocument.find('*').filter(function() {
|
||||
return self.jQuery(this).attr('ng:bind') == ngBindPattern;
|
||||
});
|
||||
done(element);
|
||||
} else {
|
||||
done(this.testDocument.find(selector));
|
||||
}
|
||||
});
|
||||
},
|
||||
click: function() {
|
||||
var self = this;
|
||||
return $scenario.addFuture('Click ' + nameSuffix, function(done) {
|
||||
_jQuery(self).click();
|
||||
done();
|
||||
});
|
||||
return $scenario.addFuture('Find ' + nameSuffix, function(done) {
|
||||
var self = this, repeaterArray = [], ngBindPattern;
|
||||
var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
|
||||
if (startIndex >= 0) {
|
||||
ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
|
||||
var element = this.testDocument.find('*').filter(function() {
|
||||
return self.jQuery(this).attr('ng:bind') == ngBindPattern;
|
||||
});
|
||||
done(element);
|
||||
} else {
|
||||
done(this.testDocument.find(selector));
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -174,12 +174,5 @@ describe("DSL", function() {
|
|||
expect(future.value.text()).toEqual('Details...');
|
||||
expect(future.value.attr('ng:bind')).toEqual('report.description');
|
||||
});
|
||||
it('should be able to click elements', function(){
|
||||
var future = element('.link-class').click();
|
||||
expect(future.name).toEqual("Click element '.link-class'");
|
||||
executeFuture(future, html, function(value) { future.fulfill(value); });
|
||||
expect(future.fulfilled).toBeTruthy();
|
||||
// TODO(rajat): look for some side effect from click happening?
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue