Skip to content

Commit

Permalink
Filter out empty suite results for version (#153)
Browse files Browse the repository at this point in the history
* Filter out empty suite results for version

* Remove a console log
  • Loading branch information
nekevss committed Apr 23, 2024
1 parent 3842ab5 commit c232f2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { SuiteResult } from "@site/src/components/conformance/types";
import { SuiteResult, TestStats } from "@site/src/components/conformance/types";

import styles from "./styles.module.css";

Expand All @@ -14,6 +14,10 @@ export default function SuiteSelector(props: SelectorProps): JSX.Element {
<div className={styles.suiteSelector}>
{props.suites
.sort((a, b) => a.name.localeCompare(b.name))
.filter((suite) => {
let versionStats: TestStats = suite.versionedStats[props.esFlag];
return versionStats.total !== 0;
})
.map((suite) => {
return (
<SuiteItem
Expand Down
15 changes: 10 additions & 5 deletions src/components/conformance/ResultsDisplay/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ type ResultsNavProps = {
export default function ResultNavigation(props: ResultsNavProps): JSX.Element {
return (
<div className={styles.resultsNav}>
<EcmaScriptVersionDropdown setEcmaScriptFlag={props.setEcmaScriptFlag} esVersionValue={props.state.ecmaScriptVersion} />
<EcmaScriptVersionDropdown
setEcmaScriptFlag={props.setEcmaScriptFlag}
esVersionValue={props.state.ecmaScriptVersion}
/>
<NavBreadCrumbs
navPath={props.state.testPath}
sliceNavToIndex={props.sliceNavToIndex}
Expand Down Expand Up @@ -79,12 +82,14 @@ type DropDownProps = {
};

function EcmaScriptVersionDropdown(props: DropDownProps): JSX.Element {
const [dropdownValue, setDropdownValue] = React.useState(props.esVersionValue ? props.esVersionValue : "");
const [dropdownValue, setDropdownValue] = React.useState(
props.esVersionValue ? props.esVersionValue : "",
);

// Update the flag when props.esVersionValue is changed
React.useEffect(()=>{
setDropdownValue(props.esVersionValue)
}, [props.esVersionValue])
React.useEffect(() => {
setDropdownValue(props.esVersionValue);
}, [props.esVersionValue]);

const handleVersionSelection = (e) => {
// Update the display value and set the flag.
Expand Down

0 comments on commit c232f2b

Please sign in to comment.