docbrown/app/javascript/chat/__tests__/reportAbuse.test.jsx
Nick Taylor 86eb75cee7
Report a Message in Connect (#12229)
* Frontend Ready for Connect Report Abuse

* add feedback api

* js defination fix

* Added Hooks to the Component

* add json response in feedback

* Block popup added

* fix render issue

* Made changes in internal view

* change error message

* Added few design changes =

* add test cases

* Update app/javascript/chat/actions/requestActions.js

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* add PR suggestions

* add backend test cases

* report abuse form close

* Update app/javascript/chat/actions/requestActions.js

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* Update app/javascript/chat/ReportAbuse/index.jsx

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* add test cases

* Update app/javascript/chat/ReportAbuse/index.jsx

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* Update app/javascript/chat/ReportAbuse/index.jsx

Co-authored-by: Marcy Sutton <holla@marcysutton.com>

* Update app/javascript/chat/ReportAbuse/index.jsx

Co-authored-by: Marcy Sutton <holla@marcysutton.com>

* group the fieldset

* fix report abuse api

* fix test case

* fix request test case

* fix typo

* cleaned up markup in report abuse component.

* Fixed spacing between abuse options.

* Fixed wording in report abuse confirmation.

* Removed unnecessary data-testid and aria-label attributes.

* Added some top margin to the report abuse form.

* Update app/javascript/chat/message.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added a legend to the the fieldset.

* Update app/javascript/chat/actions/requestActions.js

Co-authored-by: Michael Kohl <citizen428@dev.to>

Co-authored-by: Sarthak <7lovesharma7@gmail.com>
Co-authored-by: Narender Singh <narender2031@gmail.com>
Co-authored-by: Marcy Sutton <holla@marcysutton.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-01-19 12:07:47 -05:00

44 lines
1.2 KiB
JavaScript

import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import ReportAbuse from '../ReportAbuse';
describe('<ReportAbuse />', () => {
it('should have no a11y violations', async () => {
const { container } = render(
<ReportAbuse
data={{
message: 'HI',
user_id: 1,
}}
/>,
);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should render the component', () => {
const { getByText, getByLabelText } = render(
<ReportAbuse data={{ message: 'HI', user_id: 1 }} />,
);
expect(getByText('Report Abuse')).toBeDefined();
const vulgarInput = getByLabelText('Rude or vulgar');
expect(vulgarInput.value).toEqual('rude or vulgar');
const harassmentInput = getByLabelText('Harassment or hate speech');
expect(harassmentInput.value).toEqual('harassment');
const listingsInput = getByLabelText(
'Inappropriate listings message/category',
);
expect(listingsInput.value).toEqual('listings');
const spamInput = getByLabelText('Spam or copyright issue');
expect(spamInput.value).toEqual('spam');
expect(getByText('Report Message')).toBeDefined();
});
});