chore: actually use the right packages - went and messed up a bit

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2021-06-11 10:52:51 +02:00
parent 359a118902
commit 31e067d346
6 changed files with 50 additions and 8 deletions
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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 = (
<>
<MockComponent>
<>
<FeatureFlagComponent flag="testing-flag">
<WrappingComponent key="first">
<InnerComponent />
</WrappingComponent>
</FeatureFlagComponent>
</>
<MockComponent>
hello my name
<>
<WrappingComponent key="second">
<InnerComponent />
</WrappingComponent>
</>
</MockComponent>
is text
<InnerComponent />
</MockComponent>
</>
);
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);
});
});
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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"