mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-18 18:38:11 +08:00
* Undo selection appends diffExp genes to user gene list Fixes https://github.com/chanzuckerberg/cellxgene/issues/1171 Need: When a user performs a differential expression from within a sub-selection (world) of the data and then resets the selection to all cells (universe), the differential expression results are no longer valid. Approach: * When the selection is reset, move the top (maxUserDefinedGenes - len(userDefinedGenes) from the differential expression results to the list of user defined genes * Raise maxUserDefinedGenes to 25 to give users more room and accommodate the extra genes transferred in from differential expression Other commits: * Choose different button icons * Add diff exp genes to user defined genes on subset too * Respond to feedback from @liaprins-czi and @bkmartinjr
25 lines
928 B
JavaScript
25 lines
928 B
JavaScript
/*
|
|
test controls helpers
|
|
*/
|
|
import { subsetAndResetGeneLists } from "../../../src/util/stateManager/controlsHelpers";
|
|
import * as globals from "../../../src/globals";
|
|
|
|
describe("controls helpers", () => {
|
|
|
|
test("subsetAndResetGeneLists", () => {
|
|
const geneList = [...Array(150).keys()].map(() =>
|
|
Math.random().toString(36).substring(2, 6) // random string of 4 characters
|
|
);
|
|
const state = {
|
|
userDefinedGenes: geneList.slice(0, 20),
|
|
diffexpGenes: geneList.slice(20),
|
|
};
|
|
const [newUserDefinedGenes, newDiffExpGenes] = subsetAndResetGeneLists(state);
|
|
expect(globals.maxUserDefinedGenes).toBeLessThan(globals.maxGenes);
|
|
expect(geneList.length).toBeGreaterThan(globals.maxGenes);
|
|
expect(newUserDefinedGenes).toHaveLength(globals.maxGenes);
|
|
expect(newUserDefinedGenes).toStrictEqual(geneList.slice(0, globals.maxGenes));
|
|
expect(newDiffExpGenes).toStrictEqual([]);
|
|
});
|
|
});
|