mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-27 01:44:47 +00:00
Revert click dsl, since what is returned by element is a jquery object
This commit is contained in:
parent
577ddaa539
commit
2767d7773f
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) {
|
angular.scenario.dsl.element = function(selector) {
|
||||||
var nameSuffix = "element '" + selector + "'";
|
var nameSuffix = "element '" + selector + "'";
|
||||||
return {
|
return $scenario.addFuture('Find ' + nameSuffix, function(done) {
|
||||||
find: function() {
|
var self = this, repeaterArray = [], ngBindPattern;
|
||||||
return $scenario.addFuture('Find ' + nameSuffix, function(done) {
|
var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
|
||||||
var self = this, repeaterArray = [], ngBindPattern;
|
if (startIndex >= 0) {
|
||||||
var startIndex = selector.search(angular.scenario.dsl.NG_BIND_PATTERN);
|
ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
|
||||||
if (startIndex >= 0) {
|
var element = this.testDocument.find('*').filter(function() {
|
||||||
ngBindPattern = selector.substring(startIndex + 2, selector.length - 2);
|
return self.jQuery(this).attr('ng:bind') == ngBindPattern;
|
||||||
var element = this.testDocument.find('*').filter(function() {
|
});
|
||||||
return self.jQuery(this).attr('ng:bind') == ngBindPattern;
|
done(element);
|
||||||
});
|
} else {
|
||||||
done(element);
|
done(this.testDocument.find(selector));
|
||||||
} else {
|
|
||||||
done(this.testDocument.find(selector));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
click: function() {
|
|
||||||
var self = this;
|
|
||||||
return $scenario.addFuture('Click ' + nameSuffix, function(done) {
|
|
||||||
_jQuery(self).click();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,5 @@ describe("DSL", function() {
|
||||||
expect(future.value.text()).toEqual('Details...');
|
expect(future.value.text()).toEqual('Details...');
|
||||||
expect(future.value.attr('ng:bind')).toEqual('report.description');
|
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