-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for ProgressLine Component (#61)
- Loading branch information
1 parent
8e8b1af
commit 3587382
Showing
1 changed file
with
33 additions
and
0 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,33 @@ | ||
import ProgressLine from '../../src/components/ProgressLine'; | ||
import GlobalStyles from '../../src/components/GlobalStyles'; | ||
|
||
export default { | ||
title: 'ProgressLine Component', | ||
component: ProgressLine | ||
}; | ||
|
||
export const ProgressLineComponent = () => { | ||
// Define sample visualPartition props | ||
const visualPartition = [ | ||
{ percentage: 20, color: 'red' }, | ||
{ percentage: 30, color: 'blue' }, | ||
{ percentage: 50, color: 'green' } | ||
]; | ||
|
||
return ( | ||
<> | ||
<GlobalStyles /> | ||
<ProgressLine visualPartition={visualPartition} /> | ||
</> | ||
); | ||
}; | ||
|
||
ProgressLineComponent.test = async (browser, { component }) => { | ||
// Check if the ProgressLine component is visible | ||
browser.expect(component).to.be.visible; | ||
|
||
// Check if the correct number of Graph elements are present based on the visualPartition prop | ||
browser.expect.elements('div[class*="ProgressLine__Graph"]').count.to.equal(3); | ||
browser.expect.element(`div[class*="ProgressLine__Graph"]:first-child`).to.have.css('background-color') | ||
browser.expect.element(`div[class*="ProgressLine__Graph"]:first-child`).to.have.css('width') | ||
}; |