change naming of DocsResultListItem -> TechDocsSearchResultListItem to follow pattern

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-02-22 15:28:41 +01:00
parent 3d94a70270
commit 542b839631
5 changed files with 43 additions and 34 deletions
@@ -1,17 +0,0 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { DocsResultListItem } from './DocsResultListItem';
@@ -16,7 +16,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { DocsResultListItem } from './DocsResultListItem';
import { TechDocsSearchResultListItem } from './TechDocsSearchResultListItem';
// Using canvas to render text..
jest.mock('react-text-truncate', () => {
@@ -44,9 +44,11 @@ const validResultWithTitle = {
lifecycle: 'production',
};
describe('DocsResultListItem test', () => {
describe('TechDocsSearchResultListItem test', () => {
it('should render search doc passed in', async () => {
const { findByText } = render(<DocsResultListItem result={validResult} />);
const { findByText } = render(
<TechDocsSearchResultListItem result={validResult} />,
);
expect(
await findByText('Documentation | Backstage docs'),
@@ -60,7 +62,10 @@ describe('DocsResultListItem test', () => {
it('should use title if defined', async () => {
const { findByText } = render(
<DocsResultListItem result={validResult} title="Count Dookumentation" />,
<TechDocsSearchResultListItem
result={validResult}
title="Count Dookumentation"
/>,
);
expect(await findByText('Count Dookumentation')).toBeInTheDocument();
@@ -73,7 +78,7 @@ describe('DocsResultListItem test', () => {
it('should use entity title if defined', async () => {
const { findByText } = render(
<DocsResultListItem result={validResultWithTitle} />,
<TechDocsSearchResultListItem result={validResultWithTitle} />,
);
expect(
@@ -29,19 +29,34 @@ const useStyles = makeStyles({
},
});
export const DocsResultListItem = ({
result,
lineClamp = 5,
asListItem = true,
asLink = true,
title,
}: {
/**
* Props for {@link TechDocsSearchResultListItem}.
*
* @public
*/
export type TechDocsSearchResultListItemProps = {
result: any;
lineClamp?: number;
asListItem?: boolean;
asLink?: boolean;
title?: string;
}) => {
};
/**
* Component which renders documentation and related metadata.
*
* @public
*/
export const TechDocsSearchResultListItem = (
props: TechDocsSearchResultListItemProps,
) => {
const {
result,
lineClamp = 5,
asListItem = true,
asLink = true,
title,
} = props;
const classes = useStyles();
const TextItem = () => (
<ListItemText
@@ -86,3 +101,9 @@ export const DocsResultListItem = ({
</LinkWrapper>
);
};
/**
* @public
* @deprecated use {@link TechDocsSearchResultListItem} instead
*/
export const DocsResultListItem = TechDocsSearchResultListItem;