From e23180d4d6d6a697666aa8378ee45cb5f1c39e72 Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 17 Oct 2018 22:25:45 +0200 Subject: Add support for groups --- src/Report.js | 18 +++++++++++++++--- src/listComponents.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/Report.js b/src/Report.js index ac7dfac..955c97d 100644 --- a/src/Report.js +++ b/src/Report.js @@ -18,7 +18,7 @@ */ import React, { Component } from 'react'; -import { Counters, SessionInfo, PackagesCoverage, PackagesSourceCoverage } from './listComponents.js'; +import { Counters, SessionInfo, GroupsCoverage, PackagesCoverage, GroupsSourceCoverage, PackagesSourceCoverage } from './listComponents.js'; export class Report extends Component { _renderAppInfo() { @@ -37,6 +37,18 @@ export class Report extends Component { ); } + _renderCoverageTree() { + return this.props.report.group + ? () + : (); + } + + _renderSourceCoverage() { + return this.props.report.group + ? () + : (); + } + _renderReport() { return (
@@ -54,12 +66,12 @@ export class Report extends Component {

Coverage tree

- + {this._renderCoverageTree()}

Source coverage

- + {this._renderSourceCoverage()}
); diff --git a/src/listComponents.js b/src/listComponents.js index a09abd9..2d89ac3 100644 --- a/src/listComponents.js +++ b/src/listComponents.js @@ -49,6 +49,28 @@ export class Counters extends Component { } } +export class GroupsCoverage extends Component { + _renderChilds(row) { + return row.group + ? () + : (); + } + + _renderRow(row) { + return ( +
  • + {row.$.name} + + {this._renderChilds(row)} +
  • + ) + } + + render() { + return renderRows(row => this._renderRow(row), this.props.groups, false); + } +} + export class PackagesCoverage extends Component { _renderRow(row) { return ( @@ -99,6 +121,27 @@ class MethodsCoverage extends Component { } } +export class GroupsSourceCoverage extends Component { + _renderChilds(row) { + return row.group + ? () + : (); + } + + _renderRow(row) { + return ( +
  • + {row.$.name} + {this._renderChilds(row)} +
  • + ) + } + + render() { + return renderRows(row => this._renderRow(row), this.props.groups, false); + } +} + export class PackagesSourceCoverage extends Component { _renderRow(row) { return ( -- cgit v1.2.3