Skip to content

Commit b07e6a5

Browse files
committed
removing q dependency, resolving build error Lazy undefined in unit tests
1 parent 7d8ae5a commit b07e6a5

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

app/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161

6262
<!-- build:js scripts/modules.js -->
6363
<script src="bower_components/lazy.js/lazy.js"></script>
64-
<script src="bower_components/lazy.js/lazy.browser.js"></script>
6564
<script src="bower_components/angular-resource/angular-resource.js"></script>
6665
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
6766
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>

app/scripts/directives/customvalidation/customValidations.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ angular_ui_form_validations = (function(){
22

33
var customValidations, createValidationFormatterLink, customValidationsModule, getValidationPriorityIndex, getValidationAttributeValue,
44
getValidatorByAttribute, getCustomTemplate, customTemplates, isCurrentlyDisplayingAnErrorMessageInATemplate,
5-
currentlyDisplayedTemplate, dynamicallyDefinedValidation, defaultFieldIsValidSuccessFn;
5+
currentlyDisplayedTemplate, dynamicallyDefinedValidation, defaultFieldIsValidSuccessFn, $q, $timeout, $log;
66

77
customTemplates = [];
88

@@ -21,8 +21,7 @@ angular_ui_form_validations = (function(){
2121
},
2222
validator: function (errorMessageElement, val, attr, element, model, modelCtrl, scope) {
2323
var valid, hydrateDynamicallyDefinedValidation, scopeValidations,
24-
setErrorIdentifier, setValidity, validatorArgs;
25-
24+
setErrorIdentifier, setValidity, validatorArgs, deferred;
2625
validatorArgs = arguments;
2726
scopeValidations = scope[attr];
2827

@@ -174,8 +173,11 @@ angular_ui_form_validations = (function(){
174173
return index;
175174
};
176175

177-
createValidationFormatterLink = function (formatterArgs, templateRetriever, $q, $timeout, $log) {
178-
176+
createValidationFormatterLink = function (formatterArgs, templateRetriever, q, timeout, log) {
177+
$q = q;
178+
$timeout = timeout;
179+
$log = log;
180+
179181
return function($scope, $element, $attrs, ngModelController) {
180182
var customErrorMessage, errorMessage, errorMessageElement, modelName, model, propertyName, runCustomValidations, validationAttributeValue, customErrorTemplate;
181183
$timeout(function() {
@@ -325,39 +327,39 @@ angular_ui_form_validations = (function(){
325327
if(! currentlyDisplayingAnErrorMessage) {
326328
$element.siblings('.CustomValidationError.'+ formatterArgs.customValidationAttribute + '.' + propertyName + 'property:first')
327329
.toggle(!isValid);
328-
} else if(! isCurrentlyDisplayingAnErrorMessageInATemplate($element)){
330+
} else if(! isCurrentlyDisplayingAnErrorMessageInATemplate($element)){
329331
currentErrorMessageValidator = getValidatorByAttribute(currentErrorMessage.attr('data-custom-validation-attribute'));
330332
currentErrorMessageIsStale = currentErrorMessageValidator(errorMessageElement.clone(), value, $attrs[currentErrorMessage.attr('data-custom-validation-attribute')], $element, model, ngModelController, $scope);
331-
333+
332334
currentErrorMessagePriorityIndex = parseInt(currentErrorMessage.attr('data-custom-validation-priorityIndex'), 10);
333335
currentErrorMessageIsOfALowerPriority = currentErrorMessagePriorityIndex >= getValidationPriorityIndex(formatterArgs.customValidationAttribute);
334-
336+
335337
if (currentErrorMessageIsStale || (!currentErrorMessageIsStale && currentErrorMessageIsOfALowerPriority && !isValid)) {
336338
currentErrorMessage.hide();
337339
$element.siblings('.CustomValidationError.'+ formatterArgs.customValidationAttribute + '.' + propertyName + 'property:first')
338-
.toggle(!isValid);
339-
}
340+
.toggle(!isValid);
341+
}
340342
}
341343

342344
if(isCurrentlyDisplayingAnErrorMessageInATemplate($element)) {
343345
currentErrorMessageValidator = getValidatorByAttribute(currentErrorMessage.attr('data-custom-validation-attribute'));
344346
currentErrorMessageIsStale = currentErrorMessageValidator(
345347
errorMessageElement,
346-
value,
347-
getValidationAttributeValue($attrs[currentErrorMessage.attr('data-custom-validation-attribute')]),
348+
value,
349+
getValidationAttributeValue($attrs[currentErrorMessage.attr('data-custom-validation-attribute')]),
348350
$element, model, ngModelController
349351
);
350-
352+
351353
currentErrorMessagePriorityIndex = parseInt(currentErrorMessage.attr('data-custom-validation-priorityIndex'), 10);
352354
currentErrorMessageIsOfALowerPriority = currentErrorMessagePriorityIndex >= getValidationPriorityIndex(formatterArgs.customValidationAttribute);
353-
354-
if (currentErrorMessageIsStale || (!currentErrorMessageIsStale && currentErrorMessageIsOfALowerPriority && !isValid
355+
356+
if (currentErrorMessageIsStale || (!currentErrorMessageIsStale && currentErrorMessageIsOfALowerPriority && !isValid
355357
&& currentlyDisplayedTemplate.children().attr('class').indexOf(formatterArgs.customValidationAttribute) === -1)) {
356358
currentErrorMessage.hide();
357359
$element.siblings('.CustomValidationError.'+ formatterArgs.customValidationAttribute + '.' + propertyName + 'property:first')
358-
.toggle(!isValid);
360+
.toggle(!isValid);
359361
$scope.$broadcast('errorMessageToggled');
360-
}
362+
}
361363
}
362364

363365
$scope.$broadcast('customValidationComplete', customValidationBroadcastArg);

app/scripts/directives/customvalidationtypes/customValidationTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function(){
22
var extendCustomValidations = angular.module('directives.customvalidation.customValidationTypes', [
33
'directives.customvalidation.customValidations'
4-
])
4+
]);
55

66
getValidationAttributeValue = angular_ui_form_validations.getValidationAttributeValue;
77

bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"angular-sanitize": "~1.2.0",
1515
"angular-route": "~1.2.0",
1616
"angular-bootstrap": "~0.7.0",
17-
"angular-template-retriever": "*",
18-
"q": "~2.0.0"
17+
"angular-template-retriever": "*"
1918
},
2019
"devDependencies": {
2120
"angular-mocks": "~1.2.0",

karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = function(config) {
1111

1212
// list of files / patterns to load in the browser
1313
files: [
14+
'app/bower_components/lazy.js/lazy.js',
1415
'app/bower_components/jquery/jquery.js',
1516
'app/bower_components/angular/angular.js',
1617
'app/bower_components/angular-mocks/angular-mocks.js',

0 commit comments

Comments
 (0)