Skip to content

Commit

Permalink
Add Unit Tests for OrganizationAgendaCategory Component and Search Fu…
Browse files Browse the repository at this point in the history
…nctionality for Agenda Item Categories (#3083)

* code refactor

* Implemented search functionality

* added new test cases for search functionality

* Fix test

* improve code coverage

* mirgated OrganizationAgendaCategory to stylesheet

* moved other components of AgendaCategory to common stylesheet

---------

Co-authored-by: im-vedant <[email protected]>
  • Loading branch information
im-vedant and im-vedant authored Dec 30, 2024
1 parent 6ff0594 commit 73cad1b
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 277 deletions.
10 changes: 8 additions & 2 deletions src/GraphQl/Queries/AgendaCategoryQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ import gql from 'graphql-tag';
*/

export const AGENDA_ITEM_CATEGORY_LIST = gql`
query AgendaItemCategoriesByOrganization($organizationId: ID!) {
agendaItemCategoriesByOrganization(organizationId: $organizationId) {
query AgendaItemCategoriesByOrganization(
$organizationId: ID!
$where: AgendaItemCategoryWhereInput
) {
agendaItemCategoriesByOrganization(
organizationId: $organizationId
where: $where
) {
_id
name
description
Expand Down
6 changes: 3 additions & 3 deletions src/components/AgendaCategory/AgendaCategoryContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ function agendaCategoryContainer({
<div className="ms-3">{t('name')}</div>
</Col>
<Col
className="align-self-center fw-bold d-none d-md-block"
className={` align-self-center fw-bold d-none d-md-block`}
md={6}
lg={2}
lg={6}
>
{t('description')}
</Col>
Expand Down Expand Up @@ -242,7 +242,7 @@ function agendaCategoryContainer({
</Col>
<Col
md={6}
lg={2}
lg={6}
className="p-1 d-none d-md-block align-self-center text-body-secondary"
>
{agendaCategory.description}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { Modal, Form, Button } from 'react-bootstrap';
import type { ChangeEvent } from 'react';
import styles from './OrganizationAgendaCategory.module.css';

import styles from 'style/app.module.css';
/**
* InterfaceFormStateType is an object containing the form state
*/
Expand Down Expand Up @@ -48,12 +47,14 @@ const AgendaCategoryCreateModal: React.FC<
}) => {
return (
<Modal
className={styles.AgendaCategoryModal}
className={`mt-5 ${styles.campaignModal}`}
show={agendaCategoryCreateModalIsOpen}
onHide={hideCreateModal}
>
<Modal.Header>
<p className={styles.titlemodal}>{t('agendaCategoryDetails')}</p>
<p className={styles.titlemodalOrganizationEvents}>
{t('agendaCategoryDetails')}
</p>
<Button
variant="danger"
onClick={hideCreateModal}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Modal, Button } from 'react-bootstrap';
import styles from './OrganizationAgendaCategory.module.css';
import styles from 'style/app.module.css';

/**
* InterfaceAgendaCategoryDeleteModalProps is an object containing the props for AgendaCategoryDeleteModal component
Expand Down Expand Up @@ -35,7 +35,7 @@ const AgendaCategoryDeleteModal: React.FC<
<Modal
size="sm"
id={`deleteAgendaCategoryModal`}
className={styles.agendaCategoryModal}
className={styles.campaignModal}
show={agendaCategoryDeleteModalIsOpen}
onHide={toggleDeleteModal}
backdrop="static"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Modal, Form, Button } from 'react-bootstrap';

import styles from './OrganizationAgendaCategory.module.css';
import styles from 'style/app.module.css';

/**
* InterfaceFormStateType is an object containing the form state
Expand Down Expand Up @@ -47,12 +47,14 @@ const AgendaCategoryPreviewModal: React.FC<
}) => {
return (
<Modal
className={styles.AgendaCategoryModal}
className={styles.campaignModal}
show={agendaCategoryPreviewModalIsOpen}
onHide={hidePreviewModal}
>
<Modal.Header>
<p className={styles.titlemodal}>{t('agendaCategoryDetails')}</p>
<p className={styles.titlemodalOrganizationEvents}>
{t('agendaCategoryDetails')}
</p>
<Button
onClick={hidePreviewModal}
data-testid="previewAgendaCategoryModalCloseBtn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Modal, Form, Button } from 'react-bootstrap';
import type { ChangeEvent } from 'react';

import styles from './OrganizationAgendaCategory.module.css';
import styles from 'style/app.module.css';

/**
* InterfaceFormStateType is an object containing the form state
Expand Down Expand Up @@ -49,12 +49,14 @@ const AgendaCategoryUpdateModal: React.FC<
}) => {
return (
<Modal
className={styles.AgendaCategoryModal}
className={styles.campaignModal}
show={agendaCategoryUpdateModalIsOpen}
onHide={hideUpdateModal}
>
<Modal.Header>
<p className={styles.titlemodal}>{t('updateAgendaCategory')}</p>
<p className={styles.titlemodalOrganizationEvents}>
{t('updateAgendaCategory')}
</p>
<Button
onClick={hideUpdateModal}
data-testid="updateAgendaCategoryModalCloseBtn"
Expand Down

This file was deleted.

Loading

0 comments on commit 73cad1b

Please sign in to comment.