Skip to content

Commit

Permalink
Merge pull request #91 from kukulili-labs/master
Browse files Browse the repository at this point in the history
Add optional "tabindex"attribute to widgets
  • Loading branch information
ljharb committed Feb 4, 2014
2 parents 3d872eb + 5e2976b commit e7f9414
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var singleTag = function tag(tagName, attrsMap) {
var input = function (type) {
var dataRegExp = /^data-[a-z]+$/,
ariaRegExp = /^aria-[a-z]+$/,
legalAttrs = ['autocomplete', 'autocorrect', 'autofocus', 'autosuggest', 'checked', 'dirname', 'disabled', 'list', 'max', 'maxlength', 'min', 'multiple', 'novalidate', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'step'],
legalAttrs = ['autocomplete', 'autocorrect', 'autofocus', 'autosuggest', 'checked', 'dirname', 'disabled', 'tabindex', 'list', 'max', 'maxlength', 'min', 'multiple', 'novalidate', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'step'],
ignoreAttrs = ['id', 'name', 'class', 'classes', 'type', 'value'],
getUserAttrs = function (opt) {
return Object.keys(opt).reduce(function (attrs, k) {
Expand Down
6 changes: 6 additions & 0 deletions test/test-widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ exports['optional text input'] = function (test) {
}).toHTML('field1'),
'<input type="text" name="field1" id="id_field1" placeholder="Enter &quot;some&quot; comment" />'
);
test.equals(
forms.widgets.text({
tabindex: 1
}).toHTML('field1'),
'<input type="text" name="field1" id="id_field1" tabindex="1" />'
);
test.done();
};

Expand Down

0 comments on commit e7f9414

Please sign in to comment.