This commit is contained in:
Allen
2018-08-26 14:02:49 +08:00
committed by GitHub
parent d64ee2e5e4
commit 9d37b23050
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -41,5 +41,5 @@ export const unSelectableKeys = (selected, skips = []) => {
};
export const getSelectedRows = (data, keyField, selected) =>
selected.map(k => getRowByRowId(data, keyField, k));
selected.map(k => getRowByRowId(data, keyField, k)).filter(x => !!x);
@@ -45,6 +45,14 @@ describe('Selection Function', () => {
expect(result).toHaveLength(selected.length);
expect(result).toEqual(data);
});
describe('if can not find the row', () => {
describe('should just skip it', () => {
const selected = [1, 4, 6, 7];
const result = getSelectedRows(data, keyField, selected);
expect(result).toHaveLength(2);
});
});
});
describe('getSelectionSummary', () => {