Skip to content

Commit b9cebf8

Browse files
committed
Minor fixes from PR checks
1 parent 6ec151b commit b9cebf8

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

src/RealtimeServer/scriptureforge/services/sf-project-migrations.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,20 @@ describe('SFProjectMigrations', () => {
661661
expect(projectDoc.data.editingRequires).toBe(2);
662662
});
663663

664+
it('migrates editable to editingRequires when null', async () => {
665+
const env = new TestEnvironment(24);
666+
const conn = env.server.connect();
667+
await createDoc(conn, SF_PROJECTS_COLLECTION, 'project01', {});
668+
let projectDoc = await fetchDoc(conn, SF_PROJECTS_COLLECTION, 'project01');
669+
expect(projectDoc.data.editable).toBeUndefined();
670+
671+
await env.server.migrateIfNecessary();
672+
673+
projectDoc = await fetchDoc(conn, SF_PROJECTS_COLLECTION, 'project01');
674+
expect(projectDoc.data.editable).toBe(false);
675+
expect(projectDoc.data.editingRequires).toBe(3);
676+
});
677+
664678
it('does not remigrate editingRequires', async () => {
665679
const env = new TestEnvironment(24);
666680
const conn = env.server.connect();

src/SIL.XForge.Scripture/ClientApp/src/app/shared/test-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export function getPoetryVerseTextDoc(id: TextDocId, modelHasBlanks: boolean = f
145145
\p
146146
\v 3
147147
*/
148-
export function getEmptyChapterDoc(id: TextDocId, modelHasBlanks: boolean = false): TextData {
148+
export function getEmptyChapterDoc(id: TextDocId, modelHasBlanks: boolean): TextData {
149149
const delta = new Delta();
150150
if (modelHasBlanks) delta.insert({ blank: true }, { segment: 's_1' });
151151
delta.insert('\n', { para: { style: 's' } });
@@ -163,7 +163,7 @@ export function getEmptyChapterDoc(id: TextDocId, modelHasBlanks: boolean = fals
163163
if (modelHasBlanks) delta.insert({ blank: true }, { segment: 'p_2' });
164164
delta.insert({ verse: { number: '3', style: 'v' } });
165165
if (modelHasBlanks) delta.insert({ blank: true }, { segment: 'verse_1_3' });
166-
delta.insert('\n', { para: { style: 'p' } });
166+
delta.insert('\n\n', { para: { style: 'p' } });
167167
return delta;
168168
}
169169

src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/text-view-model.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -784,19 +784,17 @@ export class TextViewModel implements OnDestroy, LynxTextModelConverter {
784784
if ((op.insert as any)?.blank === false) {
785785
const position: number = curIndex + curSegment.length - 1;
786786
const id = `blank_${position}`;
787-
let embedPosition: EmbedPosition | undefined = id == null ? undefined : embeddedElements.get(id);
788-
if (embedPosition == null && id != null) {
787+
let embedPosition: EmbedPosition | undefined = embeddedElements.get(id);
788+
if (embedPosition == null) {
789789
embedPosition = { position };
790790
embeddedElements.set(id, embedPosition);
791791
} else {
792-
if (embedPosition != null) {
793-
if (embedPosition.duplicatePosition != null) {
794-
console.warn(
795-
'Warning: text-view-model.updateSegments() did not expect to encounter an embed with >2 positions'
796-
);
797-
}
798-
embedPosition.duplicatePosition = position;
792+
if (embedPosition.duplicatePosition != null) {
793+
console.warn(
794+
'Warning: text-view-model.updateSegments() did not expect to encounter an embed with >2 positions'
795+
);
799796
}
797+
embedPosition.duplicatePosition = position;
800798
}
801799
}
802800

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,8 +2086,8 @@ describe('EditorComponent', () => {
20862086
// Editor position immediately following the end of the anchoring. Note that both the thread1 and thread6 note
20872087
// icon embeds need to be accounted for.
20882088
const immediatelyAfter: number = thread1Position + embedLength * 2 + thread1Doc.data!.position.length;
2089-
// Test insert at index one character outside the text anchor. So not immediately after the anchoring, but another
2090-
// character past that.
2089+
// Test insert at index one character outside the text anchor. So not immediately after the anchoring,
2090+
// but another character past that.
20912091
env.targetEditor.setSelection(immediatelyAfter + 1, 0, 'user');
20922092
env.typeCharacters('a');
20932093
expect(thread1Doc.data!.position).toEqual({ start: 8, length: 9 });

0 commit comments

Comments
 (0)