Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into MAT-6193
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankaplan authored Nov 27, 2023
2 parents 8120b1c + 4a744a6 commit 18f7228
Show file tree
Hide file tree
Showing 38 changed files with 249 additions and 62 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
},
"dependencies": {
"@madie/cql-antlr-parser": "^1.0.0",
"@madie/madie-design-system": "^1.2.0",
"@madie/madie-design-system": "^1.2.4",
"@madie/madie-models": "^1.3.36",
"@mui/x-date-pickers": "^6.6.0",
"@tanstack/match-sorter-utils": "^8.8.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ const valueSets = [

let handleDiagnosisChange = jest.fn();

jest.mock("@madie/madie-util", () => ({
routeHandlerStore: {
subscribe: (set) => {
set();
return { unsubscribe: () => null };
},
updateRouteHandlerState: () => null,
state: { canTravel: true, pendingPath: "" },
initialState: { canTravel: true, pendingPath: "" },
},
}));

describe("Diagnosis Component", () => {
beforeEach(() => {
handleDiagnosisChange = jest.fn((diagnoses) => {
Expand Down Expand Up @@ -183,7 +195,7 @@ describe("Diagnosis Component", () => {

const rankInput = screen.getByTestId(
"integer-input-field-Rank"
) as HTMLElement;
) as HTMLInputElement;
expect(rankInput).toBeInTheDocument();
expect(rankInput.value).toBe("");

Expand Down Expand Up @@ -288,7 +300,7 @@ describe("Diagnosis Component", () => {

const rankInput = screen.getByTestId(
"integer-input-field-Rank"
) as HTMLElement;
) as HTMLInputElement;
expect(rankInput).toBeInTheDocument();
expect(rankInput.value).toBe("");

Expand Down Expand Up @@ -444,7 +456,7 @@ describe("Diagnosis Component", () => {

const rankInput = screen.getByTestId(
"integer-input-field-Rank"
) as HTMLElement;
) as HTMLInputElement;
expect(rankInput).toBeInTheDocument();
expect(rankInput.value).toBe("");

Expand Down Expand Up @@ -533,7 +545,7 @@ describe("Diagnosis Component", () => {

const rankInput = screen.getByTestId(
"integer-input-field-Rank"
) as HTMLElement;
) as HTMLInputElement;
expect(rankInput).toBeInTheDocument();
expect(rankInput.value).toBe("");

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ElementSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $grey-19: #dddddd;
margin-bottom: 48px;
> .heading-row {
display: flex;
border-bottom: solid 1px $grey-19;
border-bottom: solid 1px #8c8c8c;
flex-direction: row;
flex-grow: 1;
justify-content: space-between;
Expand Down
2 changes: 0 additions & 2 deletions src/components/common/Identifier/IdentifierInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const IdentifierInput = ({
value={identifier.namingSystem}
label={namingLabel}
disabled={!canEdit}
placeholder={`${namingPlaceholder}`}
id={`identifier-field-${namingPlaceholder}`}
data-testid={`identifier-field-${namingPlaceholder}`}
inputProps={{
Expand All @@ -63,7 +62,6 @@ const IdentifierInput = ({
value={identifier.value}
label={valueLabel}
disabled={!canEdit}
placeholder={`${valueLabel}`}
id={`identifier-value-field-${valueLabel}`}
data-testid={`identifier-value-field-${valueLabel}`}
inputProps={{
Expand Down
12 changes: 12 additions & 0 deletions src/components/common/codeInput/CodeInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ const valueSets = [
},
];

jest.mock("@madie/madie-util", () => ({
routeHandlerStore: {
subscribe: (set) => {
set();
return { unsubscribe: () => null };
},
updateRouteHandlerState: () => null,
state: { canTravel: true, pendingPath: "" },
initialState: { canTravel: true, pendingPath: "" },
},
}));

describe("CodeInput Component", () => {
it("Should render Code Input component", async () => {
render(
Expand Down
21 changes: 20 additions & 1 deletion src/components/common/codeInput/CodeInput.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React, { useEffect, useState } from "react";
import "twin.macro";
import "styled-components/macro";
import { Select, TextField } from "@madie/madie-design-system/dist/react";
import {
Select,
TextField,
MadieDiscardDialog,
} from "@madie/madie-design-system/dist/react";
import { MenuItem } from "@mui/material";
import { CQL, ValueSet, Concept } from "cqm-models";
import { routeHandlerStore } from "@madie/madie-util";

type CodeSystems = {
[name: string]: string;
Expand Down Expand Up @@ -38,6 +43,9 @@ const CodeInput = ({
const [isCustom, setCustom] = useState<boolean>(false);
const [customCode, setCustomCode] = useState<string>();

const { updateRouteHandlerState } = routeHandlerStore;
const [discardDialogOpen, setDiscardDialogOpen] = useState(false);

useEffect(() => {
if (selectedCodeSystemName && customCode) {
const cqlCode = new CQL.Code(
Expand All @@ -51,6 +59,10 @@ const CodeInput = ({
}, [selectedCodeSystemName, customCode]);

Check warning on line 59 in src/components/common/codeInput/CodeInput.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'handleChange'. Either include it or remove the dependency array. If 'handleChange' changes too often, find the parent component that defines it and wrap that definition in useCallback

const handleValueSetChange = (event) => {
updateRouteHandlerState({
canTravel: false,
pendingRoute: "",
});
const oid = event.target.value;
// clear value set, code systems, code concepts and selected code
setSelectedValueSet(undefined);
Expand Down Expand Up @@ -251,6 +263,13 @@ const CodeInput = ({
)}
</div>
)}
<MadieDiscardDialog
open={discardDialogOpen}
onContinue={() => {
setDiscardDialogOpen(false);
}}
onClose={() => setDiscardDialogOpen(false)}
/>
</div>
);
};
Expand Down
12 changes: 12 additions & 0 deletions src/components/common/componentDataType/ComponentType.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ const mockFormik: FormikContextType<any> = {
},
};

jest.mock("@madie/madie-util", () => ({
routeHandlerStore: {
subscribe: (set) => {
set();
return { unsubscribe: () => null };
},
updateRouteHandlerState: () => null,
state: { canTravel: true, pendingPath: "" },
initialState: { canTravel: true, pendingPath: "" },
},
}));

describe("Component Type Component", () => {
let assessmentPerformed;
beforeEach(() => {
Expand Down
18 changes: 17 additions & 1 deletion src/components/common/facilityLocation/FacilityLocation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,26 @@ export const mockValueSets = [
];
const mockOnChange = jest.fn();

jest.mock("@madie/madie-util", () => ({
routeHandlerStore: {
subscribe: (set) => {
set();
return { unsubscribe: () => null };
},
updateRouteHandlerState: () => null,
state: { canTravel: true, pendingPath: "" },
initialState: { canTravel: true, pendingPath: "" },
},
}));

describe("FacilityLocation Component", () => {
it("should render FacilityLocation view", () => {
render(
<FacilityLocation onChange={mockOnChange} valueSets={mockValueSets} />
<FacilityLocation
onChange={mockOnChange}
valueSets={mockValueSets}
canEdit
/>
);
expect(screen.getByTestId("value-set-selector")).toBeInTheDocument();
expect(screen.getByTestId("location-period-start")).toBeInTheDocument();
Expand Down
7 changes: 4 additions & 3 deletions src/components/createTestCase/CreateNewTestCaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ interface navigationParams {

const testCaseSeriesStyles = {
width: "50%",
borderRadius: "3px",
borderWidth: "1px",
// remove weird line break from legend
"& .MuiOutlinedInput-notchedOutline": {
borderColor: "#8c8c8c",
borderRadius: "3px",
"& legend": {
width: 0,
Expand All @@ -53,7 +52,9 @@ const testCaseSeriesStyles = {
borderRadius: "3px",
padding: "9px 14px",
"&::placeholder": {
opacity: 0.6,
opacity: 1,
color: "#717171",
fontFamily: "Rubik",
paddingLeft: "5px",
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/createTestCase/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const TextArea = ({
// resize: "vertical",
borderRadius: "3px",
height: "auto",
border: "1px solid #DDDDDD",
border: "1px solid #8c8c8c",
marginTop: "8px",
// remove weird line break from legend
"& .MuiOutlinedInput-notchedOutline": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/editTestCase/qdm/EditTestCase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
position: sticky;
bottom: 0;
box-shadow: 0px 0px 2px 1px rgba(241, 242, 244, 0.25);
border-top: solid 1px #b0b0b0;
border-top: solid 1px #8c8c8c;
padding-right: 48px;
> .spacer {
display: flex;
Expand Down
3 changes: 1 addition & 2 deletions src/components/editTestCase/qdm/EditTestCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,14 @@ const EditTestCase = () => {
disabled={!formik.dirty || !canEdit}
onClick={() => setDiscardDialogOpen(true)}
>
{/* variant="outline-filled" */}
Discard Changes
</Button>
</div>
{hasObservationOrStratification && (
<div
style={{
textAlign: "center",
color: "grey",
color: "#717171",
fontSize: "14px",
paddingBottom: "30px",
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ const DemographicsSection = ({ canEdit }) => {
<FormControl>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<InputLabel
required
htmlFor={"birth-date"}
style={{ marginBottom: 0, height: 16 }} // force a heignt
sx={birthDateLabelStyle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ export const birthDateLabelStyle = [
},
];
export const textFieldStyle = {
borderRadius: "3px",
height: 40,
border: "1px solid #DDDDDD",
marginTop: "8px",
"& .MuiOutlinedInput-notchedOutline": {
borderRadius: "3px",
border: "1px solid #8c8c8c",
"& legend": {
width: 0,
},
Expand Down Expand Up @@ -53,12 +52,11 @@ export const textFieldStyle = {
};

export const timeTextFieldStyle = {
borderRadius: "3px",
height: 40,
border: "1px solid #DDD",
width: "110px",
marginTop: "8px",
"& .MuiOutlinedInput-notchedOutline": {
border: "1px solid #8c8c8c",
borderRadius: "3px",
"& legend": {
width: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ let selectedDataElement = {
const handleChange = jest.fn();
const deleteCode = jest.fn();

jest.mock("@madie/madie-util", () => ({
routeHandlerStore: {
subscribe: (set) => {
set();
return { unsubscribe: () => null };
},
updateRouteHandlerState: () => null,
state: { canTravel: true, pendingPath: "" },
initialState: { canTravel: true, pendingPath: "" },
},
}));

describe("Codes section", () => {
it("Should render Codes component with provided props", async () => {
render(
Expand Down
Loading

0 comments on commit 18f7228

Please sign in to comment.