Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contributions/localizedStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@
"%interlinearizer_segmentation_lostBoundaries%": "The source text changed, so {count} of your segment boundary changes no longer fit it and aren't applied.",
"%interlinearizer_segmentation_lostBoundaries_one%": "The source text changed, so one of your segment boundary changes no longer fits it and isn't applied.",
"%interlinearizer_segmentation_lostBoundaries_dismiss%": "Dismiss this warning",
"%interlinearizer_staleNotice_glossesAndFreeTranslations%": "{glossCount} glosses and {freeTranslationCount} free translations in this book no longer match the text.",
"%interlinearizer_staleNotice_glosses%": "{count} glosses in this book no longer match the text.",
Comment thread
alex-rawlings-yyc marked this conversation as resolved.
"%interlinearizer_staleNotice_freeTranslations%": "{count} free translations in this book no longer match the text.",
"%interlinearizer_staleNotice_reviewGlosses%": "Review glosses",
"%interlinearizer_staleNotice_nextFreeTranslation%": "Next free translation",
"%interlinearizer_staleNotice_dismiss%": "Dismiss this notice",
"%interlinearizer_phraseBox_glossLabel%": "Phrase gloss",
"%interlinearizer_phraseBox_edit%": "Edit phrase",
"%interlinearizer_phraseBox_unlink%": "Unlink phrase",
Expand Down
53 changes: 53 additions & 0 deletions src/__tests__/components/AnalysisCatalogPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,59 @@ describe('AnalysisCatalogPanel', () => {
expect(listedAnalysisIds()).toEqual(['stale']);
});

describe('narrowed by its owner', () => {
/** An analysis applied at its place, and another stale at its. */
const LIVE_AND_STALE: TextAnalysis = {
...emptyAnalysis(),
tokenAnalyses: [
{ ...FIXTURE_STAMPS, id: 'live', surfaceText: 'λόγος' },
{ ...FIXTURE_STAMPS, id: 'stale', surfaceText: 'ἦν' },
],
tokenAnalysisLinks: [link('live', 'GEN 1:1:0'), link('stale', 'GEN 1:2:0', 'stale')],
};

it('keeps only the rows the filters it is handed keep', () => {
Comment thread
alex-rawlings-yyc marked this conversation as resolved.
const ref = createRef<AnalysisCatalogPanelHandle>();
renderPanel({ ref, analysis: LIVE_AND_STALE });

act(() => ref.current?.filterTo({ stale: true }));

expect(listedAnalysisIds()).toEqual(['stale']);
});

it('replaces the filters the reader had set', async () => {
const ref = createRef<AnalysisCatalogPanelHandle>();
const analysis: TextAnalysis = {
...LIVE_AND_STALE,
tokenAnalyses: [
{ ...FIXTURE_STAMPS, id: 'live', surfaceText: 'λόγος' },
{ ...FIXTURE_STAMPS, id: 'stale', surfaceText: 'ἦν', gloss: { en: 'was' } },
],
};
renderPanel({ ref, analysis, analysisLanguage: 'en' });
await openFilters();
await userEvent.click(
screen.getByRole('checkbox', {
name: '%interlinearizer_analysisCatalog_filter_missingGloss%',
}),
);

act(() => ref.current?.filterTo({ stale: true }));

expect(listedAnalysisIds()).toEqual(['stale']);
});

it('clears a search that would hide those rows', async () => {
const ref = createRef<AnalysisCatalogPanelHandle>();
renderPanel({ ref, analysis: LIVE_AND_STALE });
await userEvent.type(searchBox(), 'λόγος');

act(() => ref.current?.filterTo({ stale: true }));

expect(searchBox()).toHaveValue('');
});
});

describe('over an unsaved breakdown', () => {
/** Types a re-segmentation into an expanded row's breakdown without saving it. */
async function typeUnsavedBreakdown(analysisId = 'ta-1'): Promise<void> {
Expand Down
12 changes: 12 additions & 0 deletions src/__tests__/components/AnalysisStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
useSegmentsWithApprovedTranslation,
useStaleFreeTranslationDispatch,
useStaleFreeTranslationsBySegment,
useStaleTokenLinks,
useGloss,
useGlossDispatch,
useMorphemeBreakdownDispatch,
Expand Down Expand Up @@ -1084,6 +1085,17 @@ describe('useStaleFreeTranslationsBySegment', () => {
});
});

describe('useStaleTokenLinks', () => {
it('lists the places analyses went stale at', () => {
const stale: TokenAnalysisLink = { ...approvedLink('ta-1', 'tok-2'), status: 'stale' };
const { result } = renderStoreHook(() => useStaleTokenLinks(), {
initialAnalysis: twoHomographs([approvedLink('ta-1', 'tok-1'), stale]),
});

expect(result.current).toEqual([stale]);
});
});

describe('useSegmentFreeTranslationDispatch adopting a stale translation', () => {
it('persists the stale translation a value was typed over, approved', () => {
const onSave = jest.fn();
Expand Down
Loading
Loading