Skip to content

Commit

Permalink
Merge pull request #11 from pesto-students/feature/sprintsUi
Browse files Browse the repository at this point in the history
Added test cases
  • Loading branch information
i-am-jyotirmaya authored Oct 10, 2021
2 parents 23b2f3c + 9f249e8 commit 8326ba7
Show file tree
Hide file tree
Showing 19 changed files with 258 additions and 19 deletions.
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.0",
"prettier": "^2.4.1"
"prettier": "^2.4.1",
"react-test-renderer": "^17.0.2"
}
}
27 changes: 27 additions & 0 deletions src/components/Auth/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function LoginView(props) {
if (!validateEmail(values.email)) return Notification("Validation Failed", "invalid email");
dispatch(ForgotPassword(values.email));
};
const loginFix = (isScrumMaster) => {
// if (!validateEmail(email)) return openAuthNotification("Validation Failed", "invalid email");
if (isScrumMaster) dispatch(LoginUser("[email protected]", "P@ssword1"));
else dispatch(LoginUser("[email protected]", "CRIMINALcase1"));
};
return (
<>
<div align="middle">
Expand Down Expand Up @@ -65,6 +70,28 @@ function LoginView(props) {
Log in
</AppButton>
</Form.Item>
<Form.Item>
<FullLengthButton
type="primary"
size="large"
disabled={loading}
htmlType="submit"
onClick={() => loginFix(true)}
>
Log in as ScrumMaster *
</FullLengthButton>
</Form.Item>
<Form.Item>
<FullLengthButton
type="primary"
size="large"
disabled={loading}
htmlType="submit"
onClick={() => loginFix(false)}
>
Log in as Developer *
</FullLengthButton>
</Form.Item>
<Form.Item>
<Text type="secondary">
forgot password?
Expand Down
7 changes: 7 additions & 0 deletions src/components/Common/ActiveMark/ActiveMark.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import renderer from "react-test-renderer";
import ActiveMark from "src/components/Common/ActiveMark/ActiveMark";
it("ActiveMark renders correctly", () => {
const tree = renderer.create(<ActiveMark />).toJSON();
expect(tree).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActiveMark renders correctly 1`] = `<div />`;
7 changes: 7 additions & 0 deletions src/components/Common/AppButton/AppButton.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import renderer from "react-test-renderer";
import AppButton from "src/components/Common/AppButton/AppButton";
it("ActiveMark renders correctly", () => {
const tree = renderer.create(<AppButton>Button</AppButton>).toJSON();
expect(tree).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActiveMark renders correctly 1`] = `
<button
className="ant-btn ant-btn-primary"
onClick={[Function]}
type="button"
>
<span>
Button
</span>
</button>
`;
7 changes: 7 additions & 0 deletions src/components/Common/AppDropDown/AppDropDown.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import renderer from "react-test-renderer";
import AppDropDown from "src/components/Common/AppDropDown/AppDropDown";
it("ActiveMark renders correctly", () => {
const tree = renderer.create(<AppDropDown />).toJSON();
expect(tree).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActiveMark renders correctly 1`] = `
<div
className="ant-select ant-select-lg ant-select-single ant-select-show-arrow"
onBlur={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
>
<div
className="ant-select-selector"
onClick={[Function]}
onMouseDown={[Function]}
>
<span
className="ant-select-selection-search"
>
<input
aria-activedescendant="undefined_list_0"
aria-autocomplete="list"
aria-controls="undefined_list"
aria-haspopup="listbox"
aria-owns="undefined_list"
autoComplete="off"
className="ant-select-selection-search-input"
onChange={[Function]}
onCompositionEnd={[Function]}
onCompositionStart={[Function]}
onKeyDown={[Function]}
onMouseDown={[Function]}
onPaste={[Function]}
readOnly={true}
role="combobox"
style={
Object {
"opacity": 0,
}
}
type="search"
unselectable="on"
value=""
/>
</span>
<span
className="ant-select-selection-placeholder"
/>
</div>
<span
aria-hidden={true}
className="ant-select-arrow"
onMouseDown={[Function]}
style={
Object {
"WebkitUserSelect": "none",
"userSelect": "none",
}
}
unselectable="on"
>
<span
aria-label="down"
className="anticon anticon-down ant-select-suffix"
role="img"
>
<svg
aria-hidden="true"
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</span>
</span>
</div>
`;
7 changes: 7 additions & 0 deletions src/components/Common/AppInput/AppInput.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import renderer from "react-test-renderer";
import AppInput from "src/components/Common/AppInput/AppInput";
it("ActiveMark renders correctly", () => {
const tree = renderer.create(<AppInput />).toJSON();
expect(tree).toMatchSnapshot();
});
13 changes: 13 additions & 0 deletions src/components/Common/AppInput/__snapshots__/AppInput.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActiveMark renders correctly 1`] = `
<input
className="ant-input ant-input-lg"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
type="text"
value=""
/>
`;
7 changes: 7 additions & 0 deletions src/components/Common/AppModal/AppModal.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import renderer from "react-test-renderer";
import AppModal from "src/components/Common/AppModal/AppModal";
it("ActiveMark renders correctly", () => {
const tree = renderer.create(<AppModal>Modal</AppModal>).toJSON();
expect(tree).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActiveMark renders correctly 1`] = `null`;
13 changes: 13 additions & 0 deletions src/components/Common/Landing/About/About.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import styles from "src/components/Common/Landing/About/About.module.less";

const About = () => {
return (
<div className={styles.about}>
Made with the collaborative efforts of&nbsp;
<span>Vishnu Thiyagarajan</span>,&nbsp;<span>Vipan Kumar</span> and&nbsp;<span>Jyotrimaya Sahu</span>.
</div>
);
};

export default About;
10 changes: 10 additions & 0 deletions src/components/Common/Landing/About/About.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import "../../../themes/themes.less";
.about {
padding: 1em;
background-color: @primary-color;
color: white;
text-align: center;
span {
font-weight: bold;
}
}
2 changes: 2 additions & 0 deletions src/components/Common/Landing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styles from "src/components/Common/Landing/index.module.less";
import LandingMain from "src/components/Common/Landing/Main/LandingMain";
import Features from "src/components/Common/Landing/Features/Features";
import Pricing from "src/components/Common/Landing/Pricing/Pricing";
import About from "src/components/Common/Landing/About/About";

const Landing = () => {
return (
Expand All @@ -17,6 +18,7 @@ const Landing = () => {
<Element name="pricing">
<Pricing />
</Element>
<About />
</div>
);
};
Expand Down
25 changes: 14 additions & 11 deletions src/components/Common/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,26 @@ const Sidebar = (props) => {
const projectUrl = `${url}/${projectId}`;
const projects = useSelector((state) => state.projectList.projects);
const currentProject = projects.find((e) => e._id === projectId);

console.log("curr", currentProject);
const isBacklogs = pathname.endsWith("backlogs");
const isProjectList = pathname.endsWith("backlogs");
const backlogsUrl = `${url}/${projectId}/backlogs`;
const isProject = !!projectId;
return (
<section className={styles.sidebar}>
<div className={styles.main}>
<div className={styles.common}>
<Link to={projectUrl} className={styles.name}>
<div>{currentProject?.projectName}</div>
{!isBacklogs && <ActiveMark />}
</Link>
<Link to={backlogsUrl} className={styles.btnBacklogs}>
<div>Backlogs</div>
{isBacklogs && <ActiveMark />}
</Link>
</div>
{isProject && (
<div className={styles.common}>
<Link to={projectUrl} className={styles.name}>
<div>{currentProject?.projectName}</div>
{!isBacklogs && <ActiveMark />}
</Link>
<Link to={backlogsUrl} className={styles.btnBacklogs}>
<div>Backlogs</div>
{isBacklogs && <ActiveMark />}
</Link>
</div>
)}
{isProject ? (
isBacklogs ? (
<BacklogsControls />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/Sidebar/SprintsData/SprintsData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default SprintsData;

const SprintListItem = ({ sprint }) => {
const selectedSprint = useSelector((state) => state.sprint.selectedSprint);
const { name } = sprint;
const { name, startdate, enddate } = sprint;
const isCurrent = sprint.status === sprintStatus?.active;
const isActive = sprint._id === selectedSprint?._id;
const dispatch = useDispatch();
Expand All @@ -70,7 +70,7 @@ const SprintListItem = ({ sprint }) => {
<li onClick={handleClick} className={styles.sprintListItem}>
<div className={styles.content}>
<div>{name}</div>
<div className={styles.sprintRange}>19 Jun - 230 Jun</div>
<div className={styles.sprintRange}>{`${startdate ?? ""} - ${enddate ?? ""}`}</div>
</div>
{isCurrent && (
<div className={styles.checkIcon}>
Expand Down
13 changes: 8 additions & 5 deletions src/redux/Project/Tickets/ticketReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,20 @@ const ticketReducer = (state = initialState, action) => {
draft.msg = action.payload;
return;
case FILTER_UPDATED_TICKET_LIST:
draft.filters[action.data.filter] = action.data.isActive;

if (!(draft.filters.bug && draft.filters.userStory)) {
draft.filters[action.data.filter] = action.data.isAdded;
console.log(draft.filters.bug);
if (!(draft.filters.bug || draft.filters.userStory)) {
console.log("f");
draft.filteredTicketList = draft.ticketList.slice();
return;
}
console.log("s");
draft.filteredTicketList = draft.ticketList.filter(
(e) =>
e.type ===
((draft.filters.bug ? "BUG" : "USER_STORY") || (draft.filters.userStory ? "USER_STORY" : "BUG"))
e.type === (draft.filters.bug ? "BUG" : "USER_STORY") ||
e.type === (draft.filters.userStory ? "USER_STORY" : "BUG")
);
console.log(draft.filters);
return;
case SORT_UPDATED_TICKET_LIST:
if (action.data.sortBy === "") {
Expand Down

0 comments on commit 8326ba7

Please sign in to comment.