Skip to content

Commit

Permalink
update continuous integration configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
crissdev committed Oct 5, 2019
1 parent 6cf0c77 commit 0a5bc13
Show file tree
Hide file tree
Showing 10 changed files with 536 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ indent_size = 4

[*.md]
trim_trailing_whitespace = false

[package.json]
indent_style = space
indent_size = 2
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
language: node_js
node_js:
- "0.10"
- 8
- 10
- 12
sudo: false
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A KnockoutJS Plugin for model and property validation

[![Build Status](https://travis-ci.org/Knockout-Contrib/Knockout-Validation.svg)](https://travis-ci.org/Knockout-Contrib/Knockout-Validation)
[![Build status](https://ci.appveyor.com/api/projects/status/rmas31qgmi07wypi/branch/master?svg=true)](https://ci.appveyor.com/project/crissdev/knockout-validation/branch/master)
[![Bower version](https://badge.fury.io/bo/knockout-validation.svg)](http://badge.fury.io/bo/knockout-validation)
[![npm version](https://badge.fury.io/js/knockout.validation.svg)](http://badge.fury.io/js/knockout.validation)
[![NuGet version](https://badge.fury.io/nu/Knockout.Validation.svg)](http://badge.fury.io/nu/Knockout.Validation)
Expand All @@ -10,6 +11,7 @@ Contributors:

* [Eric Barnard](https://github.com/ericmbarnard)
* [Steve Greatrex](https://github.com/stevegreatrex)
* [Cristian Trifan](https://github.com/crissdev)
* [Andy Booth](https://github.com/andybooth)
* [Michal Poreba](https://github.com/michalporeba)
* and many others!
Expand Down
23 changes: 23 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '{build}'

environment:
matrix:
- nodejs_version: 8
- nodejs_version: 10
- nodejs_version: 12

platform:
- x64

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- npm install

cache: '%AppData%/npm-cache'

build: off

test_script:
- node --version
- npm --version
- npm test
2 changes: 1 addition & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = function (grunt) {
}
},
qunit: {
files: ["test/test-runner.htm"]
files: ["test/test-runner-2.3.0.html", "test/test-runner-3.4.2.html", "test/test-runner-3.5.0.html"]
},
jshint: {
files: ["gruntfile.js", "src/**/*.js", "test/*.js", "localization/*.js"],
Expand Down
88 changes: 88 additions & 0 deletions test/lib/knockout-2.3.0.js

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions test/lib/knockout-3.4.2.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/test-runner.htm → test/test-runner-2.3.0.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<script src="lib/qunit-1.17.1.js" type="text/javascript"></script>
<!--We only include jQuery for testing purposes (testing UI changes)-->
<script src="lib/jquery-2.1.3.js" type="text/javascript"></script>
<script src="lib/knockout-3.5.0.js" type="text/javascript"></script>
<script src="lib/knockout-2.3.0.js" type="text/javascript"></script>
<script src="../dist/knockout.validation.js" type="text/javascript"></script>

<script src="../localization/ar-JO.js" type="text/javascript"></script>
Expand Down Expand Up @@ -48,7 +48,7 @@
<script src="rules-tests.js" type="text/javascript"></script>
<script src="locale-tests.js" type="text/javascript"></script>

<title>Knockout JS Validation Tests</title>
<title>Knockout JS Validation Tests (KnockoutJS v2.3.0)</title>
<style type="text/css">
label { display: block; }
.validationMessage { color: Red; }
Expand Down
144 changes: 144 additions & 0 deletions test/test-runner-3.4.2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html>
<head>
<link href="lib/qunit-1.17.1.css" rel="stylesheet" type="text/css" />
<script src="lib/qunit-1.17.1.js"></script>
<!--We only include jQuery for testing purposes (testing UI changes)-->
<script src="lib/jquery-2.1.3.js"></script>
<script src="lib/knockout-3.4.2.js"></script>
<script src="../dist/knockout.validation.js"></script>

<script src="../localization/ar-JO.js"></script>
<script src="../localization/bg-BG.js"></script>
<script src="../localization/ca-ES.js"></script>
<script src="../localization/cs-CZ.js"></script>
<script src="../localization/da-DK.js"></script>
<script src="../localization/de-DE.js"></script>
<script src="../localization/el-GR.js"></script>
<script src="../localization/en-US.js"></script>
<script src="../localization/es-ES.js"></script>
<script src="../localization/fa-IR.js"></script>
<script src="../localization/fr-FR.js"></script>
<script src="../localization/he-IL.js"></script>
<script src="../localization/hr-HR.js"></script>
<script src="../localization/hu-HU.js"></script>
<script src="../localization/it-IT.js"></script>
<script src="../localization/ja-JP.js"></script>
<script src="../localization/ko-KR.js"></script>
<script src="../localization/lv-LV.js"></script>
<script src="../localization/nb-NO.js"></script>
<script src="../localization/nl-BE.js"></script>
<script src="../localization/nl-NL.js"></script>
<script src="../localization/pl-PL.js"></script>
<script src="../localization/pt-BR.js"></script>
<script src="../localization/pt-PT.js"></script>
<script src="../localization/ro-RO.js"></script>
<script src="../localization/ru-RU.js"></script>
<script src="../localization/sv-SE.js"></script>
<script src="../localization/tr-TR.js"></script>
<script src="../localization/zh-CN.js"></script>
<script src="../localization/zh-TW.js"></script>

<!--test Scripts here-->
<script src="asserts.js"></script>
<script src="validation-tests.js"></script>
<script src="validation-ui-tests.js"></script>
<script src="utils-tests.js"></script>
<script src="api-tests.js"></script>
<script src="rules-tests.js"></script>
<script src="locale-tests.js"></script>

<title>Knockout JS Validation Tests (KnockoutJS v3.4.2)</title>
<style type="text/css">
label { display: block; }
.validationMessage { color: Red; }
.customMessage { color: Orange; }
</style>
</head>
<body>
<div id="qunit"></div>
<div id="testContainer"></div>
<div id="workbench">
<script>
var captcha = function (val) {
return val == 11;
};

var mustEqual = function (val, other) {
return val == other;
};

var viewModel = {
firstName: ko.observable().extend({ minLength: 2, maxLength: 10 }),
lastName: ko.observable().extend({ required: { message: 'lastName is required' } }),
emailAddress: ko.observable().extend({ // custom message
required: { message: 'Please supply your email address.' }
}),
age: ko.observable().extend({ min: 1, max: 100 }),
location: ko.observable(),
subscriptionOptions: ['Technology', 'Music'],
subscription: ko.observable().extend({ required: { message: 'subscription is required' } }),
password: ko.observable(),
captcha: ko.observable().extend({ // custom Anonymous validator
validation: { validator: captcha, message: 'Please check.' }
}),
submit: function () {
if (viewModel.errors().length == 0) {
alert('Thank you.');
} else {
alert('Please check your submission.');
viewModel.errors.showAllMessages();
}
}
};

viewModel.confirmPassword = ko.observable().extend({
required: true,
validation: { validator: mustEqual, message: 'Passwords do not match.', params: viewModel.password }
});

viewModel.errors = ko.validation.group(viewModel);

viewModel.requireLocation = function () {
viewModel.location.extend({ required: { message: 'location is required' } });
};
</script>
<script id="customMessageTemplate" type="text/html">
<em class="customMessage" data-bind='validationMessage: field'></em>
</script>
<fieldset>
<legend>User: <span id="errorCount" data-bind='text: errors().length'></span> errors</legend>
<label>First name: <input id="firstNameTxt" data-bind='value: firstName'/></label>
<label>Last name: <input id="lastNameTxt" data-bind='value: lastName'/></label>
<div data-bind='validationOptions: { messageTemplate: "customMessageTemplate" }'>
<label>Email: <input id="emailAddressTxt" data-bind='value: emailAddress' required pattern="@"/></label>
<label>Location: <input id="locationTxt" data-bind='value: location'/></label>
<label>Age: <input id="testAgeInput" data-bind='value: age' required/></label>
</div>
<label>
Subscriptions:
<select data-bind='value: subscription, options: subscriptionOptions, optionsCaption: "Choose one..."'></select>
</label>
<label>Password: <input data-bind='value: password' type="password"/></label>
<label>Retype password: <input data-bind='value: confirmPassword' type="password"/></label>
<label>10 + 1 = <input data-bind='value: captcha'/></label>
</fieldset>
<button type="button" data-bind='click: submit'>Submit</button>
<br />
<br />
<button type="button" data-bind='click: requireLocation'>Make 'Location' required</button>
<script>
$(function() {
ko.applyBindings(viewModel, $('#workbench')[0]);

QUnit.module('Workbench Tests');

QUnit.test('Reports Correct Amount of Starting Errors', function(assert) {
var cnt = $('#errorCount').text();
assert.strictEqual(cnt, '5', 'Init was not called, and the correct number of errors was evaluated');
});
});
</script>
</div>
</body>
</html>
144 changes: 144 additions & 0 deletions test/test-runner-3.5.0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html>
<head>
<link href="lib/qunit-1.17.1.css" rel="stylesheet" type="text/css" />
<script src="lib/qunit-1.17.1.js"></script>
<!--We only include jQuery for testing purposes (testing UI changes)-->
<script src="lib/jquery-2.1.3.js"></script>
<script src="lib/knockout-3.5.0.js"></script>
<script src="../dist/knockout.validation.js"></script>

<script src="../localization/ar-JO.js"></script>
<script src="../localization/bg-BG.js"></script>
<script src="../localization/ca-ES.js"></script>
<script src="../localization/cs-CZ.js"></script>
<script src="../localization/da-DK.js"></script>
<script src="../localization/de-DE.js"></script>
<script src="../localization/el-GR.js"></script>
<script src="../localization/en-US.js"></script>
<script src="../localization/es-ES.js"></script>
<script src="../localization/fa-IR.js"></script>
<script src="../localization/fr-FR.js"></script>
<script src="../localization/he-IL.js"></script>
<script src="../localization/hr-HR.js"></script>
<script src="../localization/hu-HU.js"></script>
<script src="../localization/it-IT.js"></script>
<script src="../localization/ja-JP.js"></script>
<script src="../localization/ko-KR.js"></script>
<script src="../localization/lv-LV.js"></script>
<script src="../localization/nb-NO.js"></script>
<script src="../localization/nl-BE.js"></script>
<script src="../localization/nl-NL.js"></script>
<script src="../localization/pl-PL.js"></script>
<script src="../localization/pt-BR.js"></script>
<script src="../localization/pt-PT.js"></script>
<script src="../localization/ro-RO.js"></script>
<script src="../localization/ru-RU.js"></script>
<script src="../localization/sv-SE.js"></script>
<script src="../localization/tr-TR.js"></script>
<script src="../localization/zh-CN.js"></script>
<script src="../localization/zh-TW.js"></script>

<!--test Scripts here-->
<script src="asserts.js"></script>
<script src="validation-tests.js"></script>
<script src="validation-ui-tests.js"></script>
<script src="utils-tests.js"></script>
<script src="api-tests.js"></script>
<script src="rules-tests.js"></script>
<script src="locale-tests.js"></script>

<title>Knockout JS Validation Tests (KnockoutJS v3.5.0)</title>
<style type="text/css">
label { display: block; }
.validationMessage { color: Red; }
.customMessage { color: Orange; }
</style>
</head>
<body>
<div id="qunit"></div>
<div id="testContainer"></div>
<div id="workbench">
<script>
var captcha = function (val) {
return val == 11;
};

var mustEqual = function (val, other) {
return val == other;
};

var viewModel = {
firstName: ko.observable().extend({ minLength: 2, maxLength: 10 }),
lastName: ko.observable().extend({ required: { message: 'lastName is required' } }),
emailAddress: ko.observable().extend({ // custom message
required: { message: 'Please supply your email address.' }
}),
age: ko.observable().extend({ min: 1, max: 100 }),
location: ko.observable(),
subscriptionOptions: ['Technology', 'Music'],
subscription: ko.observable().extend({ required: { message: 'subscription is required' } }),
password: ko.observable(),
captcha: ko.observable().extend({ // custom Anonymous validator
validation: { validator: captcha, message: 'Please check.' }
}),
submit: function () {
if (viewModel.errors().length == 0) {
alert('Thank you.');
} else {
alert('Please check your submission.');
viewModel.errors.showAllMessages();
}
}
};

viewModel.confirmPassword = ko.observable().extend({
required: true,
validation: { validator: mustEqual, message: 'Passwords do not match.', params: viewModel.password }
});

viewModel.errors = ko.validation.group(viewModel);

viewModel.requireLocation = function () {
viewModel.location.extend({ required: { message: 'location is required' } });
};
</script>
<script id="customMessageTemplate" type="text/html">
<em class="customMessage" data-bind='validationMessage: field'></em>
</script>
<fieldset>
<legend>User: <span id="errorCount" data-bind='text: errors().length'></span> errors</legend>
<label>First name: <input id="firstNameTxt" data-bind='value: firstName'/></label>
<label>Last name: <input id="lastNameTxt" data-bind='value: lastName'/></label>
<div data-bind='validationOptions: { messageTemplate: "customMessageTemplate" }'>
<label>Email: <input id="emailAddressTxt" data-bind='value: emailAddress' required pattern="@"/></label>
<label>Location: <input id="locationTxt" data-bind='value: location'/></label>
<label>Age: <input id="testAgeInput" data-bind='value: age' required/></label>
</div>
<label>
Subscriptions:
<select data-bind='value: subscription, options: subscriptionOptions, optionsCaption: "Choose one..."'></select>
</label>
<label>Password: <input data-bind='value: password' type="password"/></label>
<label>Retype password: <input data-bind='value: confirmPassword' type="password"/></label>
<label>10 + 1 = <input data-bind='value: captcha'/></label>
</fieldset>
<button type="button" data-bind='click: submit'>Submit</button>
<br />
<br />
<button type="button" data-bind='click: requireLocation'>Make 'Location' required</button>
<script>
$(function() {
ko.applyBindings(viewModel, $('#workbench')[0]);

QUnit.module('Workbench Tests');

QUnit.test('Reports Correct Amount of Starting Errors', function(assert) {
var cnt = $('#errorCount').text();
assert.strictEqual(cnt, '5', 'Init was not called, and the correct number of errors was evaluated');
});
});
</script>
</div>
</body>
</html>

0 comments on commit 0a5bc13

Please sign in to comment.