fix(list-box): preserve typed virtual keys and add HD-09 review repros
This commit is contained in:
@@ -274,3 +274,42 @@ describe("ListBox virtual row stream", () => {
|
||||
expect(option.getAttribute("aria-setsize")).toBe("40");
|
||||
});
|
||||
});
|
||||
|
||||
it("review: numeric and string keys preserve local row identity on reorder", async () => {
|
||||
const Stateful = defineComponent({
|
||||
props: {
|
||||
item: {
|
||||
type: Object as PropType<{ id: string | number }>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const born = `${typeof props.item.id}:${props.item.id}`;
|
||||
return () =>
|
||||
h(
|
||||
ListBoxItem,
|
||||
{ id: props.item.id },
|
||||
() => `${typeof props.item.id}:${props.item.id}/${born}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
const items = [{ id: 0 }, { id: "0" }];
|
||||
const w = mount(ListBox, {
|
||||
props: { items, virtualized: true, rowHeight: 50 },
|
||||
slots: {
|
||||
default: ({ item }: { item: { id: string | number } }) =>
|
||||
h(Stateful, { item }),
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
wrappers.push(w);
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
await w.setProps({ items: [...items].reverse() });
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
expect(w.findAll('[role="option"]').map((x) => x.text())).toEqual([
|
||||
"string:0/string:0",
|
||||
"number:0/number:0",
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user