Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Set provided species parameter to GeneSearchForm #153

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,48 @@ describe(`CellTypeWheelExperimentHeatmap`, () => {
cell => cy.contains(cell.geneName)
)
})

it(`species filter defaults to 'Any' if the species is not provided`, () => {
cy.intercept(`GET`, `/gxa/sc/json/suggestions/species`, speciesResponse)

cy.viewport(800, 1000)
cy.mount(<CellTypeWheelExperimentHeatmap{...props}/>)

cy.get(`[data-cy='speciesDropDown']`)
.get(`div[class$='ValueContainer']`)
.last()
.invoke(`text`)
.should(`eq`, `Any`)
})

it(`species filter defaults to 'Any' if the provided species variable is empty`, () => {
props.species = ``

cy.intercept(`GET`, `/gxa/sc/json/suggestions/species`, speciesResponse)

cy.viewport(800, 1000)
cy.mount(<CellTypeWheelExperimentHeatmap{...props}/>)

cy.get(`[data-cy='speciesDropDown']`)
.get(`div[class$='ValueContainer']`)
.last()
.invoke(`text`)
.should(`eq`, `Any`)
})

it(`species filter selects the species value if it is provided`, () => {
const givenSpecies = `Mus musculus`
props.species = givenSpecies

cy.intercept(`GET`, `/gxa/sc/json/suggestions/species`, speciesResponse)

cy.viewport(800, 1000)
cy.mount(<CellTypeWheelExperimentHeatmap{...props}/>)

cy.get(`[data-cy='speciesDropDown']`)
.get(`div[class$='ValueContainer']`)
.last()
.invoke(`text`)
.should(`eq`, givenSpecies)
})
})
4 changes: 2 additions & 2 deletions packages/scxa-cell-type-wheel-experiment-heatmap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebi-gene-expression-group/scxa-cell-type-wheel-heatmap",
"version": "1.3.4",
"version": "1.4.0",
"publishConfig": {
"access": "public"
},
Expand All @@ -27,7 +27,7 @@
"dependencies": {
"@ebi-gene-expression-group/atlas-react-fetch-loader": "*",
"@ebi-gene-expression-group/scxa-cell-type-wheel": "^1.1.4",
"@ebi-gene-expression-group/scxa-gene-search-form": "*",
"@ebi-gene-expression-group/scxa-gene-search-form": "^2.0.1",
"@ebi-gene-expression-group/scxa-marker-gene-heatmap": "*",
"highcharts": "^10.1.0",
"highcharts-react-official": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ function CellTypeWheelExperimentHeatmap(props) {
defaultValue={ { term: props.searchTerm, category: `metadata` } }
enableSpeciesSelect={true}
speciesSelectClassName={`small-4 columns`}
defaultSpecies={props.species}
/>
<div className={`row-expanded small-12 columns`}>
<div className={`small-12 medium-6 columns`} aria-label={`Cell type wheel`}>
{props.searchTerm.trim() ?
<CellTypeWheelFetchLoader
host={props.host}
resource={URI(props.searchTerm, props.cellTypeWheelResource).toString()}
resource={URI(props.cellTypeWheelResource)
.segment(props.searchTerm)
.search(`?species=` + props.species)
lingyun1010 marked this conversation as resolved.
Show resolved Hide resolved
.toString()
}
fulfilledPayloadProvider={cellTypeWheelData => ({ data: cellTypeWheelData })}
searchTerm={props.searchTerm}
onCellTypeWheelClick={onCellTypeWheelClick}
Expand Down Expand Up @@ -99,7 +104,8 @@ CellTypeWheelExperimentHeatmap.propTypes = {
suggesterEndpoint: PropTypes.string,
cellTypeWheelResource: PropTypes.string,
heatmapResource: PropTypes.string,
searchTerm: PropTypes.string.isRequired
searchTerm: PropTypes.string.isRequired,
species: PropTypes.string
}

CellTypeWheelExperimentHeatmap.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/scxa-gene-search-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebi-gene-expression-group/scxa-gene-search-form",
"version": "2.0.0",
"version": "2.0.1",
"description": "Single Cell Expression Atlas homepage gene search form",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/scxa-gene-search-form/src/GeneSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GeneSearchForm extends React.Component {
return (
<form action={URI(actionEndpoint, host).toString()} method={`post`}>
<div className={wrapperClassName}>
<div className={autocompleteClassName}>
<div className={autocompleteClassName} data-cy={`searchTerm`}>
<Autocomplete
host={host}
suggesterEndpoint={suggesterEndpoint}
Expand All @@ -63,7 +63,7 @@ class GeneSearchForm extends React.Component {
labelText={autocompleteLabel}/>
</div>
{ enableSpeciesSelect &&
<div className={speciesSelectClassName}>
<div className={speciesSelectClassName} data-cy={`speciesDropDown`}>
<LabelledSelect
name={`species`}
topGroup={topSpecies}
Expand Down