fix(snapshot): print the value of labeled non-editable nodes
Fixes #5418
Summary
displayLabel prints a node's label and drops its value unless the role is text-field, text-view or search. For adjustable controls, such as Flutter sliders and picker wheels exposed as Other, the value holds the state, so snapshot never shows it. Settle diffs and diff snapshot key on the same label, so moving a slider diffs as +0 -0.
A labeled, non-editable node now gets a [value:"…"] marker when its value differs from its label. The marker uses the same escaping and 48-character preview as [preview:…]. The diff key reuses the marker, so a value-only change shows as a removed/added pair. Editable and unlabeled nodes are unchanged because they already print the value as their text. get text still returns the label; that is left out of scope.
Before / after
Node { type: 'Other', label: 'Brightness', value: '60%' }, then value: '96%':
snapshot before: @e3 [other] "Brightness"
after: @e3 [other] "Brightness" [value:"60%"]
diff 60% -> 96% before: +0 -0
after: +1 -1 (- … [value:"60%"] + … [value:"96%"])
Validation
- Tested at
7e499c3. Newsnapshot-lines-value.test.tscovers the marker in both render modes, the cases where no marker should appear (no value, value equal to label, unlabeled, editable), and value-only diffs. Onmain, 3 of its 8 tests fail. With the fix, all 8 pass. vitest run packages/capture-kit/src/snapshot packages/command-output/src/output/snapshot.test.tspasses (558 tests). oxlint, oxfmt andtsc --noEmitare clean.- No device run. The change only affects how snapshot text is rendered and how the diff key is built.
This change was prepared with AI assistance.
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.