Skip to content

Commit 75deef0

Browse files
committed
feat: Update getThatMark function
1 parent 2f99803 commit 75deef0

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

packages/test-case-component/src/helpers.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,31 @@ function getSlections(
229229
}
230230

231231
function getThatMarks({ thatMark }: { thatMark: TargetPlainObject[] }): DecorationItem[] {
232-
console.log("☝️", thatMark)
233232
const decorations: DecorationItem[] = [];
234-
if (thatMark === undefined) {
235-
console.warn("thatMarks are undefined. Skipping decoration generation.");
233+
234+
if (thatMark === undefined || thatMark.length === 0) {
235+
console.warn("finalStateSourceMarks are undefined. Skipping decoration generation.");
236+
return []
237+
} else {
238+
addContentRangeDecorations({
239+
marks: thatMark,
240+
highlightClass: "thatMark", decorations
241+
});
242+
}
243+
244+
return decorations
245+
}
246+
247+
function getSourceMarks({ sourceMark }: { sourceMark?: TargetPlainObject[] }): DecorationItem[] {
248+
const decorations: DecorationItem[] = [];
249+
if (sourceMark === undefined || sourceMark.length === 0) {
250+
console.warn("finalStateSourceMarks are undefined. Skipping decoration generation.");
236251
return []
252+
} else {
253+
addContentRangeDecorations({
254+
marks: sourceMark,
255+
highlightClass: "sourceMark", decorations
256+
});
237257
}
238258

239259
return decorations

0 commit comments

Comments
 (0)