Skip to content

Commit 1e661fe

Browse files
committed
Write more lookup tests
1 parent 0806966 commit 1e661fe

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

components/SLDSLookup/Menu/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ Menu.propTypes = {
118118
filterWith: React.PropTypes.func,
119119
getListLength: React.PropTypes.func,
120120
setFocus: React.PropTypes.func,
121-
header: React.PropTypes.element,
122-
footer: React.PropTypes.element,
123121
};
124122

125123
Menu.defaultProps = {

tests/SLDSLookup/lookup.test.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const React = require('react/addons');
22
const TestUtils = React.addons.TestUtils;
33
import {SLDSLookup} from '../../components';
4+
import ActionItem from '../../components/SLDSLookup/Menu/ActionItem';
45

56
describe('SLDSLookup: ', function(){
67

@@ -67,13 +68,23 @@ describe('SLDSLookup: ', function(){
6768

6869
describe('selecting item works', function() {
6970

70-
it('focuses correct item', function() {
71+
it('no fixed header: focuses correct item', function() {
7172
let lookup = generateLookup(<SLDSLookup items={items} label="Leads" type="lead" />);
7273
let input = lookup.getElementsByTagName("input")[0];
7374
TestUtils.Simulate.click(input);
7475
TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40});
7576
TestUtils.Simulate.keyDown(input, {key: "Down", keyCode: 40, which: 40});
7677
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");
7788
expect(ariaActiveDescendant).to.equal('item-0');
7889
});
7990

0 commit comments

Comments
 (0)