Skip to content

Commit 7360136

Browse files
committed
fix: narrow iOS implementation cell labels
1 parent 18ec27e commit 7360136

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎src/daemon/snapshot-presentation/ios/rows.fixtures.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const legitimatelyLabeledCellNodes: RawSnapshotNode[] = [
4444
depth: 1,
4545
parentIndex: 0,
4646
type: 'Cell',
47-
label: 'Stem Cell',
47+
label: 'StemCell',
4848
rect: roomRowRect,
4949
},
5050
{ index: 2, depth: 2, parentIndex: 1, type: 'StaticText', label: 'Research details' },

‎src/daemon/snapshot-presentation/ios/rows.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ test('iOS row presentation associates generic room cells with their descendant t
1313
expect(nodes.filter((node) => node.label === 'Team Standup')).toHaveLength(1);
1414
});
1515

16-
test('iOS row presentation preserves a legitimate cell label', () => {
16+
test('iOS row presentation preserves a legitimate no-space cell label', () => {
1717
const nodes = presentIosInteractiveSnapshot(legitimatelyLabeledCellNodes);
1818

19-
expect(nodes.find((node) => node.type === 'Cell')?.label).toBe('Stem Cell');
19+
expect(nodes.find((node) => node.type === 'Cell')?.label).toBe('StemCell');
2020
});

‎src/daemon/snapshot-presentation/ios/rows.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function resolveIosRowLabel(
3333
const rowLabel = row.label?.trim();
3434
if (
3535
normalizeType(row.type ?? '') !== 'cell' ||
36-
(rowLabel && !isImplementationCellLabel(rowLabel) && !isSystemScrollIndicatorLabel(rowLabel))
36+
(rowLabel &&
37+
!isImplementationCellLabel(rowLabel, row.identifier) &&
38+
!isSystemScrollIndicatorLabel(rowLabel))
3739
) {
3840
return rowLabel;
3941
}
@@ -48,8 +50,8 @@ function resolveIosRowLabel(
4850
return title;
4951
}
5052

51-
function isImplementationCellLabel(label: string): boolean {
52-
return label !== 'Cell' && /^[A-Z_$][A-Za-z0-9_$]*Cell$/.test(label);
53+
function isImplementationCellLabel(label: string, identifier: string | undefined): boolean {
54+
return identifier?.trim() === label && /^[A-Z_$][A-Za-z0-9_$]*Cell$/.test(label);
5355
}
5456

5557
function isIosRowTitleCandidate(node: RawSnapshotNode): boolean {

0 commit comments

Comments
 (0)