diff options
| author | Misko Hevery | 2010-11-05 15:05:24 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-11-05 15:05:24 -0700 | 
| commit | dc66687149078876f3964a5ab0b9aa0434f46cdc (patch) | |
| tree | f7b05721dcd9352f4641e73571ea2a38dd5d4ed0 /src/validators.js | |
| parent | 3d6a099d6e40f1e12f6349843218987d472d0f3c (diff) | |
| download | angular.js-dc66687149078876f3964a5ab0b9aa0434f46cdc.tar.bz2 | |
added tests for documentation
Diffstat (limited to 'src/validators.js')
| -rw-r--r-- | src/validators.js | 30 | 
1 files changed, 23 insertions, 7 deletions
diff --git a/src/validators.js b/src/validators.js index a1543f41..2d8b5354 100644 --- a/src/validators.js +++ b/src/validators.js @@ -116,29 +116,45 @@ extend(angularValidator, {     *      *    * `data`: data object as passed from validate function     *  -   * @css ng-input-indicator-wait +   * @css ng-input-indicator-wait, ng-validation-error     *      * @exampleDescription     * <pre> -   * function myValidator (value, callback) { +   * function myValidator (inputToValidate, validationDone) {     *  // simulate delayed response, validate on even input length     *  setTimeout(function(){ -   *    callback(value.length % 2); -   *  }, 2000); +   *    validationDone(inputToValidate.length % 2); +   *  }, 500);     * };     * </pre>     *      * @example     * <script> -   *   function myValidator(value, callback) { +   *   function myValidator(inputToValidate, validationDone) {     *    setTimeout(function(){ -   *      callback(value.length % 2); -   *    }, 2000); +   *      validationDone(inputToValidate.length % 2); +   *    }, 500);     *  }     * </script>     *  This input is validated asynchronously:     *  <input name="text" ng:validate="asynchronous:$window.myValidator">     *  +   * @scenario +   * it('should change color in delayed way', function(){ +   *   var textBox = element('.example :input'); +   *   expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); +   *   expect(textBox.attr('className')).not().toMatch(/ng-validation-error/); +   *    +   *   input('text').enter('X'); +   *   expect(textBox.attr('className')).toMatch(/ng-input-indicator-wait/); +   *    +   *   pause(.6); +   *    +   *   expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); +   *   expect(textBox.attr('className')).toMatch(/ng-validation-error/); +   *    +   * }); +   *      */    /*     * cache is attached to the element  | 
