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

Dashboard Calendar Month/Year Spacing Issue #210

Merged
merged 4 commits into from
Aug 26, 2024
Merged
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
27 changes: 27 additions & 0 deletions src/app/(main)/dashboard/components/Calendar/Calendar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { render } from "@testing-library/react";
import { Provider } from "react-redux";
import { configureStore } from "@reduxjs/toolkit";
import { format } from "date-fns";
import Calendar from "./Calendar";
import { rootReducer } from "@/store/store";

describe("Calendar Component", () => {
// not the best test. maybe refactor to e2e test later
it("displays the month and year on a single line", () => {
const store = configureStore({
reducer: rootReducer,
});

const { getByText } = render(
<Provider store={store}>
<Calendar />
</Provider>,
);

const currentDate = new Date();
const formattedDate = format(currentDate, "MMMM y");
const monthYearElement = getByText(formattedDate);

expect(monthYearElement.closest("div")).toHaveClass("whitespace-nowrap");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Calendar({
{/* CALENDAR */}
<div className="flex h-full min-w-[400px] max-w-[400px] flex-col items-center border-base-100 p-6 min-[1200px]:min-w-[600px] min-[1200px]:border-r-2 min-[1200px]:px-28 min-[1470px]:min-w-[400px] min-[1470px]:px-6">
<div className="flex w-full items-center">
<div className="flex w-full items-center justify-between gap-10 min-[1200px]:relative">
<div className="flex w-full items-center justify-between whitespace-nowrap min-[1200px]:relative">
{/* CALENDAR CONTROLS */}
<button
type="button"
Expand Down
3 changes: 2 additions & 1 deletion src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const persistConfig = {
whitelist: ["ideation", "sprint"],
};

const rootReducer = combineReducers({
// Root reducer should be used as import directly only for tests
export const rootReducer = combineReducers({
modal: modalReducer,
auth: authReducer,
user: userReducer,
Expand Down
Loading