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

fix(list): Accept array of index for selectedIndex API #4124

Merged
merged 52 commits into from
Jan 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d585757
fix(list): Auto update aria attributes based on check status
abhiomkar Nov 2, 2018
3aa9b8d
fix(list): Aria attributes to screenshot pages
abhiomkar Nov 5, 2018
db41f26
fix(list): update aria attributes based on list type
abhiomkar Nov 5, 2018
25bacc1
fix(list): Updated README
abhiomkar Nov 5, 2018
88ed948
fix(list): Updated to screenshot head > title
abhiomkar Nov 5, 2018
5a4892a
fix(list): Fix lint
abhiomkar Nov 5, 2018
5ce1753
fix(list): Updated readme to add radio, checkbox sections
abhiomkar Nov 5, 2018
b8c818c
fix(list): Update aria for only interactive lists
abhiomkar Nov 7, 2018
9d5223d
fix(list): resolve review comments.
abhiomkar Nov 9, 2018
ff65398
fix(list): Abstracted updating aria, classnames into private method f…
abhiomkar Nov 21, 2018
9ebc900
fix(list): Update code comments for preselected
abhiomkar Nov 21, 2018
0d7091e
fix(list): Updated list unit tests
abhiomkar Nov 27, 2018
73bed5a
fix(list): Updated list README
abhiomkar Nov 27, 2018
ad385e8
fix(list): Code comment
abhiomkar Nov 27, 2018
6228ab8
fix(list): fix auto toggle on label click
abhiomkar Nov 27, 2018
cb22dc9
fix(list): Review comments fix
abhiomkar Nov 28, 2018
3874baf
fix(list): Improved list foundation test coverage - 100%
abhiomkar Nov 28, 2018
da25244
fix(list): Test coverage 99.17% => 100%
abhiomkar Nov 28, 2018
5f48c2e
fix(list): Additional test for radio aria attribute change
abhiomkar Nov 28, 2018
509dbf6
fix(list): README change about tabindex
abhiomkar Nov 28, 2018
d8b4961
Merge remote-tracking branch 'origin/master' into fix/list_checkbox_aria
abhiomkar Nov 28, 2018
45f2f7d
fix(list): Updated README about checkbox role=group
abhiomkar Nov 28, 2018
57bc9f7
fix(list): trigger CBT
abhiomkar Nov 28, 2018
ca1c012
fix(list): WIP multiple selected index
abhiomkar Nov 28, 2018
19d8ad1
fix(list): Allow multiple indexes for checkbox
abhiomkar Nov 28, 2018
7420515
fix(list): merge master and resolved merge conflicts
abhiomkar Nov 28, 2018
8b9e0c9
fix(list): simplified setCheckboxAtIndex method
abhiomkar Nov 29, 2018
8ad3a30
fix(list): Fixed checkbox checked logic
abhiomkar Nov 29, 2018
f3be4a9
fix(list): Fixed unit tests, lint errors and closure tests
abhiomkar Nov 29, 2018
10460be
fix(list): Fix for review comments
abhiomkar Nov 29, 2018
8826a00
fix(list): Preselected logic for checkbox based list
abhiomkar Dec 2, 2018
18c8bb3
fix(list): Fix selectedIndex for mouse/keyboard interaction
abhiomkar Dec 3, 2018
288191e
fix(list): set tabindex to 0 when moving focus to target list item
abhiomkar Dec 3, 2018
0d9ffc5
fix(list): WIP - Fix existing unit tests.
abhiomkar Dec 3, 2018
0cfac92
fix(list): WIP - Added additional unit tests.
abhiomkar Dec 3, 2018
ab83f8f
fix(list): Set tabindex on first item when none selected on blur.
abhiomkar Dec 3, 2018
626d98a
fix(list): resolve review comments
abhiomkar Dec 4, 2018
e5664d9
fix(list): Added new unit tests and updated a thing about tabindex in…
abhiomkar Dec 4, 2018
cd220ed
fix(list): Removed programmaticSelection_ and replaced with private m…
abhiomkar Dec 6, 2018
351b5e4
fix(list): 100% test coverage for list foundation
abhiomkar Dec 6, 2018
6782e93
fix(list): 100% test coverage for list component
abhiomkar Dec 6, 2018
b30fc91
fix(list): resolve some review comments
abhiomkar Dec 8, 2018
df17474
fix(list): new unit tests for focus* methods
abhiomkar Dec 8, 2018
32ed86f
fix(list): init() => layout()
abhiomkar Dec 20, 2018
04f32d8
fix(list): README changes as per comments and updated tests
abhiomkar Jan 2, 2019
affc756
fix(list): move tabindex=0 to selected item
abhiomkar Jan 3, 2019
cd6e0ff
Merge remote-tracking branch 'origin/master' into fix/list_checkbox_s…
abhiomkar Jan 5, 2019
7370145
Merge remote-tracking branch 'origin/master' into fix/list_checkbox_s…
abhiomkar Jan 5, 2019
5389d41
fix(list): Fixed closure errors
abhiomkar Jan 5, 2019
e6a3f08
fix(list): fixed unit test for IE11
abhiomkar Jan 5, 2019
2ea1d3b
fix(list): fixed unit test for IE11
abhiomkar Jan 5, 2019
38a34de
fix(list): minor changes on self-review
abhiomkar Jan 5, 2019
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
68 changes: 60 additions & 8 deletions test/unit/mdc-list/foundation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ test('#handleFocusOut sets tabindex=0 to first selected index when focus leaves
td.verify(mockAdapter.setAttributeForElementIndex(2, 'tabindex', 0), {times: 1});
});

test('#handleKeydown should bail out early when list is empty', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(0);
foundation.handleKeydown({}, true, 1);
td.verify(mockAdapter.getFocusedElementIndex(), {times: 0});
});

test('#handleKeydown does nothing if the key is not used for navigation', () => {
const {foundation, mockAdapter} = setupTest();
const preventDefault = td.func('preventDefault');
Expand Down Expand Up @@ -640,6 +632,66 @@ test('#handleKeydown bail out early if event origin doesnt have a mdc-list-item
td.verify(preventDefault(), {times: 0});
});

test('#focusNextElement focuses next list item and returns that index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);

assert.equal(3, foundation.focusNextElement(2));
td.verify(mockAdapter.focusItemAtIndex(3), {times: 1});
});

test('#focusNextElement focuses first list item when focus is on last list item when wrapFocus=true and returns that ' +
'index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);
foundation.setWrapFocus(true);

assert.equal(0, foundation.focusNextElement(3));
td.verify(mockAdapter.focusItemAtIndex(0), {times: 1});
});

test('#focusNextElement retains the focus on last item when wrapFocus=false and returns that index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);
foundation.setWrapFocus(false);

assert.equal(3, foundation.focusNextElement(3));
td.verify(mockAdapter.focusItemAtIndex(3), {times: 0});
abhiomkar marked this conversation as resolved.
Show resolved Hide resolved
});

test('#focusPrevElement focuses previous list item and returns that index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);

assert.equal(1, foundation.focusPrevElement(2));
td.verify(mockAdapter.focusItemAtIndex(1), {times: 1});
});

test('#focusPrevElement focuses last list item when focus is on first list item when wrapFocus=true and returns that ' +
'index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);
foundation.setWrapFocus(true);

assert.equal(3, foundation.focusPrevElement(0));
td.verify(mockAdapter.focusItemAtIndex(3), {times: 1});
});

test('#focusPrevElement retains the focus on first list item when wrapFocus=false and returns that index', () => {
const {foundation, mockAdapter} = setupTest();

td.when(mockAdapter.getListItemCount()).thenReturn(4);
foundation.setWrapFocus(false);

assert.equal(0, foundation.focusPrevElement(0));
td.verify(mockAdapter.focusItemAtIndex(3), {times: 0});
abhiomkar marked this conversation as resolved.
Show resolved Hide resolved
});

test('#handleClick when singleSelection=false on a list item should not cause the list item to be selected', () => {
const {foundation, mockAdapter} = setupTest();

Expand Down
2 changes: 1 addition & 1 deletion test/unit/mdc-list/mdc-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ test('singleSelection calls foundation setSingleSelection with the provided valu
td.verify(mockFoundation.setSingleSelection(true), {times: 1});
});

test('selectedIndex pro setSelectedIndex on foundation', () => {
test('selectedIndex calls setSelectedIndex on foundation', () => {
const {component, mockFoundation} = setupTest();
component.selectedIndex = 1;
td.verify(mockFoundation.setSelectedIndex(1), {times: 1});
Expand Down