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

Disable bin step kneeplot #955

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { initialPlotConfigStates } from 'redux/reducers/componentConfig/initialS
import { generateDataProcessingPlotUuid } from 'utils/generateCustomPlotUuid';
import CellSizeDistribution from 'components/data-processing/CellSizeDistribution/CellSizeDistribution';
import CalculationConfig from 'components/data-processing/CellSizeDistribution/CalculationConfig';
import SliderWithInput from 'components/SliderWithInput';
import generateExperimentSettingsMock from '../../../test-utils/experimentSettings.mock';

import filterStatisticsMock from '../../../test-utils/plotData.mock';
Expand Down Expand Up @@ -147,4 +148,31 @@ describe('CellSizeDistribution', () => {
expect(plots.length).toEqual(3);
expect(tables.length).toEqual(1);
});
it('Disables bin step slider when plot type is knee plot', () => {
const modifiedWithData = {
...withData,
componentConfig: {
...withData.componentConfig,
plotType: 'kneePlot',
},
};

const store = mockStore(modifiedWithData);

const component = mount(
<Provider store={store}>
<CellSizeDistribution
experimentId={experimentId}
sampleId={sampleId}
sampleIds={sampleIds}
onConfigChange={() => { }}
/>
</Provider>,
);

const page = component.find(CellSizeDistribution).at(0);
const calculationConfig = page.find(CalculationConfig);
const sliderWithInput = calculationConfig.find(SliderWithInput);
expect(sliderWithInput.props().disabled).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const MIN_CELL_SIZE_PLACEHOLDER = 10800;

const CellSizeDistributionConfig = (props) => {
const {
config, disabled, updateSettings, highestUmi,
config, disabled, updateSettings, highestUmi, plotType,
} = props;

const withinRange = (cellSize) => Math.max(Math.min(cellSize, highestUmi), 0);
Expand Down Expand Up @@ -54,7 +54,7 @@ const CellSizeDistributionConfig = (props) => {
onUpdate={(value) => {
updateSettings({ binStep: value });
}}
disabled={disabled}
disabled={disabled || plotType === 'kneePlot'}
/>
</Form.Item>
</>
Expand All @@ -65,12 +65,14 @@ CellSizeDistributionConfig.defaultProps = {
config: {},
disabled: false,
highestUmi: null,
plotType: null,
};
CellSizeDistributionConfig.propTypes = {
updateSettings: PropTypes.func,
config: PropTypes.object,
disabled: PropTypes.bool,
highestUmi: PropTypes.number,
plotType: PropTypes.string,
};

export default CellSizeDistributionConfig;
Loading