<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>views/layouts/default.ctp</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -64,6 +64,10 @@
         //do some validation here and return either true or false.
       }
 
-Tips
-    * I wrote an article for PHPArch about JavaScript validation(http://c7y.phparch.com/c/entry/1/art,improved_javascript_validation), which raised some concerns that this approach may reveal too much about an application's security. If this is a concern for you, but you still want to use this helper, there is an option to whitelist rules can be applied on the client side. To use to this feature set the list in your bootstrap.php:
-        Configure::write('javascriptValidationWhitelist', array('alphaNumeric', 'minLength'));  
\ No newline at end of file
+/* Tests */
+   1. CakePHP unit tests are available through the normal /test.php
+   2. JavaScript unit test can be run by visiting /js_validate/test.
+   
+/* Tips */
+   * I wrote an article for PHPArch about JavaScript validation(http://c7y.phparch.com/c/entry/1/art,improved_javascript_validation), which raised some concerns that this approach may reveal too much about an application's security. If this is a concern for you, but you still want to use this helper, there is an option to whitelist rules can be applied on the client side. To use to this feature set the list in your bootstrap.php:
+     Configure::write('javascriptValidationWhitelist', array('alphaNumeric', 'minLength'));  
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -64,6 +64,24 @@ class JsValidate extends JsValidateAppModel {
                     'numeric' =&gt; array(
                               'rule1' =&gt; array('rule' =&gt; 'numeric')
                             ),
+                    'notEmpty' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; 'notEmpty')
+                            ),
+                    'phone' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; array('phone', null, 'us'))
+                            ),
+                    'postal' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; array('postal', null, 'us'))
+                            ),
+                    'range' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; array('range', 0, 10))
+                            ),
+                    'ssn' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; array('ssn', null, 'us'))
+                            ),
+                    'url' =&gt; array(
+                              'rule1' =&gt; array('rule' =&gt; 'url')
+                            )
                   );
 }
 ?&gt;
\ No newline at end of file</diff>
      <filename>models/js_validate.php</filename>
    </modified>
    <modified>
      <diff>@@ -161,10 +161,45 @@ class JsValidateTestCase extends CakeTestCase {
     $this-&gt;assertEqual($expected, $validation);
   }
   
-  function atestNotEmpty() {
+  function testNotEmpty() {
     $this-&gt;JsValidate-&gt;validate = array('notEmpty' =&gt; $this-&gt;JsValidate-&gt;backupValidate['notEmpty']);
     $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
-    $expected = '{&quot;JsValidate.JsValidateNotEmpty&quot;:[{&quot;rule&quot;:&quot;\/[^\\\\s]+\/m&quot;,&quot;message&quot;:&quot;There was a problem with the field notEmpty&quot;}]}';
+    $expected = '{&quot;JsValidate.JsValidateNotEmpty&quot;:[{&quot;rule&quot;:&quot;\/[^\\\\s]+\/m&quot;,&quot;message&quot;:&quot;There was a problem with the field NotEmpty&quot;}]}';
+    $this-&gt;assertEqual($expected, $validation);
+  }
+  
+  function testPhone() {
+    $this-&gt;JsValidate-&gt;validate = array('phone' =&gt; $this-&gt;JsValidate-&gt;backupValidate['phone']);
+    $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
+    $expected = '{&quot;JsValidate.JsValidatePhone&quot;:[{&quot;rule&quot;:&quot;\/^(?:\\\\+?1)?[-. ]?\\\\(?[2-9][0-8][0-9]\\\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$\/&quot;,&quot;message&quot;:&quot;There was a problem with the field Phone&quot;}]}';
+    $this-&gt;assertEqual($expected, $validation);
+  }
+  
+  function testPostal() {
+    $this-&gt;JsValidate-&gt;validate = array('postal' =&gt; $this-&gt;JsValidate-&gt;backupValidate['postal']);
+    $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
+    $expected = '{&quot;JsValidate.JsValidatePostal&quot;:[{&quot;rule&quot;:&quot;\/^[0-9]{5}(?:-[0-9]{4})?$\/i&quot;,&quot;message&quot;:&quot;There was a problem with the field Postal&quot;}]}';
+    $this-&gt;assertEqual($expected, $validation);
+  }
+  
+  function testRange() {
+    $this-&gt;JsValidate-&gt;validate = array('range' =&gt; $this-&gt;JsValidate-&gt;backupValidate['range']);
+    $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
+    $expected = '{&quot;JsValidate.JsValidateRange&quot;:[{&quot;rule&quot;:{&quot;rule&quot;:&quot;range&quot;,&quot;params&quot;:[0,10]},&quot;message&quot;:&quot;There was a problem with the field Range&quot;}]}';
+    $this-&gt;assertEqual($expected, $validation);
+  }
+  
+  function testSsn() {
+    $this-&gt;JsValidate-&gt;validate = array('ssn' =&gt; $this-&gt;JsValidate-&gt;backupValidate['ssn']);
+    $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
+    $expected = '{&quot;JsValidate.JsValidateSsn&quot;:[{&quot;rule&quot;:&quot;\/^[0-9]{3}-[0-9]{2}-[0-9]{4}$\/i&quot;,&quot;message&quot;:&quot;There was a problem with the field Ssn&quot;}]}';
+    $this-&gt;assertEqual($expected, $validation);
+  }
+  
+  function testUrl() {
+    $this-&gt;JsValidate-&gt;validate = array('url' =&gt; $this-&gt;JsValidate-&gt;backupValidate['url']);
+    $validation = $this-&gt;Validation-&gt;bind('JsValidate.JsValidate', array('form' =&gt; false));
+    $expected = '{&quot;JsValidate.JsValidateUrl&quot;:[{&quot;rule&quot;:&quot;\/^(?:(?:https?|ftps?|file|news|gopher):\\\\\/\\\\\/)?(?:(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\\\\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])|(?:[a-z0-9][-a-z0-9]*\\\\.)*(?:[a-z0-9][-a-z0-9]{0,62})\\\\.(?:(?:[a-z]{2}\\\\.)?[a-z]{2,4}|museum|travel))(?::[1-9][0-9]{0,3})?(?:\\\\\/?|\\\\\/([\\\\!\&quot;\\\\$&amp;\'\\\\(\\\\)\\\\*\\\\+,-\\\\.@_\\\\:;\\\\=\\\\\/0-9a-z]|(%[0-9a-f]{2}))*)?(?:\\\\?([\\\\!\&quot;\\\\$&amp;\'\\\\(\\\\)\\\\*\\\\+,-\\\\.@_\\\\:;\\\\=\\\\\/0-9a-z]|(%[0-9a-f]{2}))*)?(?:#([\\\\!\&quot;\\\\$&amp;\'\\\\(\\\\)\\\\*\\\\+,-\\\\.@_\\\\:;\\\\=\\\\\/0-9a-z]|(%[0-9a-f]{2}))*)?$\/i&quot;,&quot;message&quot;:&quot;There was a problem with the field Url&quot;}]}';
     $this-&gt;assertEqual($expected, $validation);
   }
 }
\ No newline at end of file</diff>
      <filename>tests/cases/models/js_validate.test.php</filename>
    </modified>
    <modified>
      <diff>@@ -119,5 +119,39 @@ $(function(){
     ok( !$.fn.validate.validateRule(&quot;49.5&quot;, validationRules.JsValidateNumeric[0].rule), &quot;49.5&quot;);
     ok( !$.fn.validate.validateRule(&quot;forty nine&quot;, validationRules.JsValidateNumeric[0].rule), &quot;forty nine&quot;);
   });
-});
-
+  
+  test(&quot;notEmpty&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;whatever&quot;, validationRules.JsValidateNotEmpty[0].rule), &quot;whatever&quot;);
+    ok( !$.fn.validate.validateRule(&quot;&quot;, validationRules.JsValidateNotEmpty[0].rule), &quot;&lt;blank&gt;&quot;);
+  });
+  
+  test(&quot;phone&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;555-555-5555&quot;, validationRules.JsValidatePhone[0].rule), &quot;555-555-5555&quot;);
+    ok( !$.fn.validate.validateRule(&quot;555-5a5-5555&quot;, validationRules.JsValidatePhone[0].rule), &quot;555-5a5-5555&quot;);
+  });
+  
+  test(&quot;postal&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;12345&quot;, validationRules.JsValidatePostal[0].rule), &quot;12345&quot;);
+    ok( $.fn.validate.validateRule(&quot;12345-9876&quot;, validationRules.JsValidatePostal[0].rule), &quot;12345-9876&quot;);
+    ok( !$.fn.validate.validateRule(&quot;1234a-9876&quot;, validationRules.JsValidatePostal[0].rule), &quot;1234a-9876&quot;);
+  });
+  
+  test(&quot;range&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;5&quot;, validationRules.JsValidateRange[0].rule), &quot;5&quot;);
+    ok( $.fn.validate.validateRule(&quot;0&quot;, validationRules.JsValidateRange[0].rule), &quot;0&quot;);
+    ok( $.fn.validate.validateRule(&quot;10&quot;, validationRules.JsValidateRange[0].rule), &quot;10&quot;);
+    ok( !$.fn.validate.validateRule(&quot;-1&quot;, validationRules.JsValidateRange[0].rule), &quot;-1&quot;);
+    ok( !$.fn.validate.validateRule(&quot;12&quot;, validationRules.JsValidateRange[0].rule), &quot;12&quot;);
+  });
+  
+  test(&quot;ssn&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;555-55-5555&quot;, validationRules.JsValidateSsn[0].rule), &quot;555-55-5555&quot;);
+    ok( !$.fn.validate.validateRule(&quot;5a5-55-5555&quot;, validationRules.JsValidateSsn[0].rule), &quot;55-5a5-5555&quot;);
+  });
+  
+  test(&quot;url&quot;, function() {    
+    ok( $.fn.validate.validateRule(&quot;www.pseudocoder.com&quot;, validationRules.JsValidateUrl[0].rule), &quot;www.pseudocoder.com&quot;);
+    ok( $.fn.validate.validateRule(&quot;http://cakephp.org&quot;, validationRules.JsValidateUrl[0].rule), &quot;http://cakephp.org&quot;);
+    ok( !$.fn.validate.validateRule(&quot;ww.zendcm&quot;, validationRules.JsValidateUrl[0].rule), &quot;ww.zendcm&quot;);
+  });
+});
\ No newline at end of file</diff>
      <filename>vendors/js/unit_tests.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,10 @@
+&lt;?php $javascript-&gt;codeBlock('var validationRules = ' . $validation-&gt;bind('JsValidate', array('form' =&gt; false)) . ';',
+                             array('inline' =&gt; false)); ?&gt;
+                             
 &lt;?php echo $javascript-&gt;link(array('http://jqueryjs.googlecode.com/svn/trunk/qunit/testrunner.js',
-                                   '/js_validate/js/jquery.validation')); ?&gt;
-&lt;?php echo $html-&gt;css(array('http://jqueryjs.googlecode.com/svn/trunk/qunit/testsuite.css')); ?&gt;
-
-&lt;script type=&quot;text/javascript&quot;&gt;
-  var validationRules = &lt;?php echo $validation-&gt;bind('JsValidate', array('form' =&gt; false)) ?&gt;;
-&lt;/script&gt;
-
-&lt;?php echo $javascript-&gt;link(array('/js_validate/js/unit_tests')); ?&gt;
+                                   '/js_validate/js/unit_tests'),
+                             false); ?&gt;
+&lt;?php echo $html-&gt;css(array('http://jqueryjs.googlecode.com/svn/trunk/qunit/testsuite.css'), null, null, false); ?&gt;
 
 &lt;h1&gt;CakePHP jQuery Validation Unit Tests&lt;/h1&gt;
 &lt;h2 id=&quot;banner&quot;&gt;&lt;/h2&gt;</diff>
      <filename>views/js_validate/test.ctp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>722cb7a2b3c51d09835f7c16bcd038556dac5e46</id>
    </parent>
  </parents>
  <author>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </author>
  <url>http://github.com/mcurry/js_validate/commit/f4d52ffec0f9fe5f5fc50264ebef0f5602a52214</url>
  <id>f4d52ffec0f9fe5f5fc50264ebef0f5602a52214</id>
  <committed-date>2009-05-01T22:32:11-07:00</committed-date>
  <authored-date>2009-05-01T22:32:11-07:00</authored-date>
  <message>finished unit tests</message>
  <tree>716b3d6ad1357407c263eee63158d942866fd06c</tree>
  <committer>
    <name>unknown</name>
    <email>matt@mcurry.net</email>
  </committer>
</commit>
