Skip to content

Commit 004715b

Browse files
committed
fix: unit testcases for input
1 parent 5407efb commit 004715b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/hooks/useThemeProps/usePropsResolution.test.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ describe('props resolution', () => {
513513
const { getByTestId } = render(
514514
<Provider>
515515
<Input
516-
testID="test"
516+
_stack={{ testID: 'StackTest' }}
517+
_input={{ testID: 'test' }}
517518
w="100%"
518519
mx={3}
519520
placeholder="Default Input"
@@ -522,14 +523,15 @@ describe('props resolution', () => {
522523
</Provider>
523524
);
524525
const inputElement = getByTestId('test');
525-
expect(inputElement.props.style[0].width).toBe('100%');
526+
const inputElementStack = getByTestId('StackTest');
527+
expect(inputElement.props.style.width).toBe('100%');
526528
expect(inputElement.props.placeholderTextColor).toBe(
527529
defaultTheme.colors.blueGray['400']
528530
);
529-
expect(inputElement.props.style[0].marginLeft).toBe(
531+
expect(inputElementStack.props.style.marginLeft).toBe(
530532
defaultTheme.space['3']
531533
);
532-
expect(inputElement.props.style[0].marginRight).toBe(
534+
expect(inputElementStack.props.style.marginRight).toBe(
533535
defaultTheme.space['3']
534536
);
535537
});
@@ -541,7 +543,7 @@ describe('props resolution', () => {
541543
const { getByTestId } = render(
542544
<Provider theme={newTheme}>
543545
<Input
544-
testID="test"
546+
_input={{ testID: 'test' }}
545547
_light={{
546548
placeholderTextColor: 'blueGray.400',
547549
}}
@@ -564,7 +566,7 @@ describe('props resolution', () => {
564566
const { getByTestId } = render(
565567
<Provider theme={newTheme}>
566568
<Input
567-
testID="test"
569+
_input={{ testID: 'test' }}
568570
size="sm"
569571
variant="outline"
570572
_dark={{
@@ -574,19 +576,17 @@ describe('props resolution', () => {
574576
</Provider>
575577
);
576578
const inputElement = getByTestId('test');
577-
expect(inputElement.props.style[0].fontSize).toBe(
578-
defaultTheme.fontSizes.sm
579-
);
579+
expect(inputElement.props.style.fontSize).toBe(defaultTheme.fontSizes.sm);
580580
});
581581

582582
it('Input: variant', () => {
583583
const { getByTestId } = render(
584584
<Provider>
585-
<Input testID="test" variant="underlined" />
585+
<Input _stack={{ testID: 'test' }} variant="underlined" />
586586
</Provider>
587587
);
588588
const inputElement = getByTestId('test');
589-
expect(inputElement.props.style[0].borderBottomWidth).toBe(1);
589+
expect(inputElement.props.style.borderBottomWidth).toBe(1);
590590
});
591591

592592
// it('Input: inputElements', () => {
@@ -614,19 +614,19 @@ describe('props resolution', () => {
614614
const { getByTestId } = render(
615615
<Provider theme={newTheme}>
616616
<Input
617-
testID="test"
617+
_stack={{ testID: 'stackTest' }}
618+
_input={{ testID: 'test' }}
618619
_ios={{ _dark: { variant: 'underlined', size: 'sm' } }}
619620
variant="outline"
620621
size="lg"
621622
/>
622623
</Provider>
623624
);
624625
const inputElement = getByTestId('test');
625-
expect(inputElement.props.style[0].borderBottomWidth).toBe(1);
626+
const inputElementStack = getByTestId('stackTest');
627+
expect(inputElementStack.props.style.borderBottomWidth).toBe(1);
626628
// as input of 'sm' size is mapped to 'xs' fontsize
627-
expect(inputElement.props.style[0].fontSize).toBe(
628-
defaultTheme.fontSizes.xs
629-
);
629+
expect(inputElement.props.style.fontSize).toBe(defaultTheme.fontSizes.xs);
630630
});
631631

632632
// it('Input: inputElemets', () => {
@@ -651,7 +651,7 @@ describe('props resolution', () => {
651651
const { getByTestId } = render(
652652
<Provider>
653653
<Input
654-
testID="test"
654+
_input={{ testID: 'test' }}
655655
type="password"
656656
isDisabled={true}
657657
isRequired={true}

0 commit comments

Comments
 (0)