Skip to content

Commit

Permalink
remove accessibilityHint from Icon and use testId
Browse files Browse the repository at this point in the history
Signed-off-by: Prince Mendiratta <[email protected]>
  • Loading branch information
Prince-Mendiratta committed Mar 27, 2023
1 parent d74dd97 commit ddabb59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/Icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Icon extends PureComponent {
if (this.props.inline) {
return (
<View
accessibilityHint={`${this.props.src.name} Icon`}
testID={`${this.props.src.name} Icon`}
style={[StyleUtils.getWidthAndHeightStyle(width, height), styles.bgTransparent, styles.overflowVisible]}
>
<View style={iconStyles}>
Expand All @@ -68,7 +68,7 @@ class Icon extends PureComponent {

return (
<View
accessibilityHint={`${this.props.src.name} Icon`}
testID={`${this.props.src.name} Icon`}
style={this.props.additionalStyles}
>
<this.props.src
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/SidebarOrderTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('Sidebar', () => {
// Then there should be a pencil icon and report one should be the first one because putting a draft on the active report should change its location
// in the ordered list
.then(() => {
const pencilIcon = screen.getAllByAccessibilityHint('Pencil Icon');
const pencilIcon = screen.queryAllByTestId('Pencil Icon');
expect(pencilIcon).toHaveLength(1);

const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames');
Expand Down Expand Up @@ -263,15 +263,15 @@ describe('Sidebar', () => {

// Then there should be a pencil icon showing
.then(() => {
expect(screen.getAllByAccessibilityHint('Pencil Icon')).toHaveLength(1);
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(1);
})

// When the draft is removed
.then(() => Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, {hasDraft: null}))

// Then the pencil icon goes away
.then(() => {
expect(screen.queryAllByAccessibilityHint('Pencil Icon')).toHaveLength(0);
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(0);
});
});

Expand All @@ -296,15 +296,15 @@ describe('Sidebar', () => {

// Then there should be a pencil icon showing
.then(() => {
expect(screen.getAllByAccessibilityHint('Pin Icon')).toHaveLength(1);
expect(screen.queryAllByTestId('Pin Icon')).toHaveLength(1);
})

// When the draft is removed
.then(() => Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, {isPinned: false}))

// Then the pencil icon goes away
.then(() => {
expect(screen.queryAllByAccessibilityHint('Pin Icon')).toHaveLength(0);
expect(screen.queryAllByTestId('Pin Icon')).toHaveLength(0);
});
});

Expand Down Expand Up @@ -361,8 +361,8 @@ describe('Sidebar', () => {
const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames');
const displayNames = screen.queryAllByLabelText(hintText);
expect(displayNames).toHaveLength(3);
expect(screen.getAllByAccessibilityHint('Pin Icon')).toHaveLength(1);
expect(screen.getAllByAccessibilityHint('Pencil Icon')).toHaveLength(1);
expect(screen.queryAllByTestId('Pin Icon')).toHaveLength(1);
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(1);
expect(lodashGet(displayNames, [0, 'props', 'children'])).toBe('One, Two');
expect(lodashGet(displayNames, [1, 'props', 'children'])).toBe('Five, Six');
expect(lodashGet(displayNames, [2, 'props', 'children'])).toBe('Three, Four');
Expand Down

0 comments on commit ddabb59

Please sign in to comment.