Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/jquery/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ methods = {
datasets: datasets,
keyboardShortcuts: o.keyboardShortcuts,
appendTo: o.appendTo,
autoWidth: o.autoWidth
autoWidth: o.autoWidth,
ariaLabel: o.ariaLabel
});

$input.data(typeaheadKey, typeahead);
Expand Down
3 changes: 2 additions & 1 deletion src/standalone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ function autocomplete(selector, options, datasets, typeaheadObject) {
datasets: datasets,
keyboardShortcuts: options.keyboardShortcuts,
appendTo: options.appendTo,
autoWidth: options.autoWidth
autoWidth: options.autoWidth,
ariaLabel: options.ariaLabel
});
$input.data(typeaheadKey, typeahead);
});
Expand Down
16 changes: 16 additions & 0 deletions test/integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ describe('jquery-typeahead.js', function() {
});

function testSuite () {
describe('initial attributes', function() {
it('should contain aria-label if specified using options', function(done) {
yield this.execute("buildAutocomplete({aria-label: 'blah', hint: false, appendTo: 'body'})");
driver.run(function*() {
expect(yield input.getAttribute('aria-label')).to.equal('blah');
})
});

it('should not contain aria-label if not specified using options', function(done) {
yield this.execute("buildAutocomplete({hint: false, appendTo: 'body'})");
driver.run(function*() {
expect(yield input.getAttribute('aria-label')).to.equal(undefined);
})
})
}

describe('on blur', function() {
it('should close dropdown', function(done) {
driver.run(function*() {
Expand Down