Add test ids and classes (#633)

* data test ids and classes

* suggest
This commit is contained in:
Colin Megill
2019-03-07 13:01:41 -08:00
committed by Charlotte Weaver
parent a0f54b4871
commit 8795f0f32c
6 changed files with 24 additions and 3 deletions
@@ -331,6 +331,8 @@ class HistogramBrush extends React.Component {
width={this.width} width={this.width}
height={this.height} height={this.height}
id={`histogram_${field}_svg`} id={`histogram_${field}_svg`}
data-testclass="histogram-svg"
data-testid={`histogram_${field}_svg`}
ref={svgRef => { ref={svgRef => {
this.drawHistogram(svgRef); this.drawHistogram(svgRef);
}} }}
@@ -341,7 +343,12 @@ class HistogramBrush extends React.Component {
justifyContent: "center" justifyContent: "center"
}} }}
> >
<span style={{ fontStyle: "italic" }}>{field}</span> <span
data-testclass="brushable-histogram-field-name"
style={{ fontStyle: "italic" }}
>
{field}
</span>
</div> </div>
{isDiffExp ? ( {isDiffExp ? (
@@ -128,6 +128,8 @@ class Category extends React.Component {
> >
<label className="bp3-control bp3-checkbox"> <label className="bp3-control bp3-checkbox">
<input <input
data-testclass="category-checkbox"
data-testid={`category-checkbox-${metadataField}`}
onChange={this.handleToggleAllClick.bind(this)} onChange={this.handleToggleAllClick.bind(this)}
ref={el => { ref={el => {
this.checkbox = el; this.checkbox = el;
+7 -1
View File
@@ -101,6 +101,8 @@ class CategoryValue extends React.Component {
onChange={ onChange={
selected ? this.toggleOff.bind(this) : this.toggleOn.bind(this) selected ? this.toggleOff.bind(this) : this.toggleOn.bind(this)
} }
data-testclass="categorical-value-checkbox"
data-testid={`categorical-value-checkbox-${metadataField}`}
checked={selected} checked={selected}
type="checkbox" type="checkbox"
/> />
@@ -121,7 +123,11 @@ class CategoryValue extends React.Component {
</span> </span>
</div> </div>
<span> <span>
<span>{count}</span> <span
data-testid={`categorical-value-count-${metadataField}-${count}`}
>
{count}
</span>
<svg <svg
style={{ style={{
marginLeft: 5, marginLeft: 5,
@@ -35,6 +35,7 @@ const renderGene = (fuzzySortResult, { handleClick, modifiers, query }) => {
<MenuItem <MenuItem
active={modifiers.active} active={modifiers.active}
disabled={modifiers.disabled} disabled={modifiers.disabled}
data-testid={`suggest-menu-item-${geneName}`}
// Use of annotations in this way is incorrect and dataset specific. // Use of annotations in this way is incorrect and dataset specific.
// See https://github.com/chanzuckerberg/cellxgene/issues/483 // See https://github.com/chanzuckerberg/cellxgene/issues/483
// label={gene.n_counts} // label={gene.n_counts}
@@ -195,6 +196,7 @@ class GeneExpression extends React.Component {
style={{ marginRight: 5 }} style={{ marginRight: 5 }}
minimal minimal
small small
data-testid="tab-autosuggest"
onClick={() => { onClick={() => {
this.setState({ tab: "autosuggest" }); this.setState({ tab: "autosuggest" });
}} }}
@@ -205,6 +207,7 @@ class GeneExpression extends React.Component {
active={tab === "bulkadd"} active={tab === "bulkadd"}
minimal minimal
small small
data-testid="tab-bulkadd"
onClick={() => { onClick={() => {
this.setState({ tab: "bulkadd" }); this.setState({ tab: "bulkadd" });
}} }}
@@ -272,6 +275,7 @@ class GeneExpression extends React.Component {
this.setState({ bulkAdd: e.target.value }); this.setState({ bulkAdd: e.target.value });
}} }}
id="text-input-bulk-add" id="text-input-bulk-add"
data-testid="text-input-bulk-add"
placeholder={this.placeholderGeneNames()} placeholder={this.placeholderGeneNames()}
value={bulkAdd} value={bulkAdd}
/> />
+2 -1
View File
@@ -451,6 +451,7 @@ class Graph extends React.Component {
> >
<AnchorButton <AnchorButton
type="button" type="button"
data-testid="subset-button"
disabled={ disabled={
crossfilter && crossfilter &&
(crossfilter.countFiltered() === 0 || (crossfilter.countFiltered() === 0 ||
@@ -584,7 +585,7 @@ class Graph extends React.Component {
<canvas <canvas
width={responsive.width - this.graphPaddingRight} width={responsive.width - this.graphPaddingRight}
height={responsive.height - this.graphPaddingTop} height={responsive.height - this.graphPaddingTop}
data-testid="layout" data-testid="layout-graph"
ref={canvas => { ref={canvas => {
this.reglCanvas = canvas; this.reglCanvas = canvas;
}} }}
@@ -14,6 +14,7 @@ const setupScatterplot = (width, height, margin) => {
.append("svg") .append("svg")
.attr("width", width + margin.left + margin.right) .attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom) .attr("height", height + margin.top + margin.bottom)
.attr("data-testid", "scatterplot-svg")
.append("g") .append("g")
.attr("transform", `translate(${margin.left},${margin.top})`); .attr("transform", `translate(${margin.left},${margin.top})`);