diff --git a/src/components/SelectionList/RadioListItem.tsx b/src/components/SelectionList/RadioListItem.tsx index b595008e4e3bb..c7884690c067d 100644 --- a/src/components/SelectionList/RadioListItem.tsx +++ b/src/components/SelectionList/RadioListItem.tsx @@ -40,6 +40,7 @@ function RadioListItem({ keyForList={item.keyForList} onFocus={onFocus} shouldSyncFocus={shouldSyncFocus} + pendingAction={item.pendingAction} > <> diff --git a/src/components/TagPicker/index.tsx b/src/components/TagPicker/index.tsx index cbd9418a83e9f..40a0ac5e487f4 100644 --- a/src/components/TagPicker/index.tsx +++ b/src/components/TagPicker/index.tsx @@ -11,12 +11,14 @@ import type * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PolicyTag, PolicyTagList, PolicyTags, RecentlyUsedTags} from '@src/types/onyx'; +import type {PendingAction} from '@src/types/onyx/OnyxCommon'; type SelectedTagOption = { name: string; enabled: boolean; isSelected?: boolean; accountID: number | undefined; + pendingAction?: PendingAction; }; type TagPickerOnyxProps = { diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 0d58547649465..e5e78d52c3f87 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -77,6 +77,7 @@ type OptionTree = { tooltipText: string; isDisabled: boolean; isSelected: boolean; + pendingAction?: OnyxCommon.PendingAction; } & Option; type PayeePersonalDetails = { @@ -106,6 +107,7 @@ type TaxRatesOption = { isDisabled?: boolean; keyForList?: string; isSelected?: boolean; + pendingAction?: OnyxCommon.PendingAction; }; type TaxSection = { @@ -123,6 +125,7 @@ type Category = { name: string; enabled: boolean; isSelected?: boolean; + pendingAction?: OnyxCommon.PendingAction; }; type Tax = { @@ -952,6 +955,7 @@ function sortCategories(categories: Record): Category[] { lodashSet(hierarchy, path, { ...existedValue, name: category.name, + pendingAction: category.pendingAction, }); }); @@ -962,10 +966,11 @@ function sortCategories(categories: Record): Category[] { */ const flatHierarchy = (initialHierarchy: Hierarchy) => Object.values(initialHierarchy).reduce((acc: Category[], category) => { - const {name, ...subcategories} = category; + const {name, pendingAction, ...subcategories} = category; if (name) { const categoryObject: Category = { name, + pendingAction, enabled: categories[name]?.enabled ?? false, }; @@ -1015,8 +1020,9 @@ function getCategoryOptionTree(options: Record | Category[], i keyForList: option.name, searchText: option.name, tooltipText: option.name, - isDisabled: !option.enabled, + isDisabled: !option.enabled || option.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, isSelected: !!option.isSelected, + pendingAction: option.pendingAction, }); return; @@ -1036,8 +1042,9 @@ function getCategoryOptionTree(options: Record | Category[], i keyForList: searchText, searchText, tooltipText: optionName, - isDisabled: isChild ? !option.enabled : true, + isDisabled: isChild ? !option.enabled || option.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE : true, isSelected: isChild ? !!option.isSelected : selectedOptionsName.includes(searchText), + pendingAction: option.pendingAction, }); }); }); @@ -1137,7 +1144,10 @@ function getCategoryListSections( } const filteredRecentlyUsedCategories = recentlyUsedCategories - .filter((categoryName) => !selectedOptionNames.includes(categoryName) && categories[categoryName]?.enabled) + .filter( + (categoryName) => + !selectedOptionNames.includes(categoryName) && categories[categoryName]?.enabled && categories[categoryName]?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, + ) .map((categoryName) => ({ name: categoryName, enabled: categories[categoryName].enabled ?? false, @@ -1173,7 +1183,7 @@ function getCategoryListSections( * * @param tags - an initial tag array */ -function getTagsOptions(tags: Array>, selectedOptions?: SelectedTagOption[]): Option[] { +function getTagsOptions(tags: Array>, selectedOptions?: SelectedTagOption[]): Option[] { return tags.map((tag) => { // This is to remove unnecessary escaping backslash in tag name sent from backend. const cleanedName = PolicyUtils.getCleanedTagName(tag.name); @@ -1182,8 +1192,9 @@ function getTagsOptions(tags: Array>, select keyForList: tag.name, searchText: tag.name, tooltipText: cleanedName, - isDisabled: !tag.enabled, + isDisabled: !tag.enabled || tag.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, isSelected: selectedOptions?.some((selectedTag) => selectedTag.name === tag.name), + pendingAction: tag.pendingAction, }; }); } @@ -1256,7 +1267,7 @@ function getTagListSections( const filteredRecentlyUsedTags = recentlyUsedTags .filter((recentlyUsedTag) => { const tagObject = tags.find((tag) => tag.name === recentlyUsedTag); - return !!tagObject?.enabled && !selectedOptionNames.includes(recentlyUsedTag); + return !!tagObject?.enabled && !selectedOptionNames.includes(recentlyUsedTag) && tagObject?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; }) .map((tag) => ({name: tag, enabled: true})); @@ -1386,14 +1397,15 @@ function sortTaxRates(taxRates: TaxRates): TaxRate[] { * Builds the options for taxRates */ function getTaxRatesOptions(taxRates: Array>): TaxRatesOption[] { - return taxRates.map(({code, modifiedName, isDisabled, isSelected}) => ({ + return taxRates.map(({code, modifiedName, isDisabled, isSelected, pendingAction}) => ({ code, text: modifiedName, keyForList: modifiedName, searchText: modifiedName, tooltipText: modifiedName, - isDisabled, + isDisabled: !!isDisabled || pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, isSelected, + pendingAction, })); } diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index ae8a93efda96a..bcb569ba4490e 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -7,6 +7,7 @@ import * as OptionsListUtils from '@src/libs/OptionsListUtils'; import * as ReportUtils from '@src/libs/ReportUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetails, Policy, PolicyCategories, Report, TaxRatesWithDefault, Transaction} from '@src/types/onyx'; +import type {PendingAction} from '@src/types/onyx/OnyxCommon'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; type PersonalDetailsList = Record; @@ -817,6 +818,7 @@ describe('OptionsListUtils', () => { 'GL Code': '', externalID: '', origin: '', + pendingAction: undefined, }, Restaurant: { enabled: true, @@ -826,6 +828,7 @@ describe('OptionsListUtils', () => { 'GL Code': '', externalID: '', origin: '', + pendingAction: 'delete', }, Food: { enabled: true, @@ -835,6 +838,7 @@ describe('OptionsListUtils', () => { 'GL Code': '', externalID: '', origin: '', + pendingAction: undefined, }, 'Food: Meat': { enabled: true, @@ -844,6 +848,7 @@ describe('OptionsListUtils', () => { 'GL Code': '', externalID: '', origin: '', + pendingAction: undefined, }, }; const smallResultList: OptionsListUtils.CategoryTreeSection[] = [ @@ -858,6 +863,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Meat', @@ -866,14 +872,16 @@ describe('OptionsListUtils', () => { tooltipText: 'Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Restaurant', keyForList: 'Restaurant', searchText: 'Restaurant', tooltipText: 'Restaurant', - isDisabled: false, + isDisabled: true, isSelected: false, + pendingAction: 'delete', }, ], indexOffset: 3, @@ -892,6 +900,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food: Meat', @@ -900,6 +909,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food: Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1053,6 +1063,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Medical', isDisabled: true, isSelected: true, + pendingAction: undefined, }, ], }, @@ -1068,6 +1079,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Restaurant', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1083,6 +1095,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cars', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' Audi', @@ -1091,6 +1104,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Audi', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Mercedes-Benz', @@ -1099,6 +1113,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Mercedes-Benz', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food', @@ -1107,6 +1122,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Meat', @@ -1115,6 +1131,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Milk', @@ -1123,6 +1140,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Milk', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Restaurant', @@ -1131,6 +1149,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Restaurant', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Travel', @@ -1139,6 +1158,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Travel', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' Meals', @@ -1147,6 +1167,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meals', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Breakfast', @@ -1155,6 +1176,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Breakfast', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Lunch', @@ -1163,6 +1185,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Lunch', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1180,6 +1203,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food: Meat', @@ -1188,6 +1212,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food: Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food: Milk', @@ -1196,6 +1221,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food: Milk', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1222,6 +1248,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Medical', isDisabled: true, isSelected: true, + pendingAction: undefined, }, ], }, @@ -1316,6 +1343,7 @@ describe('OptionsListUtils', () => { enabled: true, name: 'HR', accountID: undefined, + pendingAction: 'delete', }, }; const smallResultList: OptionsListUtils.CategorySection[] = [ @@ -1331,14 +1359,16 @@ describe('OptionsListUtils', () => { tooltipText: 'Accounting', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'HR', keyForList: 'HR', searchText: 'HR', tooltipText: 'HR', - isDisabled: false, + isDisabled: true, isSelected: false, + pendingAction: 'delete', }, { text: 'Medical', @@ -1347,6 +1377,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Medical', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1363,6 +1394,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Accounting', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1424,6 +1456,7 @@ describe('OptionsListUtils', () => { enabled: true, name: 'Taxes', accountID: undefined, + pendingAction: 'delete', }, Benefits: { enabled: true, @@ -1443,6 +1476,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Medical', isDisabled: false, isSelected: true, + pendingAction: undefined, }, ], }, @@ -1457,6 +1491,7 @@ describe('OptionsListUtils', () => { tooltipText: 'HR', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1472,6 +1507,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Accounting', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Benefits', @@ -1480,6 +1516,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Benefits', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Cleaning', @@ -1488,6 +1525,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cleaning', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food', @@ -1496,6 +1534,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'HR', @@ -1504,6 +1543,7 @@ describe('OptionsListUtils', () => { tooltipText: 'HR', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Software', @@ -1512,14 +1552,16 @@ describe('OptionsListUtils', () => { tooltipText: 'Software', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Taxes', keyForList: 'Taxes', searchText: 'Taxes', tooltipText: 'Taxes', - isDisabled: false, + isDisabled: true, isSelected: false, + pendingAction: 'delete', }, ], }, @@ -1536,6 +1578,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Accounting', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Cleaning', @@ -1544,6 +1587,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cleaning', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ], }, @@ -1705,6 +1749,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meals', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Restaurant', @@ -1713,6 +1758,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Restaurant', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food', @@ -1721,6 +1767,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Meat', @@ -1729,6 +1776,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Milk', @@ -1737,6 +1785,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Milk', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Cars', @@ -1745,6 +1794,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cars', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' Audi', @@ -1753,6 +1803,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Audi', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Mercedes-Benz', @@ -1761,6 +1812,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Mercedes-Benz', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Travel', @@ -1769,6 +1821,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Travel', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' Meals', @@ -1777,6 +1830,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meals', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Breakfast', @@ -1785,6 +1839,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Breakfast', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' Lunch', @@ -1793,6 +1848,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Lunch', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Plain', @@ -1801,6 +1857,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Plain', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Audi', @@ -1809,6 +1866,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Audi', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Health', @@ -1817,6 +1875,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Health', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'A', @@ -1825,6 +1884,7 @@ describe('OptionsListUtils', () => { tooltipText: 'A', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' B', @@ -1833,6 +1893,7 @@ describe('OptionsListUtils', () => { tooltipText: 'B', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' C', @@ -1841,6 +1902,7 @@ describe('OptionsListUtils', () => { tooltipText: 'C', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: ' D', @@ -1849,6 +1911,7 @@ describe('OptionsListUtils', () => { tooltipText: 'D', isDisabled: true, isSelected: false, + pendingAction: undefined, }, { text: ' E', @@ -1857,6 +1920,7 @@ describe('OptionsListUtils', () => { tooltipText: 'E', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ]; const resultOneLine = [ @@ -1867,6 +1931,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Meals', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Restaurant', @@ -1875,6 +1940,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Restaurant', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food', @@ -1883,6 +1949,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food: Meat', @@ -1891,6 +1958,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food: Meat', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Food: Milk', @@ -1899,6 +1967,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Food: Milk', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Cars: Audi', @@ -1907,6 +1976,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cars: Audi', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Cars: Mercedes-Benz', @@ -1915,6 +1985,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Cars: Mercedes-Benz', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Travel: Meals', @@ -1923,6 +1994,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Travel: Meals', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Travel: Meals: Breakfast', @@ -1931,6 +2003,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Travel: Meals: Breakfast', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Travel: Meals: Lunch', @@ -1939,6 +2012,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Travel: Meals: Lunch', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Plain', @@ -1947,6 +2021,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Plain', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Audi', @@ -1955,6 +2030,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Audi', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'Health', @@ -1963,6 +2039,7 @@ describe('OptionsListUtils', () => { tooltipText: 'Health', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'A: B: C', @@ -1971,6 +2048,7 @@ describe('OptionsListUtils', () => { tooltipText: 'A: B: C', isDisabled: false, isSelected: false, + pendingAction: undefined, }, { text: 'A: B: C: D: E', @@ -1979,6 +2057,7 @@ describe('OptionsListUtils', () => { tooltipText: 'A: B: C: D: E', isDisabled: false, isSelected: false, + pendingAction: undefined, }, ]; @@ -2007,6 +2086,7 @@ describe('OptionsListUtils', () => { Test: { name: 'Test', enabled: true, + pendingAction: 'delete' as PendingAction, }, Test1: { name: 'Test1', @@ -2061,70 +2141,87 @@ describe('OptionsListUtils', () => { { name: 'Taxes', enabled: true, + pendingAction: undefined, }, { name: 'Taxi', enabled: false, + pendingAction: undefined, }, { name: 'Test', enabled: true, + pendingAction: 'delete', }, { name: 'Test: Test1', enabled: true, + pendingAction: undefined, }, { name: 'Test: Test1: Subtest1', enabled: true, + pendingAction: undefined, }, { name: 'Test: Test1: Subtest2', enabled: true, + pendingAction: undefined, }, { name: 'Test: Test1: Subtest3', enabled: false, + pendingAction: undefined, }, { name: 'Test: Test1: Subtest4', enabled: true, + pendingAction: undefined, }, { name: 'Test: Test2', enabled: true, + pendingAction: undefined, }, { name: 'Test: Test3: Subtest1', enabled: true, + pendingAction: undefined, }, { name: 'Test1', enabled: true, + pendingAction: undefined, }, { name: 'Test1: Subtest1', enabled: true, + pendingAction: undefined, }, { name: 'Test1: Subtest2', enabled: true, + pendingAction: undefined, }, { name: 'Test1: Subtest3', enabled: true, + pendingAction: undefined, }, { name: 'Travel', enabled: true, + pendingAction: undefined, }, { name: 'Travel: Nested-Travel', enabled: true, + pendingAction: undefined, }, { name: 'Utilities', enabled: true, + pendingAction: undefined, }, ]; const categoriesIncorrectOrdering2 = { @@ -2189,58 +2286,72 @@ describe('OptionsListUtils', () => { { enabled: true, name: 'Cars: Audi', + pendingAction: undefined, }, { enabled: false, name: 'Cars: BMW', + pendingAction: undefined, }, { enabled: true, name: 'Cars: Mercedes-Benz', + pendingAction: undefined, }, { enabled: true, name: 'Food', + pendingAction: undefined, }, { enabled: true, name: 'Food: Meat', + pendingAction: undefined, }, { enabled: true, name: 'Food: Milk', + pendingAction: undefined, }, { enabled: false, name: 'Food: Vegetables', + pendingAction: undefined, }, { enabled: false, name: 'Medical', + pendingAction: undefined, }, { enabled: true, name: 'Restaurant', + pendingAction: undefined, }, { enabled: false, name: 'Taxi', + pendingAction: undefined, }, { enabled: true, name: 'Travel: Meals', + pendingAction: undefined, }, { enabled: true, name: 'Travel: Meals: Breakfast', + pendingAction: undefined, }, { enabled: false, name: 'Travel: Meals: Dinner', + pendingAction: undefined, }, { enabled: true, name: 'Travel: Meals: Lunch', + pendingAction: undefined, }, ]; const categoriesIncorrectOrdering3 = { @@ -2273,26 +2384,32 @@ describe('OptionsListUtils', () => { { enabled: true, name: 'Dr. House', + pendingAction: undefined, }, { enabled: true, name: 'House, M.D.', + pendingAction: undefined, }, { enabled: true, name: 'Many.dots.on.the.way.', + pendingAction: undefined, }, { enabled: false, name: 'More.Many.dots.on.the.way.', + pendingAction: undefined, }, { enabled: true, name: 'Movies', + pendingAction: undefined, }, { enabled: true, name: 'Movies: Mr. Nobody', + pendingAction: undefined, }, ]; @@ -2541,18 +2658,21 @@ describe('OptionsListUtils', () => { value: '3%', code: 'CODE2', modifiedName: 'Tax rate 2 (3%)', + pendingAction: 'delete', }, CODE3: { name: 'Tax option 3', value: '5%', code: 'CODE3', modifiedName: 'Tax option 3 (5%)', + pendingAction: undefined, }, CODE1: { name: 'Tax exempt 1', value: '0%', code: 'CODE1', modifiedName: 'Tax exempt 1 (0%) • Default', + pendingAction: undefined, }, }, }; @@ -2569,30 +2689,33 @@ describe('OptionsListUtils', () => { data: [ { code: 'CODE1', - isDisabled: undefined, + isDisabled: false, isSelected: undefined, keyForList: 'Tax exempt 1 (0%) • Default', searchText: 'Tax exempt 1 (0%) • Default', text: 'Tax exempt 1 (0%) • Default', tooltipText: 'Tax exempt 1 (0%) • Default', + pendingAction: undefined, }, { code: 'CODE3', - isDisabled: undefined, + isDisabled: false, isSelected: undefined, keyForList: 'Tax option 3 (5%)', searchText: 'Tax option 3 (5%)', text: 'Tax option 3 (5%)', tooltipText: 'Tax option 3 (5%)', + pendingAction: undefined, }, { code: 'CODE2', - isDisabled: undefined, + isDisabled: true, isSelected: undefined, keyForList: 'Tax rate 2 (3%)', searchText: 'Tax rate 2 (3%)', text: 'Tax rate 2 (3%)', tooltipText: 'Tax rate 2 (3%)', + pendingAction: 'delete', }, ], shouldShow: false, @@ -2605,12 +2728,13 @@ describe('OptionsListUtils', () => { data: [ { code: 'CODE2', - isDisabled: undefined, + isDisabled: true, isSelected: undefined, keyForList: 'Tax rate 2 (3%)', searchText: 'Tax rate 2 (3%)', text: 'Tax rate 2 (3%)', tooltipText: 'Tax rate 2 (3%)', + pendingAction: 'delete', }, ], shouldShow: true,