Created
September 16, 2014 09:48
-
-
Save mlewand/ebdb9ff72c74f6c74bc1 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>title</title> | |
</head> | |
<body> | |
<div id="sampleContent"> | |
<p>Short date <font>10.02.2011</font></p> | |
</div> | |
<script src="lib/jquery/jquery.js"></script> | |
<script src="dist/quail.jquery.js"></script> | |
<script> | |
function testCollectionComplete( collection ) { | |
// Iterating over Test objects... | |
// In this case we're limited to one test, so we can exec assertion | |
// in each() function. | |
collection.each( function( testIndex, testInstance ) { | |
// Count of failed tested cases. | |
var actualFailedCases = 0, | |
// Expected failed cases count. | |
expectedFailedCases = 0; | |
// Iterating over each case... | |
testInstance.each( function( index, testCase ) { | |
if ( testCase.get( 'status' ) == 'failed' ) { | |
actualFailedCases += 1; | |
} | |
} ); | |
// Lets check if the expected and actual cases count is the same. | |
if ( actualFailedCases === expectedFailedCases ) { | |
alert( 'OK' ); | |
} else { | |
alert( 'Invalid len ' + actualFailedCases + ', expected: ' + expectedFailedCases ); | |
} | |
} ); | |
} | |
setTimeout( function() { | |
// Execute Quail checking after small timeout. | |
$( '#sampleContent' ).quail( { | |
guideline : [ 'KINGUseLongDateFormat' ], | |
jsonPath: 'dist/', | |
testCollectionComplete: function ( eventName, testCollection ) { | |
testCollectionComplete( testCollection ); | |
} | |
} ); | |
}, 300 ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment