Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit f0a8f95

Browse files
author
Andrew Eisenberg
committed
Add accessibility-focussed unit tests
1 parent 7c4d141 commit f0a8f95

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: test/select.spec.js

+29
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe('ui-select tests', function() {
6969
if (attrs.theme !== undefined) { attrsHtml += ' theme="' + attrs.theme + '"'; }
7070
if (attrs.tabindex !== undefined) { attrsHtml += ' tabindex="' + attrs.tabindex + '"'; }
7171
if (attrs.tagging !== undefined) { attrsHtml += ' tagging="' + attrs.tagging + '"'; }
72+
if (attrs.title !== undefined) { attrsHtml += ' title="' + attrs.title + '"'; }
7273
}
7374

7475
return compileTemplate(
@@ -1656,4 +1657,32 @@ describe('ui-select tests', function() {
16561657
});
16571658

16581659
});
1660+
1661+
describe('accessibility', function() {
1662+
it('should have baseTitle in scope', function() {
1663+
expect(createUiSelect().scope().$select.baseTitle).toBe('Select box');
1664+
expect(createUiSelect().scope().$select.focusserTitle).toBe('Select box focus');
1665+
expect(createUiSelect({ title: 'Choose a person' }).scope().$select.baseTitle).toBe('Choose a person');
1666+
expect(createUiSelect({ title: 'Choose a person' }).scope().$select.focusserTitle).toBe('Choose a person focus');
1667+
});
1668+
1669+
iit('should have aria-label on all input and button elements', function() {
1670+
checkTheme();
1671+
checkTheme('select2');
1672+
checkTheme('selectize');
1673+
checkTheme('bootstrap');
1674+
1675+
function checkTheme(theme) {
1676+
var el = createUiSelect({ theme: theme});
1677+
checkElements(el.find('input'));
1678+
checkElements(el.find('button'));
1679+
1680+
function checkElements(els) {
1681+
for (var i = 0; i < els.length; i++) {
1682+
expect(els[i].attributes['aria-label']).toBeTruthy();
1683+
};
1684+
}
1685+
}
1686+
});
1687+
});
16591688
});

0 commit comments

Comments
 (0)