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

done #55

Merged
merged 3 commits into from
Nov 6, 2023
Merged

done #55

Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions client/src/components/pages/RoleListingManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ describe('Role Listings component tests', () => {
userEvent.click(screen.getAllByText('Open')[0])
expect(screen.getByLabelText('Open')).toBeChecked()
});

it ("able to click create button and redirect to create page", async () => {
waitFor(() => {
const createButtonElement = screen.getByTestId('createButton');
expect(createButtonElement).toBeInTheDocument();

userEvent.click(createButtonElement)
expect( window.location.pathname).toBe('/listingManage/create');
});
});

it ("able to click edit icon and redirect to update page", async () => {
waitFor(() => {
Expand Down
11 changes: 9 additions & 2 deletions client/src/components/pages/RoleListingManager.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from "react";
import {Col, Row, Select, SelectProps, Empty, List, Radio, RadioChangeEvent, Skeleton, Space, Tag, Tooltip} from "antd";
import {Col, Row, Select, SelectProps, Empty, List, Radio, RadioChangeEvent, Skeleton, Space, Tag, Tooltip, Button} from "antd";
import {Container} from "react-bootstrap";
import {connect, useDispatch} from "react-redux";
import PropTypes from "prop-types";
Expand All @@ -14,6 +14,7 @@ import {
BankOutlined,
SearchOutlined,
UserOutlined,
PlusOutlined,
} from '@ant-design/icons';
import {getStaffListings} from "../../actions/staffListings";
import {useNavigate} from "react-router-dom";
Expand Down Expand Up @@ -99,7 +100,7 @@ const RoleListingManager = ({
<Space direction="vertical" size={40} style={{width: "100%"}}>
<div></div>
<Row gutter={rowGutterStyle} justify='center'>
<Col span={22}>
<Col xs={22} sm={22} md={22} lg={22} xl={17} xxl={18}>
<Select
mode="multiple"
showSearch
Expand All @@ -114,6 +115,12 @@ const RoleListingManager = ({
allowClear
/>
</Col>
<Col xs={22} sm={22} md={22} lg={22} xl={0} xxl={0} style={{margin: 8}}></Col>
<Col xs={22} sm={22} md={22} lg={22} xl={5} xxl={4}>
<Link to="/listingManage/create" style={{textDecoration: "none"}} data-testid="createButton">
<Button type="default" size="large" style={{width: "100%"}}><PlusOutlined />Create New Listing</Button>
</Link>
</Col>
</Row>
<Row gutter={rowGutterStyle} justify='center'>
<Col span={22}>
Expand Down