Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Added Protractor tests and fixed issue #36
Browse files Browse the repository at this point in the history
- Added full End-to-End tests for all available Validators with
Protractor for both the Directive & Service
- Fixed issue #36 where the bower.json scripts order was incorrect
- Fixed a few minor bugs found when buildint Protractor tests
- Changed all location translation :param with {0}, {1} to follow a
better standard as C# String.Format()
  • Loading branch information
ghiscoding committed May 18, 2015
1 parent 1068062 commit 15b11e6
Show file tree
Hide file tree
Showing 24 changed files with 2,342 additions and 223 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
.addValidator('input14', 'alpha|required')
.addValidator('input15', 'alpha|min_len:3|required')
.addValidator('input16', 'match:input15,Password|required')
.addValidator({elmName: 'input17', rules: 'alpha_spaces|exact_len:3|required', debounce: 5000})
.addValidator({elmName: 'input17', rules: 'alpha_spaces|exact_len:3|required', debounce: 3000})
.addValidator('input18', 'date_iso_min:2001-01-01|required')
.addValidator('input19', 'date_us_short_between:11/28/99,12/31/15|required')
.addValidator('area1', 'alpha_dash_spaces|min_len:15|required');
Expand Down
10 changes: 3 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.3.23",
"version": "1.3.24",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": [
"locales/validation/en.js",
"locales/validation/fr.js",
"dist/angular-validation-allin1.min.js",
"dist/validation-common.min.js",
"dist/validation-directive.min.js",
"dist/validation-rules.min.js",
"dist/validation-service.min.js",
"src/validation-common.js",
"dist/angular-validation.min.js",
"src/validation-directive.js",
"src/validation-common.js",
"src/validation-rules.js",
"src/validation-service.js"
],
Expand Down
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ Angular-Validation change logs
1.3.20 (2015-04-21) Fixed issue #26 - validation of forms inside ng-repeat (added sample `dynamicFormView` in `more-examples` folder). And again issue #28 - unbind all 'blur' in cancelValidation() might affect other modules.
1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated.
1.3.22 (2015-05-03) Added new element attribute of `friendly-name` which is used ONLY in the ValidationSummary, this friendly name is to give a better element name display, which also support translation, inside the ValidationSummary instead of just "input1" (see ValidationSummary for more details).
1.3.23 (2015-05-05) Added option to display only last error message instead of all messages at once. Fixed a bug where changing route on View/Controller would make the ValidationSummary fail when coming back to original View/Controller, this bug was associated to the fact that the ValidationSummary kept growing from Controller to Controller, now this ValidationSummary is wipe out as soon as we detect a route change.
1.3.23 (2015-05-05) Added option to display only last error message instead of all messages at once. Fixed a bug where changing route on View/Controller would make the ValidationSummary fail when coming back to original View/Controller, this bug was associated to the fact that the ValidationSummary kept growing from Controller to Controller, now this ValidationSummary is wipe out as soon as we detect a route change.
1.3.24 (2015-05-17) Replaced all `:param` inside each locale translations with a better standard of {0}, {1}, etc.. like C# `String.Format()`. Added a full Protractor End-to-End test suite (1000+ asserts). Fixed a few minor bugs found with Protractor test cases. Fixed issue #36, bower.json scripts in wrong order.
10 changes: 5 additions & 5 deletions dist/angular-validation.min.js

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions full-tests/Directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<h3>Directive</h3>

<div class="checkbox text-right" style="margin-top:-25px">
<label>
<input type="checkbox" ng-model="displayValidationSummary"> {{ 'SHOW_VALIDATION_SUMMARY' | translate }}
</label>
</div>

<hr />

<!-- Angular-Validation saves the summary of errors inside 2 locations: 1- $scope.$validationSummary 2- $scope.formName.$validationSummary (only accessible if you named your form) so it becomes easy to show all errors -->
<div class="alert alert-danger alert-dismissable" ng-show="displayValidationSummary && form01.$validationSummary.length > 0">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="displayValidationSummary = false">&times;</button>
<h4><strong>{{ 'ERRORS' | translate }}!</strong></h4>
<ul>
<li ng-repeat="item in form01.$validationSummary">{{ item.friendlyName != '' ? item.friendlyName : item.field }}: {{item.message}}</li>
</ul>
</div>

<form novalidate name="form01" method="POST">
<div class="form-group row" ng-repeat="v in validations">
<label for="input{{$index}}">input{{$index}}</label>
<input class="form-control" type="text" name="input{{$index}}" ng-model="v.input$index" validation="required|{{v.validation == 'required' ? '' : v.validation}}">
</div>

<div class="form-actions">
<button type="submit" name="save_btn" class="btn btn-primary" ng-disabled="form01.$invalid">{{ 'SAVE' | translate }} (ngDisabled)</button>
<button type="submit" name="save_btn" class="btn btn-primary" ng-click="submitForm()">{{ 'SAVE' | translate }} (ngSubmit)</button>
</div>
</form>
Loading

0 comments on commit 15b11e6

Please sign in to comment.