Skip to content
This repository was archived by the owner on Sep 15, 2026. It is now read-only.
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
2 changes: 1 addition & 1 deletion custom-types/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "styled-components";
import { ThemeSpec } from "../src/theme/types";
import { ThemeSpec } from "@lifesg/react-design-system/theme/types";

declare module "styled-components" {
export interface DefaultTheme extends ThemeSpec {}
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ module.exports = {
"<rootDir>/src/__mocks__/fileMock.js",
},
moduleDirectories: ["node_modules", "<rootDir>"],
setupFilesAfterEnv: ["@testing-library/jest-dom"],
setupFilesAfterEnv: ["<rootDir>/tests/setup/global-setup.ts"],
reporters: ["default", ["jest-junit", { outputName: "junit.xml" }]],
};
7,718 changes: 4,807 additions & 2,911 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@hookform/resolvers": "^3.3.4",
"@lifesg/react-design-system": "^3.0.0-alpha.20",
"@lifesg/web-frontend-engine": "^2.0.0-alpha.8",
"react-hook-form": "^7.54.2",
"use-immer": "^0.9.0",
"yup": "^1.4.0"
Expand All @@ -47,9 +49,7 @@
"@babel/preset-typescript": "^7.16.7",
"@floating-ui/dom": "^1.6.13",
"@floating-ui/react": "^0.26.28",
"@lifesg/react-design-system": "^3.0.0-alpha.6",
"@lifesg/react-icons": "^1.10.0",
"@lifesg/web-frontend-engine": "^2.0.0-alpha.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
Expand All @@ -64,13 +64,12 @@
"@storybook/addon-themes": "^7.5.1",
"@storybook/react": "^7.4.6",
"@storybook/react-webpack5": "^7.4.6",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^12.1.4",
"@types/jest": "^27.4.1",
"@testing-library/jest-dom": "^6.7.0",
"@testing-library/react": "^12.1.5",
"@types/jest": "^30.0.0",
"@types/lodash": "^4.14.180",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@types/styled-components": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"babel-loader": "^8.2.4",
Expand All @@ -80,10 +79,11 @@
"eslint-plugin-prettier": "^5.1.3",
"globals": "^14.0.0",
"husky": "^9.0.11",
"jest": "^27.5.1",
"jest": "^30.0.5",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^30.0.5",
"jest-junit": "^16.0.0",
"jest-styled-components": "^7.0.8",
"jest-styled-components": "^7.2.0",
"lint-staged": "^12.3.7",
"postcss-import": "^16.0.1",
"prettier": "^3.2.5",
Expand All @@ -96,23 +96,21 @@
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"storybook": "^7.4.6",
"styled-components": "^5.3.5",
"styled-components": "^6.1.19",
"typescript": "^4.8.2",
"typescript-eslint": "^7.1.0"
},
"peerDependencies": {
"@floating-ui/dom": "^1.6.10",
"@floating-ui/react": "^0.26.23",
"@lifesg/react-design-system": "^3.0.0-alpha.6",
"@lifesg/react-icons": "^1.10.0",
"@lifesg/web-frontend-engine": "^2.0.0-alpha.1",
"react": "^17.0.2 || ^18.0.0",
"react-dom": "^17.0.2 || ^18.0.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.19"
},
"lint-staged": {
"*.{tsx,ts}": [
"eslint --fix"
]
}
}
}
5 changes: 2 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import terser from "@rollup/plugin-terser";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import typescript from "rollup-plugin-typescript2";
import pkg from "./package.json";

export const plugins = [
peerDepsExternal(), // Add the externals for me. [react, react-dom, styled-components]
Expand Down Expand Up @@ -41,14 +40,14 @@ export default [
input: "src/index.ts",
output: [
{
file: pkg.module,
dir: "dist",
format: "esm",
sourcemap: true,
exports: "named",
interop: "compat",
},
{
file: pkg.main,
dir: "dist/cjs",
format: "cjs",
sourcemap: true,
exports: "named",
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/base-card/base-card.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export const Body = styled.div<IBodyStyleProps>`

border-radius: ${Radius.md};

:hover {
&:hover {
border-color: ${Colour["border-primary"]};
box-shadow: 0px 2px 8px 0px ${Colour["border-selected-subtle"]};
}

:focus {
&:focus {
outline-color: ${Colour["border-primary"]};
}
`;
4 changes: 2 additions & 2 deletions src/components/common/icon-button/icon-button.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const IconButton = styled.button<IIconButtonStyleProps>`
background: transparent;
cursor: pointer;

:hover {
&:hover {
box-shadow: none;
}

:focus {
&:focus {
outline-color: ${Colour["border-focus-strong"]};
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/common/multi-entry/multi-entry.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ export const MultiEntryAccordionItem = styled(

[data-testid="accordion-item-expand-collapse-button"] {
margin-right: 0.1rem;
padding: 0 1rem 0 0;
}

[data-testid="accordion-item-title"] {
margin: ${({ $hasSubtitle }) =>
$hasSubtitle ? `1rem 0 0.5rem 1rem` : "1rem 0 1rem 1rem"};
}

[data-testid="content-container"] {
padding-right: 0;
}
`;

export const AddMultiEntryButton = styled(ButtonWithIcon.Default)`
Expand Down
2 changes: 1 addition & 1 deletion src/components/element-card/element-card.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const ActionButton = styled.button<IActionButtonStyleProps>`
return css`
color: ${Colour["text-primary"]};

:hover {
&:hover {
color: ${Colour["text-hover"]};
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export const AccordionItem = styled(
}

[data-testid="accordion-item-title"] {
margin: ${({ $hideTopBorder }) =>
$hideTopBorder ? "1rem 0 1rem 1rem" : "0 0 0 1rem"};
margin: 1rem 0 1rem 1rem;
}

[data-testid="accordion-item-expandable-container"] {
Expand All @@ -36,8 +35,13 @@ export const AccordionItem = styled(
}

[data-testid="accordion-item-expand-collapse-button"] {
margin: ${({ $hideTopBorder }) =>
$hideTopBorder ? "0 0.1rem 0 1rem" : "0 0.1rem 0 0"};
margin-left: 0;
margin-right: 0.1rem;
padding: 0 1rem 0 0;
}

[data-testid="content-container"] {
padding-right: 0;
}
`;

Expand Down
4 changes: 2 additions & 2 deletions src/components/side-panel/toolbar.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const ModeButton = styled.button<IModeButtonProps>`
border-radius: ${Radius.xs};
padding: 1rem;

:hover {
&:hover {
background: ${Colour["bg-hover-strong"]};
}

:focus {
&:focus {
outline-color: ${Colour["border-focus-strong"]};
}

Expand Down
4 changes: 2 additions & 2 deletions stories/translator/doc-elements.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export const IconButton = styled.button<IModeButtonProps>`
padding: 1rem;
align-self: center;

:hover {
&:hover {
background: ${Colour["bg-hover-strong"]};
}

:focus {
&:focus {
outline-color: ${Colour["border-focus-strong"]};
}

Expand Down
2 changes: 1 addition & 1 deletion tests/components/child-entry/child-entry.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("ChildEntry", () => {
});
const deleteButton = screen.getByTestId("delete-button");
fireEvent.click(deleteButton);
expect(mockDelete).toBeCalled();
expect(mockDelete).toHaveBeenCalled();
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/components/common/pills/pills.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import "jest-canvas-mock";
import { Pills } from "src/components/common/pills";
import { EElementType, TElement } from "src/context-providers";
Expand Down
4 changes: 2 additions & 2 deletions tests/components/element-card/element-card.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe("ElementCard", () => {
);
const deleteButton = getDeleteButton();
fireEvent.click(deleteButton);
expect(mockDeleteElement).toBeCalled();
expect(mockDeleteElement).toHaveBeenCalled();
});

it("should run the duplicateElement hook when clicking the duplicate button", () => {
Expand All @@ -149,7 +149,7 @@ describe("ElementCard", () => {
);
const duplicateButton = getDuplicateButton();
fireEvent.click(duplicateButton);
expect(mockDuplicateElement).toBeCalled();
expect(mockDuplicateElement).toHaveBeenCalled();
expect(mockDuplicateElement).toHaveBeenCalledWith(MOCK_ELEMENT);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ describe("BasicDetails", () => {

const elementName = screen.getByTestId("label-field");
const errorMessageField = screen.getByTestId(
"required-error-message-field"
"required-error-message-field-base"
);
const elementId = screen.getByTestId("id-field");
const elementId = screen.getByTestId("id-field-base");

expect(elementName).toHaveValue("Email address");
expect(errorMessageField).toHaveValue("This is a required field.");
Expand Down Expand Up @@ -117,9 +117,9 @@ describe("BasicDetails", () => {
// Check if the form fields have been replaced with the new element type's default values
const elementName = screen.getByTestId("label-field");
const errorMessageField = screen.getByTestId(
"required-error-message-field"
"required-error-message-field-base"
);
const elementId = screen.getByTestId("id-field");
const elementId = screen.getByTestId("id-field-base");

expect(elementName).toHaveValue("Short text");
expect(errorMessageField).toHaveValue("This is a required field.");
Expand All @@ -141,9 +141,11 @@ describe("BasicDetails", () => {
});

const descriptionField = screen.getByTestId("description-field");
const placeholderField = screen.getByTestId("placeholder-field");
const placeholderField = screen.getByTestId(
"placeholder-field-base"
);
const preselectedValueField = screen.getByTestId(
"preselected-value-field"
"preselected-value-field-base"
);

fireEvent.change(descriptionField, {
Expand Down Expand Up @@ -180,10 +182,11 @@ describe("BasicDetails", () => {
// Wait for the form to reset
const updatedDescriptionField =
await screen.findByTestId("description-field");
const updatedPlaceholderField =
await screen.findByTestId("placeholder-field");
const updatedPlaceholderField = await screen.findByTestId(
"placeholder-field-base"
);
const updatedPreselectedValueField = await screen.findByTestId(
"preselected-value-field"
"preselected-value-field-base"
);

expect(updatedDescriptionField).toHaveValue("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe("IdField", () => {
},
});

const idField = await screen.findByTestId("id-field");
expect(idField).toBeDisabled();
const idField = await screen.findByTestId("id-field-base");
expect(idField).toHaveAttribute("aria-disabled", "true");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("Options", () => {
fireEvent.click(addOptionButton);
});

optionItems = screen.getAllByTestId("option-label");
optionItems = screen.getAllByTestId("option-label-base");

expect(optionItems).toHaveLength(3);
});
Expand All @@ -75,7 +75,7 @@ describe("Options", () => {
},
});

let optionItems = screen.getAllByTestId("option-label");
let optionItems = screen.getAllByTestId("option-label-base");

expect(optionItems).toHaveLength(3);

Expand All @@ -87,7 +87,7 @@ describe("Options", () => {
fireEvent.click(deleteButton);
});

optionItems = screen.getAllByTestId("option-label");
optionItems = screen.getAllByTestId("option-label-base");

expect(optionItems).toHaveLength(2);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ describe("DropdownBasicDetails", () => {
const dropdownItem = screen.getByText("Dropdown items");
expect(dropdownItem).toBeInTheDocument();

const dropdownItemLabels = await screen.findAllByTestId("option-label");
const dropdownItemValues = await screen.findAllByTestId("option-value");
const dropdownItemLabels =
await screen.findAllByTestId("option-label-base");
const dropdownItemValues =
await screen.findAllByTestId("option-value-base");

expect(dropdownItemLabels[0]).toBeInTheDocument();
expect(dropdownItemValues[0]).toBeInTheDocument();
Expand Down Expand Up @@ -99,9 +101,9 @@ describe("DropdownBasicDetails", () => {
if (fieldName === "preselectedValue") {
//Ensure the rendering condition is met
const dropdownItemLabels =
await screen.findAllByTestId("option-label");
await screen.findAllByTestId("option-label-base");
const dropdownItemValues =
await screen.findAllByTestId("option-value");
await screen.findAllByTestId("option-value-base");

fireEvent.change(dropdownItemLabels[0], {
target: { value: "New Label" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("ConditionalRenderingChild", () => {

const deleteButton = screen.getByTestId("delete-button");
fireEvent.click(deleteButton);
expect(mockDelete).toBeCalled();
expect(mockDelete).toHaveBeenCalled();
});

it("should render an error message when validation error message field is left empty", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("PrefillChild", () => {
);
const deleteButton = screen.getByTestId("delete-button");
fireEvent.click(deleteButton);
expect(mockDelete).toBeCalled();
expect(mockDelete).toHaveBeenCalled();
});

it("should render an error message when prefill fields are left empty", async () => {
Expand Down
Loading
Loading