Skip to content

Commit aa02f48

Browse files
test: add deviceHasHoverSupport to useHover mocks
1 parent 836997e commit aa02f48

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/ui/BaseListItemTest.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('BaseListItem', () => {
3939
});
4040

4141
it('should use the accessibilityLabel prop as the row name when provided', () => {
42-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
42+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
4343
render(
4444
<BaseListItem
4545
item={{keyForList: '1', text: 'Item text'}}
@@ -55,7 +55,7 @@ describe('BaseListItem', () => {
5555
});
5656

5757
it('should fall back to the item-derived label when accessibilityLabel is omitted', () => {
58-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
58+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
5959
render(
6060
<BaseListItem
6161
item={{keyForList: '1', text: 'Item text'}}
@@ -69,7 +69,7 @@ describe('BaseListItem', () => {
6969
});
7070

7171
it('should keep the button role for a navigational row when shouldUseOptionRole is false', () => {
72-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
72+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
7373
render(
7474
<BaseListItem
7575
item={{keyForList: '1', text: 'Item text'}}
@@ -84,7 +84,7 @@ describe('BaseListItem', () => {
8484
});
8585

8686
it('should resolve a single-select row to the option role by default', () => {
87-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
87+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
8888
render(
8989
<BaseListItem
9090
item={{keyForList: '1', text: 'Item text'}}
@@ -98,7 +98,7 @@ describe('BaseListItem', () => {
9898
});
9999

100100
it('should be presentational (not a button) when accessible is false, so nested controls stay reachable', () => {
101-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
101+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
102102
render(
103103
<BaseListItem
104104
item={{keyForList: '1', text: 'Item text'}}
@@ -113,7 +113,7 @@ describe('BaseListItem', () => {
113113
});
114114

115115
it('should drive the row selected state from the isSelected prop when selection is not on the item', () => {
116-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
116+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
117117
render(
118118
<BaseListItem
119119
item={{keyForList: '1', text: 'Item text'}}
@@ -128,7 +128,7 @@ describe('BaseListItem', () => {
128128
});
129129

130130
it('should fall back to item.isSelected for the row selected state when the isSelected prop is omitted', () => {
131-
mockedUseHover.mockReturnValue({hovered: false, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
131+
mockedUseHover.mockReturnValue({hovered: false, deviceHasHoverSupport: true, bind: {onMouseEnter: jest.fn(), onMouseLeave: jest.fn()}});
132132
render(
133133
<BaseListItem
134134
item={{keyForList: '1', text: 'Item text', isSelected: true}}

0 commit comments

Comments
 (0)