Skip to content

Commit

Permalink
Merge pull request #1443 from CruGlobal/MHP-3132
Browse files Browse the repository at this point in the history
MHP-3132-Render-Reported-Stories-and-Comments
  • Loading branch information
TheNoodleMoose authored Feb 5, 2020
2 parents 8c39933 + 8bfd322 commit e351697
Show file tree
Hide file tree
Showing 29 changed files with 7,902 additions and 1,365 deletions.
6 changes: 0 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
"skipComments": true
}
],
"complexity": [
2,
{
"max": 10
}
],
"no-return-await": 2,
"quotes": [
2,
Expand Down
4 changes: 2 additions & 2 deletions WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Components to convert to TS+Hooks
- ReminderButton
- ReminderDateText
- ReminderRepeatButtons
- ReportCommentHeaderCard
- ReportCommentLabel
- ReportItemHeaderCard
- ReportItemLabel
- ShareSurveyMenu
- SideMenu
- StepDetailScreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { fireEvent } from 'react-native-testing-library';

import { renderWithContext } from '../../../../testUtils';

import ReportCommentHeaderCard from '..';
import ReportItemHeaderCard from '..';

const props = { count: 12, onPress: jest.fn() };
it('renders correctly', () => {
renderWithContext(<ReportCommentHeaderCard {...props} />, {
renderWithContext(<ReportItemHeaderCard {...props} />, {
noWrappers: true,
}).snapshot();
});

describe('press event', () => {
it('calls onPress', () => {
const { getByTestId } = renderWithContext(
<ReportCommentHeaderCard {...props} />,
<ReportItemHeaderCard {...props} />,
{ noWrappers: true },
);
fireEvent.press(getByTestId('ReportCommentHeaderCardButton'));
fireEvent.press(getByTestId('ReportItemHeaderCardButton'));

expect(props.onPress).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports[`renders correctly 1`] = `
"shadowRadius": 2,
}
}
testID="ReportCommentHeaderCardButton"
testID="ReportItemHeaderCardButton"
>
<Text
allowFontScaling={false}
Expand Down Expand Up @@ -81,7 +81,7 @@ exports[`renders correctly 1`] = `
]
}
>
12 new reported comments
12 New Reported Items
</Text>
</View>
`;
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React from 'react';
import { useTranslation } from 'react-i18next';

import { Text, Card, Icon } from '../../components/common';
import { Text, Card, Icon } from '../common';

import styles from './styles';

interface ReportCommentHeaderCardProps {
interface ReportItemHeaderCardProps {
testID?: string;
count: number;
onPress: () => void;
}

export default function ReportCommentHeaderCard({
export default function ReportItemHeaderCard({
count,
onPress,
}: ReportCommentHeaderCardProps) {
}: ReportItemHeaderCardProps) {
const { t } = useTranslation();
return (
<Card
testID="ReportCommentHeaderCardButton"
testID="ReportItemHeaderCardButton"
onPress={onPress}
style={styles.card}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from 'react';

import { renderWithContext } from '../../../../testUtils';

import ReportCommentLabel from '..';
import ReportItemLabel from '..';

it('render label', () => {
renderWithContext(<ReportCommentLabel label="Label" user="Test User" />, {
renderWithContext(<ReportItemLabel label="Label" user="Test User" />, {
noWrappers: true,
}).snapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import { Flex, Text } from '../common';

import styles from './styles';

interface ReportCommentLabelProps {
interface ReportItemLabelProps {
label: string;
user: string;
}

export default function ReportCommentLabel({
label,
user,
}: ReportCommentLabelProps) {
export default function ReportItemLabel({ label, user }: ReportItemLabelProps) {
return (
<Flex value={1}>
<Text style={styles.label}>{label}:</Text>
Expand Down
File renamed without changes.
Loading

0 comments on commit e351697

Please sign in to comment.