|
1 | 1 | const React = require('react/addons');
|
2 | 2 | const TestUtils = React.addons.TestUtils;
|
3 | 3 | import {SLDSLookup} from '../../components';
|
| 4 | +import ActionItem from '../../components/SLDSLookup/Menu/ActionItem'; |
4 | 5 |
|
5 | 6 | describe('SLDSLookup: ', function(){
|
6 | 7 |
|
@@ -67,13 +68,23 @@ describe('SLDSLookup: ', function(){
|
67 | 68 |
|
68 | 69 | describe('selecting item works', function() {
|
69 | 70 |
|
70 |
| - it('focuses correct item', function() { |
| 71 | + it('no fixed header: focuses correct item', function() { |
71 | 72 | let lookup = generateLookup(<SLDSLookup items={items} label="Leads" type="lead" />);
|
72 | 73 | let input = lookup.getElementsByTagName("input")[0];
|
73 | 74 | TestUtils.Simulate.click(input);
|
74 | 75 | TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40});
|
75 | 76 | TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40});
|
76 | 77 | let ariaActiveDescendant = lookup.getElementsByTagName("input")[0].getAttribute("aria-activedescendant");
|
| 78 | + expect(ariaActiveDescendant).to.equal('item-1'); |
| 79 | + }); |
| 80 | + |
| 81 | + it('with fixed header: focuses correct item', function() { |
| 82 | + let lookup = generateLookup(<SLDSLookup items={items} label="Leads" type="lead" header={<div>header</div>}/>); |
| 83 | + let input = lookup.getElementsByTagName("input")[0]; |
| 84 | + TestUtils.Simulate.click(input); |
| 85 | + TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40}); |
| 86 | + TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40}); |
| 87 | + let ariaActiveDescendant = lookup.getElementsByTagName("input")[0].getAttribute("aria-activedescendant"); |
77 | 88 | expect(ariaActiveDescendant).to.equal('item-0');
|
78 | 89 | });
|
79 | 90 |
|
|
0 commit comments