ggdworkshop/lib/jquery/jquery-validation/test/aria.js
German Correa 9bb8198f1e Ajustes de formulario y js-lib ordering
Agrega librerias y temas gráficos de forma local, no cdn,
directorio local lib

Formulario de registro:
    - select se hacen con select2, falta validarlos
    - validación de nombre, apellido y mail ya funcionando con
    jquery-validate
    - arregla temas gráficos y de presentación
  FALTA:
    - validar los select
    - validar los radiobutton
    - TODA LA PUTA LOGICA DE BACK-END DE NUEVO!!!
2017-11-29 18:15:01 -03:00

47 lines
1.3 KiB
JavaScript

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" );
} );