Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Fix custom attributes on fields #593

Merged
merged 2 commits into from
Aug 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maButtonField.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define(function () {
var a = element.children()[0];
var attributes = field.attributes();
for (var name in attributes) {
a[name] = attributes[name];
a.setAttribute(name, attributes[name]);
}
scope.toggle = function() {
this.value = !this.value;
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maCheckboxField.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define(function (require) {
var input = element.children()[0];
var attributes = field.attributes();
for (var name in attributes) {
input[name] = attributes[name];
input.setAttribute(name, attributes[name]);
}
},
template:
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maFileField.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ define(function (require) {
var input = element.find('input')[0];
var attributes = field.attributes();
for (var name in attributes) {
input[name] = attributes[name];
input.setAttribute(name, attributes[name]);
}

scope.fileSelected = function(selectedFiles) {
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maInputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define(function (require) {
continue;
}

input[name] = attributes[name];
input.setAttribute(name, attributes[name]);
}
},
template:
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maJsonField.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function maJsonField() {
var input = element.children()[0];
var attributes = field.attributes();
for (var name in attributes) {
input[name] = attributes[name];
input.setAttribute(name, attributes[name]);
}
scope.$watch('jsonValue', function(jsonValue) {
if (jsonValue == '' || typeof jsonValue === 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define(function (require) {
var input = element.children()[0];
var attributes = field.attributes();
for (var name in attributes) {
input[name] = attributes[name];
input.setAttribute(name, attributes[name]);
}
},
template:
Expand Down
6 changes: 3 additions & 3 deletions src/javascripts/test/unit/Crud/field/maInputFieldSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ describe('directive: input-field', function () {
scope.field = new Field().attributes({ autocomplete: 'off' });
var element = $compile(directiveUsage)(scope);
scope.$digest();
expect(element.children()[0].autocomplete).toEqual('off');
expect(element.children()[0].getAttribute('autocomplete')).toEqual('off');
});

it("should use the field min and max attributes", function () {
scope.field = new Field().attributes({ min: -2, max: 2 });
var element = $compile(directiveUsage)(scope);
scope.$digest();
var input = element.children()[0];
expect(input.min).toEqual('-2');
expect(input.max).toEqual('2');
expect(input.getAttribute('min')).toEqual('-2');
expect(input.getAttribute('max')).toEqual('2');
});

it("should contain the bounded value", function () {
Expand Down