forked from mozilla/perfcompare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Results: (Bug Fix) In RevisionRow handle case when the platform icon …
…is not present (mozilla#569)
- Loading branch information
Showing
6 changed files
with
88 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { screen } from '@testing-library/react'; | ||
|
||
import RevisionRow from '../../components/CompareResults/RevisionRow'; | ||
import { Platform } from '../../types/types'; | ||
import getTestData from '../utils/fixtures'; | ||
import { render } from '../utils/setupTests'; | ||
|
||
describe('<RevisionRow>', () => { | ||
it.each([ | ||
{ | ||
platform: 'linux1804-32-shippable-qr', | ||
shortName: 'Linux', | ||
hasIcon: true, | ||
}, | ||
{ | ||
platform: 'macosx1014-64-shippable-qr', | ||
shortName: 'OSX', | ||
hasIcon: true, | ||
}, | ||
{ | ||
platform: 'windows2012-64-shippable', | ||
shortName: 'Windows', | ||
hasIcon: true, | ||
}, | ||
{ | ||
platform: 'android-5-0-aarch64-release', | ||
shortName: 'Android', | ||
hasIcon: true, | ||
}, | ||
{ | ||
platform: 'i am not an operating system', | ||
shortName: 'Unspecified', | ||
hasIcon: false, | ||
}, | ||
])( | ||
'shows correct platform info for platform "$platform"', | ||
({ platform, shortName, hasIcon }) => { | ||
const { | ||
testCompareData: [rowData], | ||
} = getTestData(); | ||
|
||
rowData.platform = platform as Platform; | ||
render(<RevisionRow themeMode='light' result={rowData} />); | ||
const shortNameNode = screen.getByText(shortName); | ||
expect(shortNameNode).toBeInTheDocument(); | ||
const previousNode = shortNameNode.previousSibling; | ||
/* eslint-disable jest/no-conditional-expect */ | ||
if (hasIcon) { | ||
expect(previousNode?.nodeName).toBe('svg'); | ||
} else { | ||
expect(previousNode).toBeNull(); | ||
} | ||
/* eslint-enable */ | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters