Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test improvements

* Fixed broken IE8 tests
* Added saucelabs support (automated unit tests in the cloud)
* Added IE10 tests
  • Loading branch information...
commit cf95a8e8361da6780de3ddc3d298693aac473fbe 1 parent 258b01b
Eric Elliott authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+node_modules
+buildconfig.env
View
3  buildconfig.env.example
@@ -0,0 +1,3 @@
+export sauceport=5555
+export sauceuser=<yourusername>
+export saucekey=<yoursaucekey>
View
52 grunt.js
@@ -1,4 +1,5 @@
/*global module*/
+var pkgData = require('./package.json');
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
@@ -19,14 +20,57 @@ module.exports = function(grunt) {
undef: true,
unused: true,
eqnull: true,
- browser: true,
+ node: true,
strict: true,
boss: false
}
},
- qunit: {
- browser: ['test/index.html']
+
+ server: {
+ port: process.env.sauceport
+ },
+
+ 'saucelabs-qunit': {
+ all: {
+ username: process.env.sauceuser,
+ key: process.env.saucekey,
+ urls: ['http://127.0.0.1:' +
+ process.env.sauceport + '/test/index.html'],
+ tunnelTimeout: ['10000'],
+ testname: pkgData.name,
+ tags: [''],
+ browsers: [
+ {
+ browserName: 'chrome'
+ },
+ {
+ browserName: 'internet explorer',
+ platform: 'Windows 2003',
+ version: '8'
+ },
+ {
+ browserName: 'internet explorer'
+ },
+ {
+ browserName: 'firefox'
+ },
+ {
+ browserName: 'safari',
+ platform: 'Mac 10.8',
+ version: '6'
+ },
+ {
+ browserName: 'internet explorer',
+ platform: 'Windows 2012',
+ version: '10'
+ }
+ ]
+ }
}
});
- grunt.registerTask('default', 'lint qunit');
+ console.log(process.env.sauceuser);
+ grunt.loadNpmTasks('grunt-saucelabs');
+
+ grunt.registerTask('default', 'lint');
+ grunt.registerTask('test', 'lint server saucelabs-qunit');
};
View
16 package.json
@@ -1,6 +1,6 @@
{
"name": "h5Validate",
- "version": "0.8.4",
+ "version": "0.9.0",
"description": "HTML5 form validation",
"author": {
"name": "Eric Elliott",
@@ -17,18 +17,12 @@
"type": "git",
"url": "https://github.com/dilvie/h5Validate.git"
},
- "directories": {
- "test": "./test",
- "lib": "./lib",
- "scripts": "./scripts",
- "dist": "./dist"
- },
- "dependencies": {
- "fs-extra": "~0.1.x",
- "grunt": "~0.3.x"
+ "devDependencies": {
+ "grunt": "*",
+ "grunt-saucelabs": "*"
},
"scripts": {
- "test": "grunt"
+ "test": "./scripts/test.sh"
},
"engines": {
"node": "~0.x.x"
View
4 scripts/test.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+source buildconfig.env
+grunt test
View
25 test/test.h5validate.js
@@ -166,9 +166,6 @@
'All radio buttons should be valid as soon as any one is selected');
});
- // Todo: test allValid. Make sure to call it more than once and ensure that
- // behavior remains consistent.
-
test('Issue #43: data-h5-errorid doesn\'t work with square brackets', function () {
var $container = $('<div id="idTestContainer">'),
$input = $('<input>', {
@@ -218,23 +215,27 @@
$num = $('<input type="text" class="h5-number" required="required"></input>')
.appendTo($form),
validValues = ['.3', '0.3', '9999999.9', '10', '-1', '-2.99'],
- invalidValues = ['a', '2.x', 'x.2'];
+ invalidValues = ['a', '2.x', 'x.2'],
+ i = validValues.length,
+ j = invalidValues.length;
$form
.appendTo('body')
.h5Validate();
- validValues.forEach(function (num) {
- $num.val(num).trigger('keyup');
+ while (i) {
+ $num.val(i).trigger('keyup');
ok($num.h5Validate('isValid'),
- 'Valid number, ' + num +' should pass validation.');
- });
+ 'Valid number, ' + i +' should pass validation.');
+ i--;
+ };
- invalidValues.forEach(function (num) {
- $num.val(num).trigger('keyup');
+ while (i) {
+ $num.val(i).trigger('keyup');
ok(!$num.h5Validate('isValid'),
- 'Invalid number, ' + num +' should not pass validation.');
- });
+ 'Invalid number, ' + i +' should not pass validation.');
+ i--;
+ };
$form.empty().remove();
});
Please sign in to comment.
Something went wrong with that request. Please try again.