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
1 change: 1 addition & 0 deletions contributions/localizedStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"%interlinearizer_copyModal_create%": "Create copy",
"%interlinearizer_copyModal_cancel%": "Cancel",
"%interlinearizer_warning_pt9Sync_failed%": "The Paratext 9 data couldn't be refreshed; showing the last imported data.",
"%interlinearizer_warning_duplicateVerses%": "This book repeats one or more verse numbers. The repeated markers and their text aren't shown; fix the duplicates in the text to see them.",
"%interlinearizer_modal_metadata_lastSynced_label%": "Last synced"
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/components/ContinuousView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function makeBook(overrides?: Partial<Book>): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In the', [
makeWordToken('tok-0', 'In'),
Expand All @@ -210,6 +211,7 @@ function makeTwoChapterBook(): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'Alpha', [makeWordToken('ch1-tok-0', 'Alpha')]),
makeSegment('GEN 2:1', 'Beta', [makeWordToken('ch2-tok-0', 'Beta')]),
Expand All @@ -223,6 +225,7 @@ function makeSingleTokenBook(): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', 'Word', [makeWordToken('tok-only', 'Word')])],
};
}
Expand All @@ -233,6 +236,7 @@ function makeMixedBook(): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In the', [makeWordToken('mix-tok-0', 'In')]),
makeSegment('GEN 1:2', '.', [makePunctToken('mix-punct-0')]),
Expand All @@ -246,6 +250,7 @@ function makeWordFreeBook(): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', '...', [makePunctToken('wf-punct-0')])],
};
}
Expand All @@ -256,6 +261,7 @@ function makeLargeBook(count: number): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: Array.from({ length: count }, (_, i) => ({
id: `GEN 1:${i + 1}`,
startRef: { book: 'GEN', chapter: 1, verse: i + 1 },
Expand Down Expand Up @@ -540,6 +546,7 @@ describe('ContinuousView initial render', () => {
id: 'MAT',
bookRef: 'MAT',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('MAT 1:1', 'Alpha', [makeWordToken('mat-tok-0', 'Alpha')]),
makeSegment('MAT 1:2', 'Beta', [makeWordToken('mat-tok-1', 'Beta')]),
Expand All @@ -566,6 +573,7 @@ describe('ContinuousView initial render', () => {
id: 'MAT',
bookRef: 'MAT',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('MAT 1:1', 'Alpha', [makeWordToken('mat-tok-0', 'Alpha')]),
makeSegment('MAT 1:2', 'Beta', [makeWordToken('mat-tok-1', 'Beta')]),
Expand Down
7 changes: 7 additions & 0 deletions src/__tests__/components/FocusStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function makeBook(): Book {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In beginning', [
makeWordToken('GEN 1:1:0', 'In'),
Expand Down Expand Up @@ -261,6 +262,7 @@ describe('FocusProvider seeding', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', '', [])],
};

Expand Down Expand Up @@ -288,6 +290,7 @@ describe('FocusProvider seeding from a child', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', '', []), ...makeBook().segments.slice(1)],
};

Expand Down Expand Up @@ -389,6 +392,7 @@ describe('FocusProvider resolution rules', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: '2',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', 'Anew', [makeWordToken('GEN 1:1:9', 'Anew')])],
};
harness.setBook(retokenized);
Expand All @@ -401,6 +405,7 @@ describe('FocusProvider resolution rules', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [
{
...makeSegment('GEN 1:1', 'In beginning', [
Expand Down Expand Up @@ -429,6 +434,7 @@ describe('FocusProvider resolution rules', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('GEN 1:1', '', []), ...makeBook().segments.slice(1)],
};
const harness = renderFocus(noWordToken, GEN_1_1);
Expand Down Expand Up @@ -502,6 +508,7 @@ describe('FocusProvider resolution rules', () => {
id: 'MAT',
bookRef: 'MAT',
textVersion: '1',
duplicateVerseIds: [],
segments: [makeSegment('MAT 1:1', 'Alpha', [makeWordToken('MAT 1:1:0', 'Alpha')])],
};
const harness = renderFocus(makeBook(), GEN_1_1);
Expand Down
17 changes: 15 additions & 2 deletions src/__tests__/components/Interlinearizer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ jest.mock('../../components/modals/UnlinkPhraseConfirm', () => ({
}));

/** Pre-built Book with no segments. */
const GEN_EMPTY_BOOK: Book = { id: 'GEN', bookRef: 'GEN', textVersion: 'v1', segments: [] };
const GEN_EMPTY_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
segments: [],
duplicateVerseIds: [],
};

/**
* Builds a GEN book with `count` single-token verses in chapter 1. Used to exercise the segment
Expand All @@ -254,14 +260,15 @@ function makeLargeBook(count: number): Book {
verseStarts: [{ charStart: 0, number: String(v), chapter: 1 }],
});
}
return { id: 'GEN', bookRef: 'GEN', textVersion: 'v1', segments };
return { id: 'GEN', bookRef: 'GEN', textVersion: 'v1', segments, duplicateVerseIds: [] };
}

/** Book with two segments in GEN 1. */
const GEN_1_MULTI_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In the beginning.', [makeWordToken('GEN 1:1:0', 'In')]),
makeSegment('GEN 1:2', 'And the earth.', [makeWordToken('GEN 1:2:0', 'And')]),
Expand All @@ -277,6 +284,7 @@ const GEN_1_EMPTY_MIDDLE_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'Alpha.', [makeWordToken('GEN 1:1:0', 'Alpha')]),
makeSegment('GEN 1:2', '', []),
Expand All @@ -292,6 +300,7 @@ const GEN_TWO_CHAPTER_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [1, 2].flatMap((chapter) =>
[1, 2].map((verse) =>
makeSegment(`GEN ${chapter}:${verse}`, 'Word.', [
Expand All @@ -310,6 +319,7 @@ const GEN_SPLITTABLE_V1_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In beginning.', [
makeWordToken('GEN 1:1:0', 'In'),
Expand All @@ -335,6 +345,7 @@ const GEN_SUPERSCRIPTION_BOOK: Book = {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:0', 'A song.', [makeWordToken('GEN 1:0:0', 'A')]),
makeSegment('GEN 1:1', 'In the beginning.', [makeWordToken('GEN 1:1:0', 'In')]),
Expand Down Expand Up @@ -1702,6 +1713,7 @@ describe('focus preservation across segmentation edits', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'In beginning.', [
makeWordToken('GEN 1:1:0', 'In'),
Expand Down Expand Up @@ -1899,6 +1911,7 @@ const LUK_1_1_BOOK: Book = {
id: 'LUK',
bookRef: 'LUK',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('LUK 1:1', 'Since many', [
makeWordToken('LUK 1:1:0', 'Since'),
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/components/InterlinearizerLoader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ describe('InterlinearizerLoader', () => {
id: 'PSA',
bookRef: 'PSA',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [makeSegment('PSA 3:0', 'A Psalm by David.', [])],
};
mockBookData({ book: bookWithSuperscription });
Expand Down Expand Up @@ -628,6 +629,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 3:1', 'First verse.', []),
makeSegment('GEN 3:2', 'Last verse of the chapter.', []),
Expand Down Expand Up @@ -662,6 +664,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
{
id: 'GEN 4:20',
Expand Down Expand Up @@ -705,6 +708,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 3:1', 'First verse.', []),
makeSegment('GEN 3:3', 'Verse after the gap.', []),
Expand Down Expand Up @@ -737,6 +741,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
{
id: 'GEN 3:1',
Expand Down Expand Up @@ -2275,6 +2280,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'Alpha beta.', [
makeWordToken('GEN 1:1:0', 'Alpha'),
Expand Down Expand Up @@ -2420,6 +2426,7 @@ describe('InterlinearizerLoader', () => {
id: 'GEN',
bookRef: 'GEN',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
makeSegment('GEN 1:1', 'Alpha.', [makeWordToken('GEN 1:1:0', 'Alpha')]),
makeSegment('GEN 1:2', '“Gamma.', [
Expand Down Expand Up @@ -3330,6 +3337,7 @@ const LUK_1_1_BOOK: Book = {
id: 'LUK',
bookRef: 'LUK',
textVersion: 'v1',
duplicateVerseIds: [],
segments: [
{
id: 'LUK 1:1',
Expand Down
Loading
Loading