Comparing version 1.1.0 to 1.1.1
@@ -1526,3 +1526,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Dominar = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
} | ||
if (validator.passes()) { | ||
@@ -1535,3 +1535,3 @@ passesHandler(); | ||
} | ||
}, | ||
@@ -1604,5 +1604,11 @@ | ||
customMessages: this.options.customMessages, | ||
customAttributes: this.options.customAttributes | ||
customAttributes: {} | ||
}; | ||
if (typeof this.options.customAttributes === 'string') { | ||
options.customAttributes[this.name] = this.options.customAttributes; | ||
} else { | ||
options.customAttributes = this.options.customAttributes; | ||
} | ||
if (this.options.validatorOptions) | ||
@@ -1633,3 +1639,3 @@ { | ||
var sameRuleOptions = this._getRuleOptions('same'); | ||
if (sameRuleOptions) { | ||
@@ -1731,3 +1737,3 @@ includeValues.push(sameRuleOptions.options[0]); | ||
var isKeyup = eventType == 'keyup'; | ||
// Determine if validation can be triggered by this event (change, keyup etc) | ||
@@ -1849,4 +1855,4 @@ var trigger = this.options.triggers.indexOf(eventType) > -1; | ||
reset: function() { | ||
Utils.element(this.container).removeClass('has-error has-success has-feedback'); | ||
var removeClasses = ['has-error', 'has-success']; | ||
if (this.message) { | ||
@@ -1858,3 +1864,6 @@ this.message.innerHTML = ''; | ||
this.feedback.innerHTML = ''; | ||
removeClasses.push('has-feedback'); | ||
} | ||
Utils.element(this.container).removeClass(removeClasses.join(' ')); | ||
} | ||
@@ -1861,0 +1870,0 @@ |
@@ -125,3 +125,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Dominar = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
} | ||
if (validator.passes()) { | ||
@@ -134,3 +134,3 @@ passesHandler(); | ||
} | ||
}, | ||
@@ -203,5 +203,11 @@ | ||
customMessages: this.options.customMessages, | ||
customAttributes: this.options.customAttributes | ||
customAttributes: {} | ||
}; | ||
if (typeof this.options.customAttributes === 'string') { | ||
options.customAttributes[this.name] = this.options.customAttributes; | ||
} else { | ||
options.customAttributes = this.options.customAttributes; | ||
} | ||
if (this.options.validatorOptions) | ||
@@ -232,3 +238,3 @@ { | ||
var sameRuleOptions = this._getRuleOptions('same'); | ||
if (sameRuleOptions) { | ||
@@ -330,3 +336,3 @@ includeValues.push(sameRuleOptions.options[0]); | ||
var isKeyup = eventType == 'keyup'; | ||
// Determine if validation can be triggered by this event (change, keyup etc) | ||
@@ -448,4 +454,4 @@ var trigger = this.options.triggers.indexOf(eventType) > -1; | ||
reset: function() { | ||
Utils.element(this.container).removeClass('has-error has-success has-feedback'); | ||
var removeClasses = ['has-error', 'has-success']; | ||
if (this.message) { | ||
@@ -457,3 +463,6 @@ this.message.innerHTML = ''; | ||
this.feedback.innerHTML = ''; | ||
removeClasses.push('has-feedback'); | ||
} | ||
Utils.element(this.container).removeClass(removeClasses.join(' ')); | ||
} | ||
@@ -460,0 +469,0 @@ |
{ | ||
"name": "dominar", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Lighweight and highly configurable bootstrap validator", | ||
@@ -5,0 +5,0 @@ "author": "Gary Green", |
@@ -60,3 +60,3 @@ /* | ||
} | ||
if (validator.passes()) { | ||
@@ -69,3 +69,3 @@ passesHandler(); | ||
} | ||
}, | ||
@@ -138,5 +138,11 @@ | ||
customMessages: this.options.customMessages, | ||
customAttributes: this.options.customAttributes | ||
customAttributes: {} | ||
}; | ||
if (typeof this.options.customAttributes === 'string') { | ||
options.customAttributes[this.name] = this.options.customAttributes; | ||
} else { | ||
options.customAttributes = this.options.customAttributes; | ||
} | ||
if (this.options.validatorOptions) | ||
@@ -167,3 +173,3 @@ { | ||
var sameRuleOptions = this._getRuleOptions('same'); | ||
if (sameRuleOptions) { | ||
@@ -265,3 +271,3 @@ includeValues.push(sameRuleOptions.options[0]); | ||
var isKeyup = eventType == 'keyup'; | ||
// Determine if validation can be triggered by this event (change, keyup etc) | ||
@@ -383,4 +389,4 @@ var trigger = this.options.triggers.indexOf(eventType) > -1; | ||
reset: function() { | ||
Utils.element(this.container).removeClass('has-error has-success has-feedback'); | ||
var removeClasses = ['has-error', 'has-success']; | ||
if (this.message) { | ||
@@ -392,3 +398,6 @@ this.message.innerHTML = ''; | ||
this.feedback.innerHTML = ''; | ||
removeClasses.push('has-feedback'); | ||
} | ||
Utils.element(this.container).removeClass(removeClasses.join(' ')); | ||
} | ||
@@ -395,0 +404,0 @@ |
@@ -7,3 +7,3 @@ var expect = window.chai.expect; | ||
it('should show allow custom attribute names', function() { | ||
var dominar = new Dominar($('<form><div class="form-group"><input name="name"></div></form>')[0], { | ||
@@ -26,2 +26,19 @@ name: { | ||
it('should allow short-hand style custom attribute names', function() { | ||
var dominar = new Dominar($('<form><div class="form-group"><input name="name"></div></form>')[0], { | ||
name: { | ||
rules: 'required', | ||
customAttributes: 'Your Name' | ||
} | ||
}); | ||
dominar.validateAll(); | ||
expect($(dominar.form).html()).to.contain([ | ||
'<input name="name">', | ||
'<span class="help-block">The Your Name field is required.</span>', | ||
].join('')); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128523
4319
23