fix tests some moar

pull/21833/head
Michael Telatynski 2020-01-22 11:05:25 +00:00
parent 176605c302
commit fc724cfe70
1 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ const button4 = <Button key={4}>d</Button>;
describe("RovingTabIndex", () => { describe("RovingTabIndex", () => {
it("RovingTabIndexProvider renders children as expected", () => { it("RovingTabIndexProvider renders children as expected", () => {
const wrapper = mount(<RovingTabIndexProvider> const wrapper = mount(<RovingTabIndexProvider>
{() => <div><span>Test</span></div> } {() => <div><span>Test</span></div>}
</RovingTabIndexProvider>); </RovingTabIndexProvider>);
expect(wrapper.text()).toBe("Test"); expect(wrapper.text()).toBe("Test");
expect(wrapper.html()).toBe('<div><span>Test</span></div>'); expect(wrapper.html()).toBe('<div><span>Test</span></div>');
@ -82,14 +82,14 @@ describe("RovingTabIndex", () => {
// update the children, it should remain on the same button // update the children, it should remain on the same button
wrapper.setProps({ wrapper.setProps({
children: [button1, button4, button2, button3], children: () => [button1, button4, button2, button3],
}); });
wrapper.update(); wrapper.update();
checkTabIndexes(wrapper.find("button"), [-1, -1, 0, -1]); checkTabIndexes(wrapper.find("button"), [-1, -1, 0, -1]);
// update the children, remove the active button, it should move to the next one // update the children, remove the active button, it should move to the next one
wrapper.setProps({ wrapper.setProps({
children: [button1, button4, button3], children: () => [button1, button4, button3],
}); });
wrapper.update(); wrapper.update();
checkTabIndexes(wrapper.find("button"), [-1, -1, 0]); checkTabIndexes(wrapper.find("button"), [-1, -1, 0]);