Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #120 from RaenonX-DL/dev
Browse files Browse the repository at this point in the history
v2.5.1 Release
  • Loading branch information
RaenonX authored May 27, 2021
2 parents 1d0aa8a + 70f31c0 commit 7c23a88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/components/elements/posts/analysis/lookup/main.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Analysis lookup page', () => {
expect(fnGetLookup).toHaveBeenCalledTimes(1);
});
await waitFor(async () => {
expect(fnScroll).toHaveBeenCalledTimes(1);
expect(fnScroll).toHaveBeenCalledTimes(2);
expect(screen.queryByAltText('Gala Leonidas')).toBeInTheDocument();
});
});
Expand All @@ -121,7 +121,7 @@ describe('Analysis lookup page', () => {
expect(fnGetLookup).toHaveBeenCalledTimes(1);
});
await waitFor(async () => {
expect(fnScroll).toHaveBeenCalledTimes(1);
expect(fnScroll).toHaveBeenCalledTimes(2);
});
expect(screen.queryByAltText('Gala Leonidas')).not.toBeInTheDocument();
});
Expand All @@ -147,7 +147,7 @@ describe('Analysis lookup page', () => {
expect(fnGetLookup).toHaveBeenCalledTimes(1);
});
await waitFor(async () => {
expect(fnScroll).toHaveBeenCalledTimes(1);
expect(fnScroll).toHaveBeenCalledTimes(2);
});
expect(screen.queryByText('Gala Leonidas')).not.toBeInTheDocument();

Expand All @@ -165,6 +165,9 @@ describe('Analysis lookup page', () => {
await waitFor(async () => {
expect(fnGetLookup).toHaveBeenCalledTimes(1);
});
await waitFor(async () => {
expect(fnScroll).toHaveBeenCalledTimes(3);
});
await waitFor(async () => {
expect(screen.queryByAltText('Gala Leonidas')).toBeInTheDocument();
});
Expand Down Expand Up @@ -310,7 +313,7 @@ describe('Analysis lookup page', () => {

await waitFor(() => {
expect(fnGetLookup).toHaveBeenCalledTimes(1);
expect(fnScroll).toHaveBeenCalledTimes(1);
expect(fnScroll).toHaveBeenCalledTimes(2);
expect(screen.queryByText(translationEN.posts.analysis.error.noResult)).toBeInTheDocument();
});
const errorText = screen.getByText(translationEN.posts.analysis.error.noResult);
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/posts/analysis/lookup/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const AnalysisPostLookup = () => {
setInputForward(data);
}}
/>
{inputForward && <AnalysisLookupOutput inputData={inputForward}/>}
<AnalysisLookupOutput inputData={inputForward}/>
</>
);
};
8 changes: 6 additions & 2 deletions src/components/elements/posts/analysis/lookup/out/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {getUnitInfo} from '../utils';
import {AnalysisEntry} from './entry';

type AnalysisLookupOutputProps = {
inputData: InputData,
inputData: InputData | undefined,
}

export const AnalysisLookupOutput = ({inputData}: AnalysisLookupOutputProps) => {
Expand Down Expand Up @@ -42,14 +42,18 @@ export const AnalysisLookupOutput = ({inputData}: AnalysisLookupOutputProps) =>
scrollToTop(rowElem);
}, [inputData]);

if (!inputData) {
return <></>;
}

fetchAnalysisMeta();

const unitInfoFiltered = getUnitInfo(inputData, charaInfo, dragonInfo);
// Split to prioritize the units that have analysis
const unitInfoHasAnalysis = unitInfoFiltered.filter((info) => info.id in analysisMeta.data.analyses);
const unitInfoNoAnalysis = unitInfoFiltered.filter((info) => !(info.id in analysisMeta.data.analyses));

if (inputData && charaInfo.length && dragonInfo.length && !unitInfoFiltered.length) {
if (charaInfo.length && dragonInfo.length && !unitInfoFiltered.length) {
return (
<h5 className="text-danger text-center">
{t((t) => t.posts.analysis.error.noResult)}
Expand Down

0 comments on commit 7c23a88

Please sign in to comment.