mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-12-03 19:41:40 +00:00
+1
-1
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user