diff options
| author | Shyam Seshadri | 2010-08-13 12:05:50 -0700 |
|---|---|---|
| committer | Shyam Seshadri | 2010-08-13 12:05:50 -0700 |
| commit | 675978f41fbd05a7ed3481a79b772877a59a1c15 (patch) | |
| tree | 47f057715376dae0a728e8734a83f3fc39af3ae5 /src/scenario | |
| parent | 275f036c1f146d37c088027c79338d0d5209c03a (diff) | |
| download | angular.js-675978f41fbd05a7ed3481a79b772877a59a1c15.tar.bz2 | |
Provide all jquery functions as futures
Diffstat (limited to 'src/scenario')
| -rw-r--r-- | src/scenario/DSL.js | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/scenario/DSL.js b/src/scenario/DSL.js index a64f8548..a533a5c3 100644 --- a/src/scenario/DSL.js +++ b/src/scenario/DSL.js @@ -102,18 +102,30 @@ angular.scenario.dsl.repeater = function(selector) { }; angular.scenario.dsl.element = function(selector) { - var nameSuffix = "element '" + selector + "'"; - 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)); - } - }); + var namePrefix = "Element '" + selector + "'"; + var futureJquery = {}; + for (key in _jQuery.fn) { + (function(){ + var jqFnName = key; + var jqFn = _jQuery.fn[key]; + futureJquery[key] = function() { + var jqArgs = arguments; + return $scenario.addFuture(namePrefix + "." + jqFnName + "()", + 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(jqFn.apply(element, jqArgs)); + } else { + done(jqFn.apply(this.testDocument.find(selector), jqArgs)); + } + }); + }; + })(); + } + return futureJquery; }; |
