Skip to content

Commit 9c2faf8

Browse files
committed
Revert "works with inputs without the form-control class"
This reverts commit e93c512.
1 parent 8d9bada commit 9c2faf8

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/showErrors.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ showErrorsModule.directive 'showErrors',
2121
showSuccess = getShowSuccess options
2222
trigger = getTrigger options
2323

24-
inputEl = el[0].querySelector 'input[name]'
24+
inputEl = el[0].querySelector '.form-control[name]'
2525
inputNgEl = angular.element inputEl
2626
inputName = $interpolate(inputNgEl.attr('name') || '')(scope)
2727
unless inputName
28-
throw "show-errors element has no child input element with a 'name' attribute"
28+
throw "show-errors element has no child input elements with a 'name' attribute and a 'form-control' class"
2929

3030
inputNgEl.bind trigger, ->
3131
blurred = true

src/showErrors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
options = scope.$eval(attrs.showErrors);
2929
showSuccess = getShowSuccess(options);
3030
trigger = getTrigger(options);
31-
inputEl = el[0].querySelector('input[name]');
31+
inputEl = el[0].querySelector('.form-control[name]');
3232
inputNgEl = angular.element(inputEl);
3333
inputName = $interpolate(inputNgEl.attr('name') || '')(scope);
3434
if (!inputName) {
35-
throw "show-errors element has no child input element with a 'name' attribute";
35+
throw "show-errors element has no child input elements with a 'name' attribute and a 'form-control' class";
3636
}
3737
inputNgEl.bind(trigger, function() {
3838
blurred = true;

src/showErrors.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/showErrors.spec.coffee

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ describe 'showErrors', ->
2727
$scope.$digest()
2828
el
2929

30-
describe 'directive does not contain an input element with a "name" attribute', ->
30+
describe 'directive does not contain an input element with a form-control class and name attribute', ->
3131
it 'throws an exception', ->
3232
expect( ->
33-
$compile('<form name="userForm"><div class="form-group" show-errors><input type="text" ></input></div></form>')($scope)
34-
).toThrow "show-errors element has no child input element with a 'name' attribute"
33+
$compile('<form name="userForm"><div class="form-group" show-errors><input type="text" name="firstName"></input></div></form>')($scope)
34+
).toThrow "show-errors element has no child input elements with a 'name' attribute and a 'form-control' class"
3535

3636
it "throws an exception if the element doesn't have the form-group or input-group class", ->
3737
expect( ->

test/showErrors.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
$scope.$digest();
2929
return el;
3030
};
31-
describe('directive does not contain an input element with a "name" attribute', function() {
31+
describe('directive does not contain an input element with a form-control class and name attribute', function() {
3232
return it('throws an exception', function() {
3333
return expect(function() {
34-
return $compile('<form name="userForm"><div class="form-group" show-errors><input type="text" ></input></div></form>')($scope);
35-
}).toThrow("show-errors element has no child input element with a 'name' attribute");
34+
return $compile('<form name="userForm"><div class="form-group" show-errors><input type="text" name="firstName"></input></div></form>')($scope);
35+
}).toThrow("show-errors element has no child input elements with a 'name' attribute and a 'form-control' class");
3636
});
3737
});
3838
it("throws an exception if the element doesn't have the form-group or input-group class", function() {

0 commit comments

Comments
 (0)