forked from guillaumepotier/Parsley.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request guillaumepotier#33 from guillaumepotier/html5-vali…
…dators Support some html5 types
- Loading branch information
Showing
13 changed files
with
161 additions
and
53 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,15 @@ var testSuite = function () { | |
triggerSubmitValidation( '#required-html5', ' foo' ); | ||
expect( $( '#required-html5' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'required - html5-api bis', function () { | ||
triggerSubmitValidation( '#required-html5-bis', '' ); | ||
expect( $( '#required-html5-bis' ).hasClass( 'parsley-error' ) ).to.be( true ); | ||
expect( getErrorMessage( '#required-html5-bis', 'required') ).to.be( 'This value is required.' ); | ||
triggerSubmitValidation( '#required-html5-bis', ' ' ); | ||
expect( $( '#required-html5-bis' ).hasClass( 'parsley-error' ) ).to.be( true ); | ||
triggerSubmitValidation( '#required-html5-bis', ' foo' ); | ||
expect( $( '#required-html5-bis' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'minlength', function () { | ||
triggerSubmitValidation( '#minlength', '12345' ); | ||
expect( $( '#minlength' ).hasClass( 'parsley-error' ) ).to.be( true ); | ||
|
@@ -228,6 +237,14 @@ var testSuite = function () { | |
triggerSubmitValidation( '#min', '12' ); | ||
expect( $( '#min' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'min html5', function () { | ||
triggerSubmitValidation( '#min-html5', 12 ); | ||
expect( $( '#min-html5' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'max html5', function () { | ||
triggerSubmitValidation( '#max-html5', 8 ); | ||
expect( $( '#max-html5' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'max', function () { | ||
triggerSubmitValidation( '#max', '12' ); | ||
expect( $( '#max' ).hasClass( 'parsley-error' ) ).to.be( true ); | ||
|
@@ -263,6 +280,8 @@ var testSuite = function () { | |
, { url: "foo", expected: false, strict: false } | ||
, { url: "foo:bar", expected: false, strict: false } | ||
, { url: "foo://bar", expected: false, strict: false } | ||
|
||
// absolutely finish by false to test error message | ||
, { url: "ého", expected: false, strict: false } | ||
]; | ||
|
||
|
@@ -274,6 +293,10 @@ var testSuite = function () { | |
triggerSubmitValidation( '#typeurl', 'foo' ); | ||
expect( getErrorMessage( '#typeurl', 'type') ).to.be( 'This value should be a valid url.' ); | ||
} ) | ||
it ( 'url html5', function () { | ||
$( '#typeurl-html5' ).val( "http://foo.bar" ); | ||
expect( $( '#typeurl-html5' ).parsley( 'validate' ) ).to.be( true ); | ||
} ) | ||
it ( 'url strict + global config overriding type message', function () { | ||
for ( var i in urls ) { | ||
$( '#typeurlstrict' ).val( urls[i].url ); | ||
|
@@ -295,6 +318,14 @@ var testSuite = function () { | |
triggerSubmitValidation( '#typeemail', '[email protected]' ); | ||
expect( $( '#typeemail' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'email html5', function () { | ||
triggerSubmitValidation( '#typeemail-html5', '[email protected]' ); | ||
expect( $( '#typeemail-html5' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'range html5', function () { | ||
triggerSubmitValidation( '#typerange-html5', 8 ); | ||
expect( $( '#typerange-html5' ).hasClass( 'parsley-success' ) ).to.be( true ); | ||
} ) | ||
it ( 'digits', function () { | ||
triggerSubmitValidation( '#typedigits', 'foo' ); | ||
expect( $( '#typedigits' ).hasClass( 'parsley-error' ) ).to.be( true ); | ||
|