-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #847 from w3c/pass-fail-test-run
Passed/failed for assertion results in TestRenderer and migrate to pass/fail for report comparison algorithms
- Loading branch information
Showing
23 changed files
with
146 additions
and
624 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
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
55 changes: 55 additions & 0 deletions
55
client/components/TestRenderer/AssertionsFieldset/index.jsx
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,55 @@ | ||
import React, { useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Fieldset } from '..'; | ||
import styled from '@emotion/styled'; | ||
import supportJson from '../../../resources/support.json'; | ||
|
||
const Label = styled.label` | ||
display: block; | ||
input { | ||
margin-right: 0.25rem; | ||
} | ||
`; | ||
|
||
const AssertionsFieldset = ({ assertions, commandIndex, assertionsHeader }) => { | ||
// Handle case where build process didn't include assertionResponseQuestion | ||
const normalizedHeader = useMemo(() => { | ||
return assertionsHeader?.descriptionHeader?.replace( | ||
'undefined', | ||
supportJson.testPlanStrings.assertionResponseQuestion | ||
); | ||
}, [assertionsHeader]); | ||
|
||
return ( | ||
<Fieldset> | ||
<legend id={`command-${commandIndex}-assertions-heading`}> | ||
{normalizedHeader} | ||
</legend> | ||
{assertions.map((assertion, assertionIndex) => { | ||
const { description, passed, click } = assertion; | ||
|
||
return ( | ||
<Label key={`AssertionKey_${assertionIndex}`}> | ||
<input | ||
type="checkbox" | ||
id={`pass-${commandIndex}-${assertionIndex}`} | ||
name={`assertion-${commandIndex}-${assertionIndex}`} | ||
defaultChecked={passed} | ||
onClick={click} | ||
/> | ||
{description[0]} | ||
</Label> | ||
); | ||
})} | ||
</Fieldset> | ||
); | ||
}; | ||
|
||
AssertionsFieldset.propTypes = { | ||
assertions: PropTypes.array.isRequired, | ||
commandIndex: PropTypes.number.isRequired, | ||
assertionsHeader: PropTypes.object.isRequired | ||
}; | ||
|
||
export default AssertionsFieldset; |
Oops, something went wrong.