diff --git a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap index 9e92f77915..6a1fa2083d 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap @@ -37439,6 +37439,25 @@ wrapper.selectOptionByValue('option_1'); }, { "methods": [ + { + "description": "Returns a flash item by its id. + +The id is matched against the \`id\` property of each item passed to the \`items\` property of the Flashbar component.", + "name": "findItemById", + "parameters": [ + { + "flags": { + "isOptional": false, + }, + "name": "id", + "typeName": "string", + }, + ], + "returnType": { + "isNullable": true, + "name": "FlashWrapper", + }, + }, { "description": "Returns the individual flashes of this flashbar. @@ -47270,6 +47289,25 @@ The mode selector is only rendered as a Select on narrow viewports. On wide view }, { "methods": [ + { + "description": "Returns a flash item by its id. + +The id is matched against the \`id\` property of each item passed to the \`items\` property of the Flashbar component.", + "name": "findItemById", + "parameters": [ + { + "flags": { + "isOptional": false, + }, + "name": "id", + "typeName": "string", + }, + ], + "returnType": { + "isNullable": true, + "name": "FlashWrapper", + }, + }, { "description": "Returns the individual flashes of this flashbar. diff --git a/src/flashbar/__tests__/collapsible.test.tsx b/src/flashbar/__tests__/collapsible.test.tsx index a6fb5f6372..241dbecd48 100644 --- a/src/flashbar/__tests__/collapsible.test.tsx +++ b/src/flashbar/__tests__/collapsible.test.tsx @@ -620,6 +620,25 @@ describe('Collapsible Flashbar', () => { disableMotion(true); testFlashDismissal({ stackItems: true }); }); + + test('findItemById', () => { + const wrapper = createFlashbarWrapper( + + ); + expect(wrapper.findItemById('flash-1')).not.toBeNull(); + expect(wrapper.findItemById('flash-2')).toBeNull(); + + findNotificationBar(wrapper)!.click(); + + expect(wrapper.findItemById('flash-1')).not.toBeNull(); + expect(wrapper.findItemById('flash-2')).not.toBeNull(); + }); }); // Entire interactive element including the counter and the actual