Skip to content

Commit 01709e3

Browse files
authored
removed getProps from FloatingButton tests (#2997)
* removed getProps from FloatingButton tests * removed ? from props
1 parent 575326e commit 01709e3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/floatingButton/__tests__/index.spec.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const TestCase = (props) => {
1919
};
2020
export const FloatingButtonDriver = (props: ComponentProps) => {
2121
const driver = useComponentDriver(props);
22-
const getStyle = () => driver.getProps().style as ViewStyle;
22+
const getStyle = () => driver.getElement().props.style as ViewStyle;
2323
return {...driver, getStyle};
2424
};
2525

@@ -72,7 +72,7 @@ describe('FloatingButton', () => {
7272
const renderTree = render(<TestCase {...props}/>);
7373
const buttonDriver = ButtonDriver({renderTree, testID: `${TEST_ID}.button`});
7474

75-
expect(buttonDriver.getProps()?.style?.marginBottom).toBe(Spacings.s8);
75+
expect(buttonDriver.getElement().props.style?.marginBottom).toBe(Spacings.s8);
7676
});
7777

7878
it('should have default bottom margin for both buttons', () => {
@@ -81,16 +81,16 @@ describe('FloatingButton', () => {
8181
const buttonDriver = ButtonDriver({renderTree, testID: `${TEST_ID}.button`});
8282
const buttonDriver2 = ButtonDriver({renderTree, testID: `${TEST_ID}.secondaryButton`});
8383

84-
expect(buttonDriver.getProps()?.style?.marginBottom).toBe(Spacings.s4);
85-
expect(buttonDriver2.getProps()?.style?.marginBottom).toBe(Spacings.s7);
84+
expect(buttonDriver.getElement().props.style?.marginBottom).toBe(Spacings.s4);
85+
expect(buttonDriver2.getElement().props.style?.marginBottom).toBe(Spacings.s7);
8686
});
8787

8888
it('should have bottom margin that match bottomMargin prop', () => {
8989
const props = {visible: true, bottomMargin: 10};
9090
const renderTree = render(<TestCase {...props}/>);
9191
const buttonDriver = ButtonDriver({renderTree, testID: `${TEST_ID}.button`});
9292

93-
expect(buttonDriver.getProps()?.style?.marginBottom).toBe(10);
93+
expect(buttonDriver.getElement().props.style?.marginBottom).toBe(10);
9494
});
9595

9696
it('should have bottom margin for secondary button that match bottomMarginProp', () => {
@@ -99,8 +99,8 @@ describe('FloatingButton', () => {
9999
const buttonDriver = ButtonDriver({renderTree, testID: `${TEST_ID}.button`});
100100
const buttonDriver2 = ButtonDriver({renderTree, testID: `${TEST_ID}.secondaryButton`});
101101

102-
expect(buttonDriver.getProps()?.style?.marginBottom).toBe(Spacings.s4);
103-
expect(buttonDriver2.getProps()?.style?.marginBottom).toBe(10);
102+
expect(buttonDriver.getElement().props.style?.marginBottom).toBe(Spacings.s4);
103+
expect(buttonDriver2.getElement().props.style?.marginBottom).toBe(10);
104104
});
105105
});
106106

0 commit comments

Comments
 (0)