feat(scenarioRunner): adding support for element().prop()

since jQuery 1.6.4 attr() focuses only on work with element attributes and doesn't deal well with element properties, so adding prop() support is required for getting many e2e tests to pass after upgrading the runner to jQuery 1.6.4.
This commit is contained in:
Igor Minar 2011-09-16 00:05:13 +02:00
parent 7ae536d053
commit 6883e8c7a0
2 changed files with 13 additions and 1 deletions

View file

@ -302,7 +302,7 @@ angular.scenario.dsl('select', function() {
* element(selector, label).{method}(key, value) sets the value (as defined by jQuery, ex. attr)
*/
angular.scenario.dsl('element', function() {
var KEY_VALUE_METHODS = ['attr', 'css'];
var KEY_VALUE_METHODS = ['attr', 'css', 'prop'];
var VALUE_METHODS = [
'val', 'text', 'html', 'height', 'innerHeight', 'outerHeight', 'width',
'innerWidth', 'outerWidth', 'position', 'scrollLeft', 'scrollTop', 'offset'

View file

@ -287,6 +287,18 @@ describe("angular.scenario.dsl", function() {
expect(doc.find('div').attr('class')).toEqual('bam');
});
it('should get property', function() {
doc.append('<div id="test" class="foo"></div>');
$root.dsl.element('#test').prop('className');
expect($root.futureResult).toEqual('foo');
});
it('should set property', function() {
doc.append('<div id="test" class="foo"></div>');
$root.dsl.element('#test').prop('className', 'bam');
expect(doc.find('div').prop('className')).toEqual('bam');
});
it('should get css', function() {
doc.append('<div id="test" style="height: 30px"></div>');
$root.dsl.element('#test').css('height');