From aec3c8478c2eb937e24306087c5bc1ef49722036 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 2 Nov 2010 16:26:59 -0700 Subject: binding() should return value for input/text area, innerHTML for the rest --- src/scenario/dsl.js | 7 ++++++- test/scenario/dslSpec.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/scenario/dsl.js b/src/scenario/dsl.js index cef024ad..45156369 100644 --- a/src/scenario/dsl.js +++ b/src/scenario/dsl.js @@ -167,7 +167,12 @@ angular.scenario.dsl('binding', function() { var element = new elements.init(elements[i]); if (contains(element.attr('ng:bind'), name) || contains(element.attr('ng:bind-template'), name)) { - done(null, element.text()); + if (element.is('input, textarea')) { + done(null, element.val()); + } else { + console.log('element.html(): ', element.html()); + done(null, element.html()); + } return; } } diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js index 0338e884..881d629c 100644 --- a/test/scenario/dslSpec.js +++ b/test/scenario/dslSpec.js @@ -376,6 +376,24 @@ describe("angular.scenario.dsl", function() { expect($root.futureResult).toEqual('some value'); }); + it('should return value for input elements', function() { + doc.append(''); + $root.dsl.binding('foo.bar'); + expect($root.futureResult).toEqual('some value'); + }); + + it('should return value for textarea elements', function() { + doc.append(''); + $root.dsl.binding('foo.bar'); + expect($root.futureResult).toEqual('some value'); + }); + + it('should return innerHTML for all the other elements', function() { + doc.append('
foo some baz'); $root.dsl.binding('bar'); -- cgit v1.2.3