Skip to content

Commit 37f517a

Browse files
author
Erik Rasmussen
committed
Update test comments to reflect that bug is now fixed
1 parent b43e92a commit 37f517a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/useField.dynamic-name-869.test.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,16 @@ describe('useField - Dynamic Name (Issue #869)', () => {
4444
rerender(<TestComponent fieldName="b" />)
4545
})
4646

47-
// BUG: First render after name change has mismatched name/value
48-
// We get name='b' but value='value-a' (stale)
47+
// Verify all renders have name and value in sync
4948
const calls = renderSpy.mock.calls
5049

51-
// The bug manifests as: first call has name='b' but value='value-a'
52-
// Expected: ALL calls should have name and value in sync
50+
// All calls should have matching name/value pairs
5351
calls.forEach(call => {
5452
const [name, value] = call
5553
if (name === 'a') {
5654
expect(value).toBe('value-a')
5755
} else if (name === 'b') {
58-
expect(value).toBe('value-b') // This will FAIL on first render
56+
expect(value).toBe('value-b')
5957
}
6058
})
6159
})
@@ -91,8 +89,8 @@ describe('useField - Dynamic Name (Issue #869)', () => {
9189
rerender(<TestComponent fieldName="b" />)
9290
})
9391

94-
// IMMEDIATELY after rerender, name and value should be in sync
92+
// Immediately after rerender, name and value should be in sync
9593
expect(getByTestId('name')).toHaveTextContent('b')
96-
expect(getByTestId('value')).toHaveTextContent('value-b') // BUG: This will show 'value-a'
94+
expect(getByTestId('value')).toHaveTextContent('value-b')
9795
})
9896
})

0 commit comments

Comments
 (0)