This commit is contained in:
Thomas G. Lopes 2025-06-18 15:40:56 +01:00
parent 5c9ad4a4f8
commit d82ac749e1
3 changed files with 10 additions and 10 deletions

View file

@ -612,9 +612,9 @@ describe('getNextMatrixItem', () => {
[{ id: 1, available: true }], // Start at (0,0)
[{ id: 2, available: false }],
[
{ id: 3, available: true }, // col 0 - available (left of start)
{ id: 4, available: false }, // col 1 - unavailable (would be start col after clamp)
{ id: 5, available: true }, // col 2 - available (right of start)
{ id: 3, available: true }, // col 0 - available (left of start)
{ id: 4, available: false }, // col 1 - unavailable (would be start col after clamp)
{ id: 5, available: true }, // col 2 - available (right of start)
],
];
@ -633,11 +633,11 @@ describe('getNextMatrixItem', () => {
it('should find item to the right when left scan fails for vertical movement', () => {
// Test finding item to the right when left scan fails
const customMatrix = [
[{ id: 1, available: true }], // Start at (0,0)
[{ id: 1, available: true }], // Start at (0,0)
[{ id: 2, available: false }],
[
{ id: 3, available: false }, // col 0 - unavailable (start col after clamp)
{ id: 4, available: true }, // col 1 - available (right of start)
{ id: 3, available: false }, // col 0 - unavailable (start col after clamp)
{ id: 4, available: true }, // col 1 - available (right of start)
],
];

View file

@ -224,8 +224,8 @@ export function getNextMatrixItem<T>(options: GetNextMatrixItemOptions<T>): T |
const nextRowArray = matrix[nextRow];
if (nextRowArray && Array.isArray(nextRowArray) && nextRowArray.length > 0) {
// Check if there's at least one available item in this row
const hasAvailableItem = nextRowArray.some(item =>
item !== undefined && item !== null && isAvailable(item)
const hasAvailableItem = nextRowArray.some(
(item) => item !== undefined && item !== null && isAvailable(item)
);
if (hasAvailableItem) {
break; // Found a row with at least one available item
@ -297,7 +297,7 @@ export function getNextMatrixItem<T>(options: GetNextMatrixItemOptions<T>): T |
}
candidateCol--; // Move left to find an available item
}
// If not found scanning left, try scanning right from the original position
candidateCol = nextCol + 1;
while (candidateCol < nextRowArray.length) {

View file

@ -22,4 +22,4 @@ function sanitizeHtml(html: string) {
return DOMPurify.sanitize(html);
}
export { md, sanitizeHtml }
export { md, sanitizeHtml };