Skip to content

Commit 26432f3

Browse files
committed
Add failing test for late-arriving options
This specifically tests when the options change to include the value. This is a bug.
1 parent ce6d26b commit 26432f3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/Select-test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,25 @@ describe('Select', function() {
349349
expect(React.findDOMNode(instance), 'queried for', DISPLAYED_SELECTION_SELECTOR,
350350
'to have items satisfying', 'to have text', 'something new');
351351
});
352+
353+
it('updates the display text if the option appears later', function () {
354+
355+
wrapper.setPropsForChild({
356+
value: 'new'
357+
});
358+
359+
wrapper.setPropsForChild({
360+
options: [
361+
{ value: 'one', label: 'One' },
362+
{ value: 'two', labal: 'Two' },
363+
{ value: 'new', label: 'New item in the options' },
364+
{ value: 'three', label: 'Three' }
365+
]
366+
});
367+
368+
expect(React.findDOMNode(instance), 'queried for', DISPLAYED_SELECTION_SELECTOR,
369+
'to have items satisfying', 'to have text', 'New item in the options');
370+
371+
});
352372
});
353373
});

0 commit comments

Comments
 (0)