Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHP-3132-Render-Reported-Stories-and-Comments #1443

Merged
merged 12 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading