first commit
This commit is contained in:
No files matched your search
@@ -0,0 +1,7 @@
|
||||
QUnit.test( "creditcard", function( assert ) {
|
||||
var method = methodTest( "creditcard" );
|
||||
assert.ok( method( "4111-1111-1111-1111" ), "Valid creditcard number" );
|
||||
assert.ok( method( "4111 1111 1111 1111" ), "Valid creditcard number" );
|
||||
assert.ok( !method( "41111" ), "Invalid creditcard number" );
|
||||
assert.ok( !method( "asdf" ), "Invalid creditcard number" );
|
||||
} );
|
||||
@@ -0,0 +1,19 @@
|
||||
QUnit.test( "netmask", function( assert ) {
|
||||
var netmask_list = [ "255.255.255.0", "255.255.0.0", "255.0.0.0",
|
||||
"255.255.128.0", "255.255.248.0", "254.0.0.0",
|
||||
"128.0.0.0", "255.248.0.0", "255.252.0.0" ];
|
||||
var non_netmask_list = [ "255.255.255.22", "255.1.0.255", "255.1.0.0",
|
||||
"255.255.0.1", "254.255.0.0", "256.1.2.12",
|
||||
"252.1.128.0", "252.255.1.0", "248.255.0.0" ];
|
||||
var method = methodTest( "netmask" );
|
||||
|
||||
for ( var i = 0; i < netmask_list.length; i++ ) {
|
||||
assert.ok( method( netmask_list[ i ] ), netmask_list[ i ] +
|
||||
" is a valid netmask" );
|
||||
}
|
||||
|
||||
for ( i = 0; i < non_netmask_list.length; i++ ) {
|
||||
assert.ok( !method( non_netmask_list[ i ] ), non_netmask_list[ i ] +
|
||||
" is not a valid netmask" );
|
||||
}
|
||||
} );
|
||||
@@ -0,0 +1,46 @@
|
||||
QUnit.module( "aria" );
|
||||
|
||||
QUnit.test( "Invalid field adds aria-invalid=true", function( assert ) {
|
||||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ),
|
||||
form = $( "#ariaInvalid" );
|
||||
|
||||
form.validate( {
|
||||
rules: {
|
||||
ariaInvalidFirstName: "required"
|
||||
}
|
||||
} );
|
||||
ariaInvalidFirstName.val( "" );
|
||||
ariaInvalidFirstName.valid();
|
||||
assert.equal( ariaInvalidFirstName.attr( "aria-invalid" ), "true" );
|
||||
} );
|
||||
|
||||
QUnit.test( "Valid field adds aria-invalid=false", function( assert ) {
|
||||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ),
|
||||
form = $( "#ariaInvalid" );
|
||||
|
||||
form.validate( {
|
||||
rules: {
|
||||
ariaInvalidFirstName: "required"
|
||||
}
|
||||
} );
|
||||
ariaInvalidFirstName.val( "not empty" );
|
||||
ariaInvalidFirstName.valid();
|
||||
assert.equal( ariaInvalidFirstName.attr( "aria-invalid" ), "false" );
|
||||
assert.equal( $( "#ariaInvalid [aria-invalid=false]" ).length, 1 );
|
||||
} );
|
||||
|
||||
QUnit.test( "resetForm(): removes all aria-invalid attributes", function( assert ) {
|
||||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ),
|
||||
form = $( "#ariaInvalid" ),
|
||||
validator = form.validate( {
|
||||
rules: {
|
||||
ariaInvalidFirstName: "required"
|
||||
}
|
||||
} );
|
||||
|
||||
ariaInvalidFirstName.val( "not empty" );
|
||||
ariaInvalidFirstName.valid();
|
||||
validator.resetForm();
|
||||
assert.equal( $( "#ariaInvalid [aria-invalid]" ).length, 0, "resetForm() should remove any aria-invalid attributes" );
|
||||
} );
|
||||
|
||||
@@ -0,0 +1,442 @@
|
||||
QUnit.module( "placement" );
|
||||
|
||||
QUnit.test( "elements() order", function( assert ) {
|
||||
var container = $( "#orderContainer" ),
|
||||
v = $( "#elementsOrder" ).validate( {
|
||||
errorLabelContainer: container,
|
||||
wrap: "li"
|
||||
} );
|
||||
|
||||
assert.deepEqual(
|
||||
v.elements().map( function() {
|
||||
return $( this ).attr( "id" );
|
||||
} ).get(),
|
||||
[
|
||||
"order1",
|
||||
"order2",
|
||||
"order3",
|
||||
"order4",
|
||||
"order5",
|
||||
"order6"
|
||||
],
|
||||
"elements must be in document order"
|
||||
);
|
||||
|
||||
v.form();
|
||||
assert.deepEqual(
|
||||
container.children().map( function() {
|
||||
return $( this ).attr( "id" );
|
||||
} ).get(),
|
||||
[
|
||||
"order1-error",
|
||||
"order2-error",
|
||||
"order3-error",
|
||||
"order4-error",
|
||||
"order5-error",
|
||||
"order6-error"
|
||||
],
|
||||
"labels in error container must be in document order"
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( "error containers, simple", function( assert ) {
|
||||
assert.expect( 14 );
|
||||
var container = $( "#simplecontainer" ),
|
||||
v = $( "#form" ).validate( {
|
||||
errorLabelContainer: container,
|
||||
showErrors: function() {
|
||||
container.find( "h3" ).html( jQuery.validator.format( "There are {0} errors in your form.", this.size() ) );
|
||||
this.defaultShowErrors();
|
||||
}
|
||||
} );
|
||||
|
||||
v.prepareForm();
|
||||
assert.ok( v.valid(), "form is valid" );
|
||||
assert.equal( container.find( ".error:not(input)" ).length, 0, "There should be no error labels" );
|
||||
assert.equal( container.find( "h3" ).html(), "" );
|
||||
|
||||
v.prepareForm();
|
||||
v.errorList = [
|
||||
{
|
||||
message: "bar",
|
||||
element: {
|
||||
name: "foo"
|
||||
}
|
||||
},
|
||||
{
|
||||
message: "necessary",
|
||||
element: {
|
||||
name: "required"
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
assert.ok( !v.valid(), "form is not valid after adding errors manually" );
|
||||
v.showErrors();
|
||||
assert.equal( container.find( ".error:not(input)" ).length, 2, "There should be two error labels" );
|
||||
assert.ok( container.is( ":visible" ), "Check that the container is visible" );
|
||||
container.find( ".error:not(input)" ).each( function() {
|
||||
assert.ok( $( this ).is( ":visible" ), "Check that each label is visible" );
|
||||
} );
|
||||
assert.equal( container.find( "h3" ).html(), "There are 2 errors in your form." );
|
||||
|
||||
v.prepareForm();
|
||||
assert.ok( v.valid(), "form is valid after a reset" );
|
||||
v.showErrors();
|
||||
assert.equal( container.find( ".error:not(input)" ).length, 2, "There should still be two error labels" );
|
||||
assert.ok( container.is( ":hidden" ), "Check that the container is hidden" );
|
||||
container.find( ".error:not(input)" ).each( function() {
|
||||
assert.ok( $( this ).is( ":hidden" ), "Check that each label is hidden" );
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "error containers, with labelcontainer I", function( assert ) {
|
||||
assert.expect( 16 );
|
||||
var container = $( "#container" ),
|
||||
labelcontainer = $( "#labelcontainer" ),
|
||||
v = $( "#form" ).validate( {
|
||||
errorContainer: container,
|
||||
errorLabelContainer: labelcontainer,
|
||||
wrapper: "li"
|
||||
} );
|
||||
|
||||
assert.ok( v.valid(), "form is valid" );
|
||||
assert.equal( container.find( ".error:not(input)" ).length, 0, "There should be no error labels in the container" );
|
||||
assert.equal( labelcontainer.find( ".error:not(input)" ).length, 0, "There should be no error labels in the labelcontainer" );
|
||||
assert.equal( labelcontainer.find( "li" ).length, 0, "There should be no lis labels in the labelcontainer" );
|
||||
|
||||
v.errorList = [
|
||||
{
|
||||
message: "bar",
|
||||
element: {
|
||||
name: "foo"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "required",
|
||||
message: "necessary",
|
||||
element: {
|
||||
name: "required"
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
assert.ok( !v.valid(), "form is not valid after adding errors manually" );
|
||||
v.showErrors();
|
||||
assert.equal( container.find( ".error:not(input)" ).length, 0, "There should be no error label in the container" );
|
||||
assert.equal( labelcontainer.find( ".error:not(input)" ).length, 2, "There should be two error labels in the labelcontainer" );
|
||||
assert.equal( labelcontainer.find( "li" ).length, 2, "There should be two error lis in the labelcontainer" );
|
||||
assert.ok( container.is( ":visible" ), "Check that the container is visible" );
|
||||
assert.ok( labelcontainer.is( ":visible" ), "Check that the labelcontainer is visible" );
|
||||
labelcontainer.find( ".error:not(input)" ).each( function() {
|
||||
assert.ok( $( this ).is( ":visible" ), "Check that each label is visible1" );
|
||||
assert.equal( $( this ).parent()[ 0 ].tagName.toLowerCase(), "li", "Check that each label is wrapped in an li" );
|
||||
assert.ok( $( this ).parent( "li" ).is( ":visible" ), "Check that each parent li is visible" );
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "errorcontainer, show/hide only on submit", function( assert ) {
|
||||
assert.expect( 14 );
|
||||
var container = $( "#container" ),
|
||||
labelContainer = $( "#labelcontainer" ),
|
||||
v = $( "#testForm1" ).bind( "invalid-form.validate", function() {
|
||||
assert.ok( true, "invalid-form event triggered called" );
|
||||
} ).validate( {
|
||||
errorContainer: container,
|
||||
errorLabelContainer: labelContainer,
|
||||
showErrors: function() {
|
||||
container.html( jQuery.validator.format( "There are {0} errors in your form.", this.numberOfInvalids() ) );
|
||||
assert.ok( true, "showErrors called" );
|
||||
this.defaultShowErrors();
|
||||
}
|
||||
} );
|
||||
|
||||
assert.equal( container.html(), "", "must be empty" );
|
||||
assert.equal( labelContainer.html(), "", "must be empty" );
|
||||
|
||||
// Validate whole form, both showErrors and invalidHandler must be called once
|
||||
// preferably invalidHandler first, showErrors second
|
||||
assert.ok( !v.form(), "invalid form" );
|
||||
assert.equal( labelContainer.find( ".error:not(input)" ).length, 2 );
|
||||
assert.equal( container.html(), "There are 2 errors in your form." );
|
||||
assert.ok( labelContainer.is( ":visible" ), "must be visible" );
|
||||
assert.ok( container.is( ":visible" ), "must be visible" );
|
||||
|
||||
$( "#firstname" ).val( "hix" ).keyup();
|
||||
$( "#testForm1" ).triggerHandler( "keyup", [
|
||||
jQuery.event.fix( {
|
||||
type: "keyup",
|
||||
target: $( "#firstname" )[ 0 ]
|
||||
} )
|
||||
] );
|
||||
assert.equal( labelContainer.find( ".error:visible" ).length, 1 );
|
||||
assert.equal( container.html(), "There are 1 errors in your form." );
|
||||
|
||||
$( "#lastname" ).val( "abc" );
|
||||
assert.ok( v.form(), "Form now valid, trigger showErrors but not invalid-form" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test label used as error container", function( assert ) {
|
||||
assert.expect( 8 );
|
||||
var form = $( "#testForm16" ),
|
||||
field = $( "#testForm16text" );
|
||||
|
||||
form.validate( {
|
||||
errorPlacement: function( error, element ) {
|
||||
|
||||
// Append error within linked label
|
||||
$( "label[for='" + element.attr( "id" ) + "']" ).append( error );
|
||||
},
|
||||
errorElement: "span"
|
||||
} );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( field.next( "label" ).contents().first().text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.hasError( field, "missing" );
|
||||
assert.ok( !field.attr( "aria-describedby" ), "field does not require aria-describedby attribute" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.equal( field.next( "label" ).contents().first().text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.ok( !field.attr( "aria-describedby" ), "field does not require aria-describedby attribute" );
|
||||
assert.noErrorFor( field );
|
||||
} );
|
||||
|
||||
QUnit.test( "test error placed adjacent to descriptive label", function( assert ) {
|
||||
assert.expect( 8 );
|
||||
var form = $( "#testForm16" ),
|
||||
field = $( "#testForm16text" );
|
||||
|
||||
form.validate( {
|
||||
errorElement: "span"
|
||||
} );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( form.find( "label" ).length, 1 );
|
||||
assert.equal( form.find( "label" ).text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.hasError( field, "missing" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.equal( form.find( "label" ).length, 1 );
|
||||
assert.equal( form.find( "label" ).text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.noErrorFor( field );
|
||||
} );
|
||||
|
||||
QUnit.test( "test descriptive label used alongside error label", function( assert ) {
|
||||
assert.expect( 8 );
|
||||
var form = $( "#testForm16" ),
|
||||
field = $( "#testForm16text" );
|
||||
|
||||
form.validate( {
|
||||
errorElement: "label"
|
||||
} );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( form.find( "label.title" ).length, 1 );
|
||||
assert.equal( form.find( "label.title" ).text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.hasError( field, "missing" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.equal( form.find( "label.title" ).length, 1 );
|
||||
assert.equal( form.find( "label.title" ).text(), "Field Label", "container label isn't disrupted" );
|
||||
assert.noErrorFor( field );
|
||||
} );
|
||||
|
||||
QUnit.test( "test custom errorElement", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
var form = $( "#userForm" ),
|
||||
field = $( "#username" );
|
||||
|
||||
form.validate( {
|
||||
messages: {
|
||||
username: "missing"
|
||||
},
|
||||
errorElement: "label"
|
||||
} );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.hasError( field, "missing", "Field should have error 'missing'" );
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.noErrorFor( field, "Field should not have a visible error" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test existing label used as error element", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
var form = $( "#testForm14" ),
|
||||
field = $( "#testForm14text" );
|
||||
|
||||
form.validate( { errorElement: "label" } );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.hasError( field, "required" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.noErrorFor( field );
|
||||
} );
|
||||
|
||||
QUnit.test( "test existing non-label used as error element", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
var form = $( "#testForm15" ),
|
||||
field = $( "#testForm15text" );
|
||||
|
||||
form.validate( { errorElement: "span" } );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.hasError( field, "required" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.noErrorFor( field );
|
||||
} );
|
||||
|
||||
QUnit.test( "test aria-describedby with input names contains CSS-selector meta-characters", function( assert ) {
|
||||
var form = $( "#testForm21" ),
|
||||
field = $( "#testForm21\\!\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~" );
|
||||
|
||||
assert.equal( field.attr( "aria-describedby" ), undefined );
|
||||
|
||||
form.validate( {
|
||||
errorElement: "span",
|
||||
errorPlacement: function() {
|
||||
|
||||
// Do something
|
||||
}
|
||||
} );
|
||||
|
||||
// Validate the element
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm21!#$%&'()*+,./:;<=>?@[\\]^`{|}~-error" );
|
||||
|
||||
// Re-run validation
|
||||
field.val( "some" );
|
||||
field.trigger( "keyup" );
|
||||
|
||||
field.val( "something" );
|
||||
field.trigger( "keyup" );
|
||||
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm21!#$%&'()*+,./:;<=>?@[\\]^`{|}~-error", "`aria-describedby` should remain the same as before." );
|
||||
|
||||
// Re-run validation
|
||||
field.val( "something something" );
|
||||
field.trigger( "keyup" );
|
||||
|
||||
assert.ok( field.valid() );
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm21!#$%&'()*+,./:;<=>?@[\\]^`{|}~-error", "`aria-describedby` should remain the same as before." );
|
||||
} );
|
||||
|
||||
QUnit.test( "test existing non-error aria-describedby", function( assert ) {
|
||||
assert.expect( 8 );
|
||||
var form = $( "#testForm17" ),
|
||||
field = $( "#testForm17text" );
|
||||
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm17text-description" );
|
||||
form.validate( { errorElement: "span" } );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm17text-description testForm17text-error" );
|
||||
assert.hasError( field, "required" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.noErrorFor( field );
|
||||
|
||||
assert.strictEqual( $( "#testForm17text-description" ).text(), "This is where you enter your data" );
|
||||
assert.strictEqual( $( "#testForm17text-error" ).text(), "", "Error label is empty for valid field" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test pre-assigned non-error aria-describedby", function( assert ) {
|
||||
assert.expect( 7 );
|
||||
var form = $( "#testForm17" ),
|
||||
field = $( "#testForm17text" );
|
||||
|
||||
// Pre-assign error identifier
|
||||
field.attr( "aria-describedby", "testForm17text-description testForm17text-error" );
|
||||
form.validate( { errorElement: "span" } );
|
||||
|
||||
assert.ok( !field.valid() );
|
||||
assert.equal( field.attr( "aria-describedby" ), "testForm17text-description testForm17text-error" );
|
||||
assert.hasError( field, "required" );
|
||||
|
||||
field.val( "foo" );
|
||||
assert.ok( field.valid() );
|
||||
assert.noErrorFor( field );
|
||||
|
||||
assert.strictEqual( $( "#testForm17text-description" ).text(), "This is where you enter your data" );
|
||||
assert.strictEqual( $( "#testForm17text-error" ).text(), "", "Error label is empty for valid field" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test id/name containing brackets", function( assert ) {
|
||||
var form = $( "#testForm18" ),
|
||||
field = $( "#testForm18\\[text\\]" );
|
||||
|
||||
form.validate( {
|
||||
errorElement: "span"
|
||||
} );
|
||||
|
||||
form.valid();
|
||||
field.valid();
|
||||
assert.hasError( field, "required" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test id/name containing $", function( assert ) {
|
||||
var form = $( "#testForm19" ),
|
||||
field = $( "#testForm19\\$text" );
|
||||
|
||||
form.validate( {
|
||||
errorElement: "span"
|
||||
} );
|
||||
|
||||
field.valid();
|
||||
assert.hasError( field, "required" );
|
||||
} );
|
||||
|
||||
QUnit.test( "test id/name containing single quotes", function( assert ) {
|
||||
var v = $( "#testForm20" ).validate(),
|
||||
textElement = $( "#testForm20\\[\\'textinput\\'\\]" ),
|
||||
checkboxElement = $( "#testForm20\\[\\'checkboxinput\\'\\]" ),
|
||||
radioElement = $( "#testForm20\\[\\'radioinput\\'\\]" );
|
||||
|
||||
v.form();
|
||||
|
||||
assert.equal( v.numberOfInvalids(), 3, "There is three invalid elements" );
|
||||
assert.equal( v.invalidElements()[ 0 ], textElement[ 0 ], "The element should be invalid" );
|
||||
assert.equal( v.invalidElements()[ 1 ], checkboxElement[ 0 ], "The text element should be invalid" );
|
||||
assert.equal( v.invalidElements()[ 2 ], radioElement[ 0 ], "The text element should be invalid" );
|
||||
} );
|
||||
|
||||
QUnit.test( "#1632: Error hidden, but input error class not removed", function( assert ) {
|
||||
var v = $( "#testForm23" ).validate( {
|
||||
rules: {
|
||||
box1: {
|
||||
required: {
|
||||
depends: function() {
|
||||
return !!$( "#box2" ).val();
|
||||
}
|
||||
}
|
||||
},
|
||||
box2: {
|
||||
required: {
|
||||
depends: function() {
|
||||
return !!$( "#box1" ).val();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} ),
|
||||
box1 = $( "#box1" ),
|
||||
box2 = $( "#box2" );
|
||||
|
||||
box1.val( "something" );
|
||||
v.form();
|
||||
assert.equal( v.numberOfInvalids(), 1, "There is only one invlid element" );
|
||||
assert.equal( v.invalidElements()[ 0 ], box2[ 0 ], "The box2 element should be invalid" );
|
||||
|
||||
box1.val( "" );
|
||||
v.form();
|
||||
assert.equal( v.numberOfInvalids(), 0, "There is no error" );
|
||||
assert.equal( box2.hasClass( "error" ), false, "Box2 should not have an error class" );
|
||||
} );
|
||||
@@ -0,0 +1,416 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Page not found</title>
|
||||
<style>
|
||||
html {font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
|
||||
body {margin:0}
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
nav,
|
||||
section,
|
||||
summary {display:block}
|
||||
audio,
|
||||
canvas,
|
||||
progress,
|
||||
video {display:inline-block;vertical-align:baseline}
|
||||
audio:not([controls]) {display:none;height:0}
|
||||
[hidden],
|
||||
template {display:none}
|
||||
a {background:transparent}
|
||||
a:active,
|
||||
a:hover {outline:0}
|
||||
abbr[title] {border-bottom:1px dotted}
|
||||
b,
|
||||
strong {font-weight:bold}
|
||||
dfn {font-style:italic}
|
||||
h1 {font-size:2em;margin:0.67em 0}
|
||||
mark {background:#ff0;color:#000}
|
||||
small {font-size:80%}
|
||||
sub,
|
||||
sup {font-size:75%;line-height:0;position:relative;vertical-align:baseline}
|
||||
sup {top:-0.5em}
|
||||
sub {bottom:-0.25em}
|
||||
img {border:0}
|
||||
svg:not(:root) {overflow:hidden}
|
||||
figure {margin:1em 40px}
|
||||
hr {-moz-box-sizing:content-box;box-sizing:content-box;height:0}
|
||||
pre {overflow:auto}
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {font-family:monospace,monospace;font-size:1em}
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {color:inherit;font:inherit;margin:0}
|
||||
button {overflow:visible}
|
||||
button,
|
||||
select {text-transform:none}
|
||||
button,
|
||||
html input[type="button"],
|
||||
input[type="reset"],
|
||||
input[type="submit"] {-webkit-appearance:button;cursor:pointer}
|
||||
button[disabled],
|
||||
html input[disabled] {cursor:default}
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {border:0;padding:0}
|
||||
input {line-height:normal}
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {box-sizing:border-box;padding:0}
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {height:auto}
|
||||
input[type="search"] {-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {-webkit-appearance:none}
|
||||
fieldset {border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}
|
||||
legend {border:0;padding:0}
|
||||
textarea {overflow:auto}
|
||||
optgroup {font-weight:bold}
|
||||
table {border-collapse:collapse;border-spacing:0;table-layout:auto;word-wrap:break-word;word-break:break-all}
|
||||
td,
|
||||
th {padding:0}
|
||||
*,
|
||||
*:before,
|
||||
*:after {-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
|
||||
html {font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}
|
||||
body {font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:1.42857143;color:#333;background-color:#f9f9f9}
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
textarea {font-family:inherit;font-size:inherit;line-height:inherit}
|
||||
button,
|
||||
input,
|
||||
select[multiple],
|
||||
textarea {background-image:none}
|
||||
a {color:#0181b9;text-decoration:none}
|
||||
a:hover,
|
||||
a:focus {color:#001721;text-decoration:underline}
|
||||
a:focus {outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}
|
||||
img {vertical-align:middle}
|
||||
.img-responsive {display:block;max-width:100%;height:auto}
|
||||
.img-rounded {-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}
|
||||
.img-circle {border-radius:50%}
|
||||
hr {margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}
|
||||
.sr-only {position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}
|
||||
@media print {* {text-shadow:none !important;color:#000 !important;background:transparent !important;box-shadow:none !important }a,a:visited {text-decoration:underline }a[href]:after {content:" (" attr(href) ")" }abbr[title]:after {content:" (" attr(title) ")" }a[href^="javascript:"]:after,a[href^="#"]:after {content:"" }pre,blockquote {border:1px solid #999;page-break-inside:avoid }thead {display:table-header-group }tr,img {page-break-inside:avoid }img {max-width:100% !important }p,h2,h3 {orphans:3;widows:3 }h2,h3 {page-break-after:avoid }select {background:#fff !important }.navbar {display:none }.table td,.table th {background-color:#fff !important }.btn >.caret,.dropup >.btn >.caret {border-top-color:#000 !important }.label {border:1px solid #000 }.table {border-collapse:collapse !important }.table-bordered th,.table-bordered td {border:1px solid #ddd !important }}
|
||||
.container {margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}
|
||||
@media (min-width:768px) {.container {width:750px }}
|
||||
@media (min-width:992px) {.container {width:970px }}
|
||||
@media (min-width:1200px) {.container {width:1170px }}
|
||||
.container-fluid {margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}
|
||||
.row {margin-left:-15px;margin-right:-15px}
|
||||
.row-flush {margin-left:0;margin-right:0}
|
||||
.row-flush [class*="col-"] {padding-left:0 !important;padding-right:0 !important}
|
||||
.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12 {position:relative;min-height:1px;padding-left:15px;padding-right:15px}
|
||||
.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12 {float:left}
|
||||
.col-xs-12 {width:100%}
|
||||
.col-xs-11 {width:91.66666667%}
|
||||
.col-xs-10 {width:83.33333333%}
|
||||
.col-xs-9 {width:75%}
|
||||
.col-xs-8 {width:66.66666667%}
|
||||
.col-xs-7 {width:58.33333333%}
|
||||
.col-xs-6 {width:50%}
|
||||
.col-xs-5 {width:41.66666667%}
|
||||
.col-xs-4 {width:33.33333333%}
|
||||
.col-xs-3 {width:25%}
|
||||
.col-xs-2 {width:16.66666667%}
|
||||
.col-xs-1 {width:8.33333333%}
|
||||
.col-xs-pull-12 {right:100%}
|
||||
.col-xs-pull-11 {right:91.66666667%}
|
||||
.col-xs-pull-10 {right:83.33333333%}
|
||||
.col-xs-pull-9 {right:75%}
|
||||
.col-xs-pull-8 {right:66.66666667%}
|
||||
.col-xs-pull-7 {right:58.33333333%}
|
||||
.col-xs-pull-6 {right:50%}
|
||||
.col-xs-pull-5 {right:41.66666667%}
|
||||
.col-xs-pull-4 {right:33.33333333%}
|
||||
.col-xs-pull-3 {right:25%}
|
||||
.col-xs-pull-2 {right:16.66666667%}
|
||||
.col-xs-pull-1 {right:8.33333333%}
|
||||
.col-xs-pull-0 {right:0%}
|
||||
.col-xs-push-12 {left:100%}
|
||||
.col-xs-push-11 {left:91.66666667%}
|
||||
.col-xs-push-10 {left:83.33333333%}
|
||||
.col-xs-push-9 {left:75%}
|
||||
.col-xs-push-8 {left:66.66666667%}
|
||||
.col-xs-push-7 {left:58.33333333%}
|
||||
.col-xs-push-6 {left:50%}
|
||||
.col-xs-push-5 {left:41.66666667%}
|
||||
.col-xs-push-4 {left:33.33333333%}
|
||||
.col-xs-push-3 {left:25%}
|
||||
.col-xs-push-2 {left:16.66666667%}
|
||||
.col-xs-push-1 {left:8.33333333%}
|
||||
.col-xs-push-0 {left:0%}
|
||||
.col-xs-offset-12 {margin-left:100%}
|
||||
.col-xs-offset-11 {margin-left:91.66666667%}
|
||||
.col-xs-offset-10 {margin-left:83.33333333%}
|
||||
.col-xs-offset-9 {margin-left:75%}
|
||||
.col-xs-offset-8 {margin-left:66.66666667%}
|
||||
.col-xs-offset-7 {margin-left:58.33333333%}
|
||||
.col-xs-offset-6 {margin-left:50%}
|
||||
.col-xs-offset-5 {margin-left:41.66666667%}
|
||||
.col-xs-offset-4 {margin-left:33.33333333%}
|
||||
.col-xs-offset-3 {margin-left:25%}
|
||||
.col-xs-offset-2 {margin-left:16.66666667%}
|
||||
.col-xs-offset-1 {margin-left:8.33333333%}
|
||||
.col-xs-offset-0 {margin-left:0%}
|
||||
@media (min-width:768px) {.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12 {float:left }.col-sm-12 {width:100% }.col-sm-11 {width:91.66666667% }.col-sm-10 {width:83.33333333% }.col-sm-9 {width:75% }.col-sm-8 {width:66.66666667% }.col-sm-7 {width:58.33333333% }.col-sm-6 {width:50% }.col-sm-5 {width:41.66666667% }.col-sm-4 {width:33.33333333% }.col-sm-3 {width:25% }.col-sm-2 {width:16.66666667% }.col-sm-1 {width:8.33333333% }.col-sm-pull-12 {right:100% }.col-sm-pull-11 {right:91.66666667% }.col-sm-pull-10 {right:83.33333333% }.col-sm-pull-9 {right:75% }.col-sm-pull-8 {right:66.66666667% }.col-sm-pull-7 {right:58.33333333% }.col-sm-pull-6 {right:50% }.col-sm-pull-5 {right:41.66666667% }.col-sm-pull-4 {right:33.33333333% }.col-sm-pull-3 {right:25% }.col-sm-pull-2 {right:16.66666667% }.col-sm-pull-1 {right:8.33333333% }.col-sm-pull-0 {right:0% }.col-sm-push-12 {left:100% }.col-sm-push-11 {left:91.66666667% }.col-sm-push-10 {left:83.33333333% }.col-sm-push-9 {left:75% }.col-sm-push-8 {left:66.66666667% }.col-sm-push-7 {left:58.33333333% }.col-sm-push-6 {left:50% }.col-sm-push-5 {left:41.66666667% }.col-sm-push-4 {left:33.33333333% }.col-sm-push-3 {left:25% }.col-sm-push-2 {left:16.66666667% }.col-sm-push-1 {left:8.33333333% }.col-sm-push-0 {left:0% }.col-sm-offset-12 {margin-left:100% }.col-sm-offset-11 {margin-left:91.66666667% }.col-sm-offset-10 {margin-left:83.33333333% }.col-sm-offset-9 {margin-left:75% }.col-sm-offset-8 {margin-left:66.66666667% }.col-sm-offset-7 {margin-left:58.33333333% }.col-sm-offset-6 {margin-left:50% }.col-sm-offset-5 {margin-left:41.66666667% }.col-sm-offset-4 {margin-left:33.33333333% }.col-sm-offset-3 {margin-left:25% }.col-sm-offset-2 {margin-left:16.66666667% }.col-sm-offset-1 {margin-left:8.33333333% }.col-sm-offset-0 {margin-left:0% }}
|
||||
@media (min-width:992px) {.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12 {float:left }.col-md-12 {width:100% }.col-md-11 {width:91.66666667% }.col-md-10 {width:83.33333333% }.col-md-9 {width:75% }.col-md-8 {width:66.66666667% }.col-md-7 {width:58.33333333% }.col-md-6 {width:50% }.col-md-5 {width:41.66666667% }.col-md-4 {width:33.33333333% }.col-md-3 {width:25% }.col-md-2 {width:16.66666667% }.col-md-1 {width:8.33333333% }.col-md-pull-12 {right:100% }.col-md-pull-11 {right:91.66666667% }.col-md-pull-10 {right:83.33333333% }.col-md-pull-9 {right:75% }.col-md-pull-8 {right:66.66666667% }.col-md-pull-7 {right:58.33333333% }.col-md-pull-6 {right:50% }.col-md-pull-5 {right:41.66666667% }.col-md-pull-4 {right:33.33333333% }.col-md-pull-3 {right:25% }.col-md-pull-2 {right:16.66666667% }.col-md-pull-1 {right:8.33333333% }.col-md-pull-0 {right:0% }.col-md-push-12 {left:100% }.col-md-push-11 {left:91.66666667% }.col-md-push-10 {left:83.33333333% }.col-md-push-9 {left:75% }.col-md-push-8 {left:66.66666667% }.col-md-push-7 {left:58.33333333% }.col-md-push-6 {left:50% }.col-md-push-5 {left:41.66666667% }.col-md-push-4 {left:33.33333333% }.col-md-push-3 {left:25% }.col-md-push-2 {left:16.66666667% }.col-md-push-1 {left:8.33333333% }.col-md-push-0 {left:0% }.col-md-offset-12 {margin-left:100% }.col-md-offset-11 {margin-left:91.66666667% }.col-md-offset-10 {margin-left:83.33333333% }.col-md-offset-9 {margin-left:75% }.col-md-offset-8 {margin-left:66.66666667% }.col-md-offset-7 {margin-left:58.33333333% }.col-md-offset-6 {margin-left:50% }.col-md-offset-5 {margin-left:41.66666667% }.col-md-offset-4 {margin-left:33.33333333% }.col-md-offset-3 {margin-left:25% }.col-md-offset-2 {margin-left:16.66666667% }.col-md-offset-1 {margin-left:8.33333333% }.col-md-offset-0 {margin-left:0% }}
|
||||
@media (min-width:1200px) {.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12 {float:left }.col-lg-12 {width:100% }.col-lg-11 {width:91.66666667% }.col-lg-10 {width:83.33333333% }.col-lg-9 {width:75% }.col-lg-8 {width:66.66666667% }.col-lg-7 {width:58.33333333% }.col-lg-6 {width:50% }.col-lg-5 {width:41.66666667% }.col-lg-4 {width:33.33333333% }.col-lg-3 {width:25% }.col-lg-2 {width:16.66666667% }.col-lg-1 {width:8.33333333% }.col-lg-pull-12 {right:100% }.col-lg-pull-11 {right:91.66666667% }.col-lg-pull-10 {right:83.33333333% }.col-lg-pull-9 {right:75% }.col-lg-pull-8 {right:66.66666667% }.col-lg-pull-7 {right:58.33333333% }.col-lg-pull-6 {right:50% }.col-lg-pull-5 {right:41.66666667% }.col-lg-pull-4 {right:33.33333333% }.col-lg-pull-3 {right:25% }.col-lg-pull-2 {right:16.66666667% }.col-lg-pull-1 {right:8.33333333% }.col-lg-pull-0 {right:0% }.col-lg-push-12 {left:100% }.col-lg-push-11 {left:91.66666667% }.col-lg-push-10 {left:83.33333333% }.col-lg-push-9 {left:75% }.col-lg-push-8 {left:66.66666667% }.col-lg-push-7 {left:58.33333333% }.col-lg-push-6 {left:50% }.col-lg-push-5 {left:41.66666667% }.col-lg-push-4 {left:33.33333333% }.col-lg-push-3 {left:25% }.col-lg-push-2 {left:16.66666667% }.col-lg-push-1 {left:8.33333333% }.col-lg-push-0 {left:0% }.col-lg-offset-12 {margin-left:100% }.col-lg-offset-11 {margin-left:91.66666667% }.col-lg-offset-10 {margin-left:83.33333333% }.col-lg-offset-9 {margin-left:75% }.col-lg-offset-8 {margin-left:66.66666667% }.col-lg-offset-7 {margin-left:58.33333333% }.col-lg-offset-6 {margin-left:50% }.col-lg-offset-5 {margin-left:41.66666667% }.col-lg-offset-4 {margin-left:33.33333333% }.col-lg-offset-3 {margin-left:25% }.col-lg-offset-2 {margin-left:16.66666667% }.col-lg-offset-1 {margin-left:8.33333333% }.col-lg-offset-0 {margin-left:0% }}
|
||||
.clearfix:before,
|
||||
.clearfix:after,
|
||||
.container:before,
|
||||
.container:after,
|
||||
.container-fluid:before,
|
||||
.container-fluid:after,
|
||||
.row:before,
|
||||
.row:after {content:" ";display:table}
|
||||
.clearfix:after,
|
||||
.container:after,
|
||||
.container-fluid:after,
|
||||
.row:after {clear:both}
|
||||
.center-block {display:block;margin-left:auto;margin-right:auto}
|
||||
.pull-right {float:right !important}
|
||||
.pull-left {float:left !important}
|
||||
.hide {display:none !important}
|
||||
.show {display:block !important}
|
||||
.invisible {visibility:hidden}
|
||||
.text-hide {font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}
|
||||
.hidden {display:none !important;visibility:hidden !important}
|
||||
.affix {position:fixed}
|
||||
@-ms-viewport {width:device-width}
|
||||
.visible-xs,
|
||||
.visible-sm,
|
||||
.visible-md,
|
||||
.visible-lg {display:none !important}
|
||||
@media (max-width:767px) {.visible-xs {display:block !important }table.visible-xs {display:table }tr.visible-xs {display:table-row !important }th.visible-xs,td.visible-xs {display:table-cell !important }}
|
||||
@media (min-width:768px) and (max-width:991px) {.visible-sm {display:block !important }table.visible-sm {display:table }tr.visible-sm {display:table-row !important }th.visible-sm,td.visible-sm {display:table-cell !important }}
|
||||
@media (min-width:992px) and (max-width:1199px) {.visible-md {display:block !important }table.visible-md {display:table }tr.visible-md {display:table-row !important }th.visible-md,td.visible-md {display:table-cell !important }}
|
||||
@media (min-width:1200px) {.visible-lg {display:block !important }table.visible-lg {display:table }tr.visible-lg {display:table-row !important }th.visible-lg,td.visible-lg {display:table-cell !important }}
|
||||
@media (max-width:767px) {.hidden-xs {display:none !important }}
|
||||
@media (min-width:768px) and (max-width:991px) {.hidden-sm {display:none !important }}
|
||||
@media (min-width:992px) and (max-width:1199px) {.hidden-md {display:none !important }}
|
||||
@media (min-width:1200px) {.hidden-lg {display:none !important }}
|
||||
.visible-print {display:none !important}
|
||||
@media print {.visible-print {display:block !important }table.visible-print {display:table }tr.visible-print {display:table-row !important }th.visible-print,td.visible-print {display:table-cell !important }}
|
||||
@media print {.hidden-print {display:none !important }}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
.h1,
|
||||
.h2,
|
||||
.h3,
|
||||
.h4,
|
||||
.h5,
|
||||
.h6 {font-family:inherit;font-weight:400;line-height:1.1;color:inherit}
|
||||
h1 small,
|
||||
h2 small,
|
||||
h3 small,
|
||||
h4 small,
|
||||
h5 small,
|
||||
h6 small,
|
||||
.h1 small,
|
||||
.h2 small,
|
||||
.h3 small,
|
||||
.h4 small,
|
||||
.h5 small,
|
||||
.h6 small,
|
||||
h1 .small,
|
||||
h2 .small,
|
||||
h3 .small,
|
||||
h4 .small,
|
||||
h5 .small,
|
||||
h6 .small,
|
||||
.h1 .small,
|
||||
.h2 .small,
|
||||
.h3 .small,
|
||||
.h4 .small,
|
||||
.h5 .small,
|
||||
.h6 .small {font-weight:normal;line-height:1;color:#999}
|
||||
h1,
|
||||
.h1,
|
||||
h2,
|
||||
.h2,
|
||||
h3,
|
||||
.h3 {margin-top:20px;margin-bottom:10px}
|
||||
h1 small,
|
||||
.h1 small,
|
||||
h2 small,
|
||||
.h2 small,
|
||||
h3 small,
|
||||
.h3 small,
|
||||
h1 .small,
|
||||
.h1 .small,
|
||||
h2 .small,
|
||||
.h2 .small,
|
||||
h3 .small,
|
||||
.h3 .small {font-size:65%}
|
||||
h4,
|
||||
.h4,
|
||||
h5,
|
||||
.h5,
|
||||
h6,
|
||||
.h6 {margin-top:10px;margin-bottom:10px}
|
||||
h4 small,
|
||||
.h4 small,
|
||||
h5 small,
|
||||
.h5 small,
|
||||
h6 small,
|
||||
.h6 small,
|
||||
h4 .small,
|
||||
.h4 .small,
|
||||
h5 .small,
|
||||
.h5 .small,
|
||||
h6 .small,
|
||||
.h6 .small {font-size:75%}
|
||||
h1,
|
||||
.h1 {font-size:36px}
|
||||
h2,
|
||||
.h2 {font-size:30px}
|
||||
h3,
|
||||
.h3 {font-size:24px}
|
||||
h4,
|
||||
.h4 {font-size:18px}
|
||||
h5,
|
||||
.h5 {font-size:14px}
|
||||
h6,
|
||||
.h6 {font-size:12px}
|
||||
p {margin:0 0 10px}
|
||||
.lead {margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}
|
||||
@media (min-width:768px) {.lead {font-size:21px }}
|
||||
small,
|
||||
.small {font-size:85%}
|
||||
cite {font-style:normal}
|
||||
.text-left {text-align:left}
|
||||
.text-right {text-align:right}
|
||||
.text-center {text-align:center}
|
||||
.text-justify {text-align:justify}
|
||||
.text-muted {color:#999}
|
||||
.text-primary {color:#34495e}
|
||||
a.text-primary:hover {color:#222f3d}
|
||||
.text-success {color:#3c763d}
|
||||
a.text-success:hover {color:#2b542c}
|
||||
.text-info {color:#31708f}
|
||||
a.text-info:hover {color:#245269}
|
||||
.text-warning {color:#8a6d3b}
|
||||
a.text-warning:hover {color:#66512c}
|
||||
.text-danger {color:#a94442}
|
||||
a.text-danger:hover {color:#843534}
|
||||
.bg-primary {color:#fff;background-color:#34495e}
|
||||
a.bg-primary:hover {background-color:#222f3d}
|
||||
.bg-success {background-color:#dff0d8}
|
||||
a.bg-success:hover {background-color:#c1e2b3}
|
||||
.bg-info {background-color:#d9edf7}
|
||||
a.bg-info:hover {background-color:#afd9ee}
|
||||
.bg-warning {background-color:#fcf8e3}
|
||||
a.bg-warning:hover {background-color:#f7ecb5}
|
||||
.bg-danger {background-color:#f2dede}
|
||||
a.bg-danger:hover {background-color:#e4b9b9}
|
||||
.page-header {padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}
|
||||
ul,
|
||||
ol {margin-top:0;margin-bottom:10px}
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol,
|
||||
ol ol {margin-bottom:0}
|
||||
.list-unstyled {padding-left:0;list-style:none}
|
||||
.list-inline {padding-left:0;list-style:none;margin-left:-5px}
|
||||
.list-inline >li {display:inline-block;padding-left:5px;padding-right:5px}
|
||||
dl {margin-top:0;margin-bottom:20px}
|
||||
dt,
|
||||
dd {line-height:1.42857143}
|
||||
dt {font-weight:bold}
|
||||
dd {margin-left:0}
|
||||
@media (min-width:768px) {.dl-horizontal dt {float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap }.dl-horizontal dd {margin-left:180px }}
|
||||
abbr[title],
|
||||
abbr[data-original-title] {cursor:help;border-bottom:1px dotted #999}
|
||||
.initialism {font-size:90%;text-transform:uppercase}
|
||||
blockquote {padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}
|
||||
blockquote p:last-child,
|
||||
blockquote ul:last-child,
|
||||
blockquote ol:last-child {margin-bottom:0}
|
||||
blockquote footer,
|
||||
blockquote small,
|
||||
blockquote .small {display:block;font-size:80%;line-height:1.42857143;color:#999}
|
||||
blockquote footer:before,
|
||||
blockquote small:before,
|
||||
blockquote .small:before {content:'\2014 \00A0'}
|
||||
.blockquote-reverse,
|
||||
blockquote.pull-right {padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0;text-align:right}
|
||||
.blockquote-reverse footer:before,
|
||||
blockquote.pull-right footer:before,
|
||||
.blockquote-reverse small:before,
|
||||
blockquote.pull-right small:before,
|
||||
.blockquote-reverse .small:before,
|
||||
blockquote.pull-right .small:before {content:''}
|
||||
.blockquote-reverse footer:after,
|
||||
blockquote.pull-right footer:after,
|
||||
.blockquote-reverse small:after,
|
||||
blockquote.pull-right small:after,
|
||||
.blockquote-reverse .small:after,
|
||||
blockquote.pull-right .small:after {content:'\00A0 \2014'}
|
||||
blockquote:before,
|
||||
blockquote:after {content:""}
|
||||
address {margin-bottom:20px;font-style:normal;line-height:1.42857143}
|
||||
|
||||
.oc-icon-chain:before,
|
||||
.icon-chain:before,
|
||||
|
||||
.oc-icon-chain-broken:before,
|
||||
.icon-chain-broken:before {content:"\f127"}
|
||||
|
||||
.close {float:right;font-size:21px;font-weight:bold;line-height:1;color:#000;text-shadow:0 1px 0 #fff;font-family:sans-serif;opacity:0.2;filter:alpha(opacity=20)}
|
||||
.close:hover,
|
||||
.close:focus {color:#000;text-decoration:none;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}
|
||||
button.close {padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}
|
||||
@font-face {font-family:'FontAwesome';src:url('../library/font-awesome-4.7.0/fonts/fontawesome-webfont.eot?v=1.0.1');src:url('../library/font-awesome-4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=1.0.1') format('embedded-opentype'),url('../library/font-awesome-4.7.0/fonts/fontawesome-webfont.woff?v=1.0.1') format('woff'),url('../ui/font/fontawesome-webfont.ttf?v=1.0.1') format('truetype'),url('../library/font-awesome-4.7.0/fonts/fontawesome-webfont.svg#fontawesomeregular?v=1.0.1') format('svg');font-weight:normal;font-style:normal}
|
||||
[class^="icon-"],
|
||||
[class*=" icon-"] {font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;display:inline;width:auto;height:auto;line-height:normal;vertical-align:baseline;background-image:none;background-position:0% 0%;background-repeat:repeat;margin-top:0}
|
||||
[class^="icon-"]:before,
|
||||
[class*=" icon-"]:before {text-decoration:inherit;display:inline-block;speak:none}
|
||||
[class^="icon-"].pull-left,
|
||||
[class*=" icon-"].pull-left {margin-right:.3em}
|
||||
[class^="icon-"].pull-right,
|
||||
[class*=" icon-"].pull-right {margin-left:.3em}
|
||||
[class^="oc-icon-"]:before,
|
||||
[class*=" oc-icon-"]:before {display:inline-block;margin-right:8px;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;*margin-right:.3em;vertical-align:baseline}
|
||||
[class^="oc-icon-"].empty:before,
|
||||
[class*=" oc-icon-"].empty:before {margin-right:0}
|
||||
.icon-lg {font-size:1.33333333em;line-height:0.75em;vertical-align:-15%}
|
||||
.icon-2x {font-size:2em}
|
||||
.icon-3x {font-size:3em}
|
||||
.icon-4x {font-size:4em}
|
||||
.icon-5x {font-size:5em}
|
||||
body {padding-top:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";background:#f3f3f3;color:#405261}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5 {font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";text-transform:uppercase}
|
||||
h1 {font-weight:300;font-size:50px;margin-bottom:15px}
|
||||
h1 i[class^="icon-"]:before {font-size:46px}
|
||||
i[class^="icon-"].warning {color:#c84530}
|
||||
h3 {font-size:24px;font-weight:300}
|
||||
p.lead {font-size:16px;font-weight:300}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1><i class="icon-chain-broken warning"></i> Page not found</h1>
|
||||
<p class="lead">The requested page cannot be found.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,73 @@
|
||||
QUnit.module( "messages" );
|
||||
|
||||
QUnit.test( "predefined message not overwritten by addMethod( a, b, undefined )", function( assert ) {
|
||||
var message = "my custom message";
|
||||
$.validator.messages.custom = message;
|
||||
$.validator.addMethod( "custom", function() {} );
|
||||
assert.deepEqual( $.validator.messages.custom, message );
|
||||
delete $.validator.messages.custom;
|
||||
delete $.validator.methods.custom;
|
||||
} );
|
||||
|
||||
QUnit.test( "group error messages", function( assert ) {
|
||||
$.validator.addClassRules( {
|
||||
requiredDateRange: { required: true, date: true, dateRange: true }
|
||||
} );
|
||||
|
||||
$.validator.addMethod( "dateRange", function() {
|
||||
return new Date( $( "#fromDate" ).val() ) < new Date( $( "#toDate" ).val() );
|
||||
}, "Please specify a correct date range." );
|
||||
|
||||
var form = $( "#dateRangeForm" );
|
||||
form.validate( {
|
||||
errorElement: "span",
|
||||
groups: {
|
||||
dateRange: "fromDate toDate"
|
||||
},
|
||||
errorPlacement: function( error ) {
|
||||
form.find( ".errorContainer" ).append( error );
|
||||
}
|
||||
} );
|
||||
|
||||
assert.ok( !form.valid() );
|
||||
assert.equal( form.find( ".errorContainer *" ).length, 1 );
|
||||
assert.equal( form.find( ".errorContainer .error:not(input)" ).text(), "Please enter a valid date." );
|
||||
|
||||
$( "#fromDate" ).val( "12/03/2006" );
|
||||
$( "#toDate" ).val( "12/01/2006" );
|
||||
assert.ok( !form.valid() );
|
||||
assert.equal( form.find( ".errorContainer .error:not(input)" ).text(), "Please specify a correct date range." );
|
||||
|
||||
$( "#toDate" ).val( "12/04/2006" );
|
||||
assert.ok( form.valid() );
|
||||
assert.ok( form.find( ".errorContainer .error:not(input)" ).is( ":hidden" ) );
|
||||
} );
|
||||
|
||||
QUnit.test( "read messages from metadata", function( assert ) {
|
||||
var form = $( "#testForm9" ),
|
||||
e, g;
|
||||
|
||||
form.validate();
|
||||
e = $( "#testEmail9" );
|
||||
e.valid();
|
||||
assert.equal( form.find( "#testEmail9" ).next( ".error:not(input)" ).text(), "required" );
|
||||
e.val( "bla" ).valid();
|
||||
assert.equal( form.find( "#testEmail9" ).next( ".error:not(input)" ).text(), "email" );
|
||||
|
||||
g = $( "#testGeneric9" );
|
||||
g.valid();
|
||||
assert.equal( form.find( "#testGeneric9" ).next( ".error:not(input)" ).text(), "generic" );
|
||||
g.val( "bla" ).valid();
|
||||
assert.equal( form.find( "#testGeneric9" ).next( ".error:not(input)" ).text(), "email" );
|
||||
} );
|
||||
|
||||
QUnit.test( "read messages from metadata, with meta option specified, but no metadata in there", function( assert ) {
|
||||
var form = $( "#testForm1clean" );
|
||||
form.validate( {
|
||||
meta: "validate",
|
||||
rules: {
|
||||
firstnamec: "required"
|
||||
}
|
||||
} );
|
||||
assert.ok( !form.valid(), "not valid" );
|
||||
} );
|
||||
File diff suppressed because it is too large
Load diff
@@ -0,0 +1,412 @@
|
||||
QUnit.module( "rules" );
|
||||
|
||||
QUnit.test( "rules() - internal - input", function( assert ) {
|
||||
var element = $( "#firstname" );
|
||||
|
||||
$( "#testForm1" ).validate();
|
||||
|
||||
assert.deepEqual( element.rules(), { required: true, minlength: 2 } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), ignore method:false", function( assert ) {
|
||||
var element = $( "#firstnamec" );
|
||||
|
||||
$( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: { required: false, minlength: 2 }
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( element.rules(), { minlength: 2 } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() HTML5 required (no value)", function( assert ) {
|
||||
var element = $( "#testForm11text1" );
|
||||
|
||||
$( "#testForm11" ).validate();
|
||||
|
||||
assert.deepEqual( element.rules(), { required: true } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() - internal - select", function( assert ) {
|
||||
var element = $( "#meal" );
|
||||
|
||||
$( "#testForm3" ).validate();
|
||||
|
||||
assert.deepEqual( element.rules(), { required: true } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() - external", function( assert ) {
|
||||
var element = $( "#text1" );
|
||||
|
||||
$( "#form" ).validate( {
|
||||
rules: {
|
||||
action: { date: true, min: 5 }
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( element.rules(), { date: true, min: 5 } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() - external - complete form", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
|
||||
var methods = $.extend( {}, $.validator.methods ),
|
||||
messages = $.extend( {}, $.validator.messages ),
|
||||
v;
|
||||
|
||||
$.validator.addMethod( "verifyTest", function() {
|
||||
assert.ok( true, "method executed" );
|
||||
return true;
|
||||
} );
|
||||
v = $( "#form" ).validate( {
|
||||
rules: {
|
||||
action: { verifyTest: true }
|
||||
}
|
||||
} );
|
||||
v.form();
|
||||
|
||||
$.validator.methods = methods;
|
||||
$.validator.messages = messages;
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() - internal - input", function( assert ) {
|
||||
var element = $( "#form8input" );
|
||||
|
||||
$( "#testForm8" ).validate();
|
||||
|
||||
assert.deepEqual( element.rules(), { required: true, number: true, rangelength: [ 2, 8 ] } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), merge min/max to range, minlength/maxlength to rangelength", function( assert ) {
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
|
||||
$( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: {
|
||||
min: -15,
|
||||
max: 0
|
||||
},
|
||||
lastname: {
|
||||
minlength: 0,
|
||||
maxlength: 10
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { range: [ -15, 0 ] } );
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), { rangelength: [ 0, 10 ] } );
|
||||
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), guarantee that required is at front", function( assert ) {
|
||||
$( "#testForm1" ).validate();
|
||||
var v = $( "#v2" ).validate(),
|
||||
v1 = $( "#subformRequired" ).validate();
|
||||
function flatRules( element ) {
|
||||
var result = [];
|
||||
jQuery.each( $( element ).rules(), function( key ) { result.push( key ); } );
|
||||
return result.join( " " );
|
||||
}
|
||||
assert.equal( flatRules( "#firstname" ), "required minlength" );
|
||||
assert.equal( flatRules( "#v2-i6" ), "required minlength maxlength" );
|
||||
assert.equal( flatRules( "#co_name" ), "required maxlength" );
|
||||
|
||||
v.destroy();
|
||||
v1.destroy();
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
v = $( "#v2" ).validate();
|
||||
assert.equal( flatRules( "#v2-i6" ), "required rangelength" );
|
||||
|
||||
v1 = $( "#subformRequired" ).validate( {
|
||||
rules: {
|
||||
co_name: "required"
|
||||
}
|
||||
} );
|
||||
$( "#co_name" ).removeClass();
|
||||
assert.equal( flatRules( "#co_name" ), "required maxlength" );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), evaluate dynamic parameters", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
$( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: {
|
||||
min: function( element ) {
|
||||
assert.equal( $( "#firstnamec" )[ 0 ], element );
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { min: 12 } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), class and attribute combinations", function( assert ) {
|
||||
|
||||
$.validator.addMethod( "customMethod1", function() {
|
||||
return false;
|
||||
}, "" );
|
||||
$.validator.addMethod( "customMethod2", function() {
|
||||
return false;
|
||||
}, "" );
|
||||
|
||||
$( "#v2" ).validate( {
|
||||
rules: {
|
||||
"v2-i7": {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
customMethod: true
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( $( "#v2-i1" ).rules(), { required: true } );
|
||||
assert.deepEqual( $( "#v2-i2" ).rules(), { required: true, email: true } );
|
||||
assert.deepEqual( $( "#v2-i3" ).rules(), { url: true } );
|
||||
assert.deepEqual( $( "#v2-i4" ).rules(), { required: true, minlength: 2 } );
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" } );
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), { required: true, customMethod1: "123", rangelength: [ 2, 5 ] } );
|
||||
assert.deepEqual( $( "#v2-i6" ).rules(), { required: true, customMethod2: true, rangelength: [ 2, 5 ] } );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
assert.deepEqual( $( "#v2-i7" ).rules(), { required: true, minlength: 2, customMethod: true } );
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
delete $.validator.methods.customMethod2;
|
||||
delete $.validator.messages.customMethod2;
|
||||
delete $.validator.classRuleSettings.customMethod2;
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), dependency checks", function( assert ) {
|
||||
var v = $( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: {
|
||||
min: {
|
||||
param: 5,
|
||||
depends: function( el ) {
|
||||
return ( /^a/ ).test( $( el ).val() );
|
||||
}
|
||||
}
|
||||
},
|
||||
lastname: {
|
||||
max: {
|
||||
param: 12
|
||||
},
|
||||
email: {
|
||||
depends: function() { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
} ),
|
||||
rules = $( "#firstnamec" ).rules();
|
||||
|
||||
assert.equal( v.objectLength( rules ), 0 );
|
||||
|
||||
$( "#firstnamec" ).val( "ab" );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { min: 5 } );
|
||||
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), { max: 12, email: true } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), add and remove", function( assert ) {
|
||||
$.validator.addMethod( "customMethod1", function() {
|
||||
return false;
|
||||
}, "" );
|
||||
$( "#v2" ).validate();
|
||||
$( "#v2-i5" ).removeClass( "required" ).removeAttr( "minlength maxlength" );
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), { customMethod1: "123" } );
|
||||
|
||||
$( "#v2-i5" ).addClass( "required" ).attr( {
|
||||
minlength: 2,
|
||||
maxlength: 5
|
||||
} );
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" } );
|
||||
|
||||
$( "#v2-i5" ).addClass( "email" ).attr( { min: 5 } );
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), { required: true, email: true, minlength: 2, maxlength: 5, min: 5, customMethod1: "123" } );
|
||||
|
||||
$( "#v2-i5" ).removeClass( "required email" ).removeAttr( "minlength maxlength customMethod1 min" );
|
||||
assert.deepEqual( $( "#v2-i5" ).rules(), {} );
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), add and remove static rules", function( assert ) {
|
||||
|
||||
$( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: "required date"
|
||||
}
|
||||
} );
|
||||
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { required: true, date: true } );
|
||||
|
||||
$( "#firstnamec" ).rules( "remove", "date" );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { required: true } );
|
||||
$( "#firstnamec" ).rules( "add", "email" );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { required: true, email: true } );
|
||||
|
||||
$( "#firstnamec" ).rules( "remove", "required" );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { email: true } );
|
||||
|
||||
assert.deepEqual( $( "#firstnamec" ).rules( "remove" ), { email: true } );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), {} );
|
||||
|
||||
$( "#firstnamec" ).rules( "add", "required email" );
|
||||
assert.deepEqual( $( "#firstnamec" ).rules(), { required: true, email: true } );
|
||||
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), {} );
|
||||
$( "#lastnamec" ).rules( "add", "required" );
|
||||
$( "#lastnamec" ).rules( "add", {
|
||||
minlength: 2
|
||||
} );
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), { required: true, minlength: 2 } );
|
||||
|
||||
var removedRules = $( "#lastnamec" ).rules( "remove", "required email" );
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), { minlength: 2 } );
|
||||
$( "#lastnamec" ).rules( "add", removedRules );
|
||||
assert.deepEqual( $( "#lastnamec" ).rules(), { required: true, minlength: 2 } );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), add messages", function( assert ) {
|
||||
$( "#firstnamec" ).attr( "title", null );
|
||||
var v = $( "#testForm1clean" ).validate( {
|
||||
rules: {
|
||||
firstnamec: "required"
|
||||
}
|
||||
} );
|
||||
$( "#testForm1clean" ).valid();
|
||||
$( "#firstnamec" ).valid();
|
||||
assert.deepEqual( v.settings.messages.firstname, undefined );
|
||||
|
||||
$( "#firstnamec" ).rules( "add", {
|
||||
messages: {
|
||||
required: "required"
|
||||
}
|
||||
} );
|
||||
|
||||
$( "#firstnamec" ).valid();
|
||||
assert.deepEqual( v.errorList[ 0 ] && v.errorList[ 0 ].message, "required" );
|
||||
|
||||
$( "#firstnamec" ).val( "test" );
|
||||
$( "#firstnamec" ).valid();
|
||||
assert.equal( v.errorList.length, 0 );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), rangelength attribute as array", function( assert ) {
|
||||
$( "#testForm13" ).validate();
|
||||
assert.deepEqual( $( "#cars-select" ).rules(), {
|
||||
required: true,
|
||||
rangelength: [ 2, 3 ]
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules(), global/local normalizer", function( assert ) {
|
||||
var username = $( "#usernamec" ),
|
||||
urlc = $( "#urlc" ),
|
||||
lastname = $( "#lastnamec" ),
|
||||
v;
|
||||
|
||||
username.val( "\t\t \r" );
|
||||
urlc.val( "" );
|
||||
|
||||
v = $( "#testForm1clean" ).validate( {
|
||||
|
||||
// Using the normalizer to trim the value of all elements before validating them.
|
||||
normalizer: function( value ) {
|
||||
|
||||
// This normalizer should only be called for the username element, and nothing else.
|
||||
assert.notEqual( this, urlc[ 0 ], "This normalizer should not be called for urlc element." );
|
||||
assert.equal( this, username[ 0 ], "`this` in this normalizer should be the username element." );
|
||||
|
||||
// Trim the value of the input
|
||||
return $.trim( value );
|
||||
},
|
||||
|
||||
rules: {
|
||||
username: {
|
||||
required: true
|
||||
},
|
||||
urlc: {
|
||||
required: true,
|
||||
url: true,
|
||||
|
||||
// Using the normalizer to append https:// if it's not
|
||||
// present on the input value
|
||||
normalizer: function( value ) {
|
||||
assert.equal( this, urlc[ 0 ], "`this` in the normalizer should be the urlc element." );
|
||||
|
||||
var url = value;
|
||||
|
||||
// Check if it doesn't start with http:// or https:// or ftp://
|
||||
if ( url && url.substr( 0, 7 ) !== "http://" &&
|
||||
url.substr( 0, 8 ) !== "https://" &&
|
||||
url.substr( 0, 6 ) !== "ftp://" ) {
|
||||
|
||||
// Then prefix with http:// or even https://
|
||||
url = "https://" + url;
|
||||
}
|
||||
|
||||
// Return the new url
|
||||
return url;
|
||||
}
|
||||
},
|
||||
lastname: {
|
||||
required: true,
|
||||
normalizer: function( value ) {
|
||||
assert.equal( this, lastname[ 0 ], "`this` in the normalizer should be the lastname element." );
|
||||
|
||||
// Return null in order to make sure an exception is thrown
|
||||
// when normalizer returns a non string value.
|
||||
value = null;
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// Validate only the username and the url elements.
|
||||
username.valid();
|
||||
assert.equal( v.invalidElements()[ 0 ], username[ 0 ], "The username should be invalid" );
|
||||
|
||||
urlc.valid();
|
||||
assert.equal( v.invalidElements()[ 0 ], urlc[ 0 ], "The url should be invalid" );
|
||||
|
||||
assert.equal( v.numberOfInvalids(), 2, "There is two invalid elements" );
|
||||
|
||||
username.val( "something" );
|
||||
urlc.val( "google.com" );
|
||||
|
||||
username.trigger( "keyup" );
|
||||
urlc.trigger( "keyup" );
|
||||
|
||||
assert.equal( v.numberOfInvalids(), 0, "All elements are valid" );
|
||||
assert.equal( v.size(), 0, "All elements are valid" );
|
||||
|
||||
// Validate the lastname element, which will throw an exception
|
||||
assert.throws( function() {
|
||||
v.check( lastname[ 0 ] );
|
||||
}, function( err ) {
|
||||
return err.name === "TypeError" && err.message === "The normalizer should return a string value.";
|
||||
}, "This should throw a TypeError exception." );
|
||||
} );
|
||||
|
||||
QUnit.test( "rules() - on unexpected input", function( assert ) {
|
||||
var emptySet = $( "#firstname .mynonexistantclass" ),
|
||||
nonFormElement = $( "div#foo" ),
|
||||
result;
|
||||
|
||||
result = emptySet.rules( "add", "whatever" );
|
||||
assert.deepEqual( result, undefined, "can work on an empty set without a js error" );
|
||||
|
||||
result = nonFormElement.rules( "add", "whatever" );
|
||||
assert.deepEqual( result, undefined, "can work on a non-form element" );
|
||||
} );
|
||||
File diff suppressed because it is too large
Load diff
Reference in New Issue
Block a user