diff --git a/packages/app/package.json b/packages/app/package.json index bfd2b458ae..76d32b57ad 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -8,7 +8,7 @@ "@backstage/cli": "^0.7.0", "@backstage/core": "^0.7.12", "@backstage/integration-react": "^0.1.3", - "@backstage/core-app-api": "^0.1.1", + "@backstage/core-app-api": "^0.1.2", "@backstage/core-components": "^0.1.1", "@backstage/plugin-api-docs": "^0.4.15", "@backstage/plugin-badges": "^0.2.2", diff --git a/packages/core-plugin-api/package.json b/packages/core-plugin-api/package.json index b1d53e17c0..48706a5877 100644 --- a/packages/core-plugin-api/package.json +++ b/packages/core-plugin-api/package.json @@ -42,7 +42,7 @@ }, "devDependencies": { "@backstage/cli": "^0.7.0", - "@backstage/core-app-api": "^0.1.1", + "@backstage/core-app-api": "^0.1.2", "@backstage/test-utils": "^0.1.13", "@backstage/test-utils-core": "^0.1.1", "@testing-library/jest-dom": "^5.10.1", diff --git a/packages/core-plugin-api/src/extensions/useElementFilter.test.tsx b/packages/core-plugin-api/src/extensions/useElementFilter.test.tsx index 23a7fd77a7..d5c1b0befe 100644 --- a/packages/core-plugin-api/src/extensions/useElementFilter.test.tsx +++ b/packages/core-plugin-api/src/extensions/useElementFilter.test.tsx @@ -27,7 +27,7 @@ import { const WRAPPING_COMPONENT_KEY = 'core.blob.testing'; const INNER_COMPONENT_KEY = 'core.blob2.testing'; -const WrappingComponent = (props: { children: ReactNode }) => null; +const WrappingComponent = (_props: { children: ReactNode }) => null; attachComponentData(WrappingComponent, WRAPPING_COMPONENT_KEY, { message: 'hey! im wrapping component data', }); @@ -35,9 +35,9 @@ const InnerComponent = () => null; attachComponentData(InnerComponent, INNER_COMPONENT_KEY, { message: 'hey! im the inner component', }); -const MockComponent = (props: { children: ReactNode }) => null; +const MockComponent = (_props: { children: ReactNode }) => null; -const FeatureFlagComponent = (props: { children: ReactNode; flag: string }) => +const FeatureFlagComponent = (_props: { children: ReactNode; flag: string }) => null; attachComponentData(FeatureFlagComponent, 'core.featureFlagged', true); const mockFeatureFlagsApi = new LocalStorageFeatureFlags(); @@ -245,4 +245,46 @@ describe('useElementFilter', () => { expect(result.error.message).toEqual('Could not find component'); }); + + it('should support fragments and text node iteration', () => { + jest.spyOn(mockFeatureFlagsApi, 'isActive').mockImplementation(() => true); + const tree = ( + <> + + <> + + + + + + + + hello my name + <> + + + + + + is text + + + + ); + + const { result } = renderHook( + props => + useElementFilter(props.tree, elements => + elements + .selectByComponentData({ key: WRAPPING_COMPONENT_KEY }) + .getElements(), + ), + { + initialProps: { tree }, + wrapper: Wrapper, + }, + ); + + expect(result.current.length).toBe(2); + }); }); diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 56299462c6..e1e3b388a1 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -33,7 +33,7 @@ "@backstage/catalog-client": "^0.3.13", "@backstage/catalog-model": "^0.8.2", "@backstage/core": "^0.7.12", - "@backstage/core-plugin-api": "^0.1.1", + "@backstage/core-plugin-api": "^0.1.2", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.6", "@backstage/integration-react": "^0.1.3", diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 3cb046966a..9790073211 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -37,7 +37,7 @@ "@backstage/integration": "^0.5.6", "@backstage/integration-react": "^0.1.3", "@backstage/plugin-catalog-react": "^0.2.2", - "@backstage/core-plugin-api": "^0.1.1", + "@backstage/core-plugin-api": "^0.1.2", "@backstage/errors": "^0.1.1", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", diff --git a/yarn.lock b/yarn.lock index 8c7cf9ee8f..708b96efcc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1394,7 +1394,7 @@ "@backstage/catalog-client" "^0.3.13" "@backstage/catalog-model" "^0.8.2" "@backstage/core" "^0.7.12" - "@backstage/core-plugin-api" "^0.1.1" + "@backstage/core-plugin-api" "^0.1.2" "@backstage/errors" "^0.1.1" "@backstage/integration" "^0.5.6" "@backstage/integration-react" "^0.1.3"