@pih/esm-referrals-queue-app 2.0.0-pre.11 → 2.0.0-pre.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,7 @@
44
44
  "132.js"
45
45
  ],
46
46
  "auxiliaryFiles": [],
47
- "hash": "2d87332c94fc325b50c8",
47
+ "hash": "f0ec2086103a5bfe7fee",
48
48
  "childrenByOrder": {}
49
49
  },
50
50
  {
@@ -95,7 +95,7 @@
95
95
  "main.js"
96
96
  ],
97
97
  "auxiliaryFiles": [],
98
- "hash": "e58b17deeea05be8f913",
98
+ "hash": "6b108a42d6b242e0afac",
99
99
  "childrenByOrder": {}
100
100
  },
101
101
  {
@@ -150,9 +150,9 @@
150
150
  "initial": false,
151
151
  "entry": false,
152
152
  "recorded": false,
153
- "size": 282,
153
+ "size": 375,
154
154
  "sizes": {
155
- "javascript": 282
155
+ "javascript": 375
156
156
  },
157
157
  "names": [],
158
158
  "idHints": [],
@@ -164,7 +164,7 @@
164
164
  "319.js"
165
165
  ],
166
166
  "auxiliaryFiles": [],
167
- "hash": "591af7145fbc437fe30a",
167
+ "hash": "8276b3c3ed78dc838866",
168
168
  "childrenByOrder": {}
169
169
  },
170
170
  {
@@ -197,9 +197,9 @@
197
197
  "initial": false,
198
198
  "entry": false,
199
199
  "recorded": false,
200
- "size": 257,
200
+ "size": 335,
201
201
  "sizes": {
202
- "javascript": 257
202
+ "javascript": 335
203
203
  },
204
204
  "names": [],
205
205
  "idHints": [],
@@ -211,7 +211,7 @@
211
211
  "574.js"
212
212
  ],
213
213
  "auxiliaryFiles": [],
214
- "hash": "c225f62cd303ccdd2715",
214
+ "hash": "da6b74efbd20e349ed91",
215
215
  "childrenByOrder": {}
216
216
  },
217
217
  {
@@ -472,9 +472,9 @@
472
472
  "initial": false,
473
473
  "entry": false,
474
474
  "recorded": false,
475
- "size": 253,
475
+ "size": 348,
476
476
  "sizes": {
477
- "javascript": 253
477
+ "javascript": 348
478
478
  },
479
479
  "names": [],
480
480
  "idHints": [],
@@ -486,7 +486,7 @@
486
486
  "757.js"
487
487
  ],
488
488
  "auxiliaryFiles": [],
489
- "hash": "7c2988fe9f15d7b36662",
489
+ "hash": "09d28da7cd1c7d212321",
490
490
  "childrenByOrder": {}
491
491
  },
492
492
  {
@@ -494,10 +494,10 @@
494
494
  "initial": false,
495
495
  "entry": false,
496
496
  "recorded": false,
497
- "size": 1032574,
497
+ "size": 1032276,
498
498
  "sizes": {
499
499
  "consume-shared": 126,
500
- "javascript": 1032448
500
+ "javascript": 1032150
501
501
  },
502
502
  "names": [],
503
503
  "idHints": [],
@@ -509,7 +509,7 @@
509
509
  "830.js"
510
510
  ],
511
511
  "auxiliaryFiles": [],
512
- "hash": "a2d7e01b34f127910d41",
512
+ "hash": "910b36549298f5eeeb36",
513
513
  "childrenByOrder": {}
514
514
  }
515
515
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pih/esm-referrals-queue-app",
3
- "version": "2.0.0-pre.11",
3
+ "version": "2.0.0-pre.12",
4
4
  "license": "MPL-2.0",
5
5
  "description": "A page for viewing the J9 Home Visits from CommCare",
6
6
  "browser": "dist/pih-esm-referrals-queue-app.js",
@@ -83,32 +83,30 @@ export default function ReferralsQueue(props: ReferralsQueueProps) {
83
83
  </Heading>
84
84
  <div className={styles.controlsContainer}>
85
85
  <div className={styles.inputContainer}>
86
- <div className={styles.dateInputContainer}>
87
- <DatePicker
88
- dateFormat="d/M/Y"
89
- datePickerType="range"
90
- locale={language === "ht" ? "fr" : language}
91
- maxDate={new Date().toISOString()}
92
- onChange={(date) => {
93
- if (date && date.length > 0) {
94
- setFromDate(date ? moment(date[0]) : null);
95
- if (date.length > 1) {
96
- setToDate(date ? moment(date[1]) : null);
97
- }
86
+ <DatePicker
87
+ dateFormat="d/M/Y"
88
+ datePickerType="range"
89
+ locale={language === "ht" ? "fr" : language}
90
+ maxDate={new Date().toISOString()}
91
+ onChange={(date) => {
92
+ if (date && date.length > 0) {
93
+ setFromDate(date ? moment(date[0]) : null);
94
+ if (date.length > 1) {
95
+ setToDate(date ? moment(date[1]) : null);
98
96
  }
99
- }}
100
- value={[fromDate.toISOString(), toDate.toISOString()]}
101
- >
102
- <DatePickerInput id="from-date" labelText={t("from", "From")} />
103
- <DatePickerInput id="to-date" labelText={t("to", "To")} />
104
- </DatePicker>
105
- </div>
97
+ }
98
+ }}
99
+ value={[fromDate.toISOString(), toDate.toISOString()]}
100
+ >
101
+ <DatePickerInput id="from-date" labelText={t("from", "From")} />
102
+ <DatePickerInput id="to-date" labelText={t("to", "To")} />
103
+ </DatePicker>
106
104
  </div>
107
105
  <div className={styles.inputContainer}>
108
- <div style={{ width: 300 }}>
106
+ <div style={{ width: 400 }}>
109
107
  <Dropdown
110
108
  id="referral-type"
111
- label=""
109
+ label={t("select-referral-type", "Select Referral Type")}
112
110
  titleText={t("referral-type", "Referral Type")}
113
111
  items={referralTypes}
114
112
  onChange={(e) => setReferralTypeFilter(e.selectedItem)}
@@ -116,7 +114,7 @@ export default function ReferralsQueue(props: ReferralsQueueProps) {
116
114
  </div>
117
115
  </div>
118
116
  <div className={styles.inputContainer}>
119
- <div>
117
+ <div style={{ width: 400 }}>
120
118
  <label htmlFor="query-input">
121
119
  <Trans i18nKey="filter-by-patient">Filter by patient</Trans>
122
120
  </label>
@@ -128,10 +126,10 @@ export default function ReferralsQueue(props: ReferralsQueueProps) {
128
126
  </div>
129
127
  </div>
130
128
  <div className={styles.inputContainer}>
131
- <div style={{ width: 300 }}>
129
+ <div style={{ width: 400 }}>
132
130
  <Dropdown
133
131
  id="status"
134
- label=""
132
+ label={t("select-status", "Select Status")}
135
133
  titleText={t("status", "Status")}
136
134
  items={statuses}
137
135
  onChange={(e) => setStatusFilter(e.selectedItem)}
@@ -6,13 +6,9 @@
6
6
  max-width: 1500px;
7
7
  }
8
8
 
9
-
10
9
  .tableContainer {
11
10
  height: 500px;
12
11
  overflow-x: auto;
13
- margin: 0 1rem;
14
- border: 2px solid lightgrey;
15
- border-radius: 0.25rem;
16
12
  }
17
13
 
18
14
  .controlsContainer {
@@ -26,14 +22,6 @@
26
22
  min-width: 300px;
27
23
  text-align: left;
28
24
  padding: 0.5rem;
29
- }
30
-
31
- .inputContainer label {
32
- display: inline-block;
33
- margin: 0 0.5rem 0.5rem 0;
34
- }
35
-
36
- .dateInputContainer {
37
- margin: 2rem 2rem 1rem 0;
25
+ align-items: flex-end;
38
26
  }
39
27
 
@@ -93,7 +93,7 @@ describe("referrals queue", () => {
93
93
  screen.getByText("28 Mar");
94
94
  });
95
95
 
96
- // TODO: fix and re-enable
96
+ // TODO figure out how to test links
97
97
  it.skip("navigates to the links", async () => {
98
98
  const table = screen.getByRole("table");
99
99
  const pt0DashLink = within(table).getByText(referrals[0].zl_emr_id);
@@ -125,32 +125,42 @@ describe("referrals queue", () => {
125
125
  expect(within(table).getByText("Test Complete").tagName).not.toBe("A"); // the actual test
126
126
  });
127
127
 
128
- it.skip("filters by referral type", () => {
129
- const dropdown = screen.getByLabelText("Referral Type", {
130
- selector: "select",
131
- });
132
- fireEvent.change(dropdown, { target: { value: "Mental Health" } });
128
+ it("filters by referral type", () => {
129
+ fireEvent.click(screen.getByLabelText("Referral Type", {
130
+ selector: "button",
131
+ }));
132
+ fireEvent.click(screen.getByText("Mental Health", {
133
+ selector: "div"
134
+ }));
133
135
  expect(screen.queryByText("PTID1")).toBeNull();
134
136
  expect(screen.queryByText("PTID2")).not.toBeNull();
135
137
  expect(screen.queryByText("PTID3")).toBeNull();
136
138
  });
137
139
 
138
- it.skip("infers list of referral types from data", () => {
139
- const dropdown = screen.getByLabelText("Referral Type", {
140
- selector: "select",
141
- });
142
- fireEvent.change(dropdown, { target: { value: "Test Referral Type" } });
143
- expect(screen.queryByDisplayValue("Test Referral Type")).not.toBeNull();
140
+ it("infers list of referral types from data", () => {
141
+ expect(screen.queryByText("Test Referral Type", { selector: "span" })).toBeNull(); // sanity check
142
+ fireEvent.click(screen.getByLabelText("Referral Type", {
143
+ selector: "button",
144
+ }));
145
+ fireEvent.click(screen.getByText("Test Referral Type", {
146
+ selector: "div"
147
+ }));
148
+ expect(screen.queryByText("Test Referral Type", { selector: "span" })).not.toBeNull();
144
149
  });
145
150
 
146
- it.skip("filters by statuses, with dropdown inferred from data", () => {
147
- const dropdown = screen.getByLabelText("Status", { selector: "select" });
148
- fireEvent.change(dropdown, { target: { value: "Test Complete" } });
151
+ it("filters by statuses, with dropdown inferred from data", () => {
152
+ fireEvent.click(screen.getByLabelText("Status", {
153
+ selector: "button",
154
+ }));
155
+ fireEvent.click(screen.getByText("Test Complete", {
156
+ selector: "div"
157
+ }));
149
158
  expect(screen.queryByText("PTID1")).toBeNull();
150
159
  expect(screen.queryByText("PTID2")).toBeNull();
151
160
  expect(screen.queryByText("PTID3")).not.toBeNull();
152
161
  });
153
162
 
163
+ // TODO figure out how to interact with Carbon datepicker
154
164
  it.skip("calls getReferrals with the correct date arguments", () => {
155
165
  const monthAgoString = "2020-09-30";
156
166
  expect(mockedGetReferrals).lastCalledWith({
@@ -8,6 +8,8 @@
8
8
  "referral-date": "Referral Date",
9
9
  "referral-type": "Referral Type",
10
10
  "referrals-queue": "Referrals Queue",
11
+ "select-referral-type": "Select Referral Type",
12
+ "select-status": "Select Status",
11
13
  "status": "Status",
12
14
  "to": "To"
13
15
  }
@@ -8,6 +8,8 @@
8
8
  "referral-date": "Fecha de referencia",
9
9
  "referral-type": "Tipo de referencia",
10
10
  "referrals-queue": "Cola de referencias",
11
+ "select-referral-type": "Seleccionar tipo de referencia",
12
+ "select-status": "Seleccionar estado",
11
13
  "status": "Estado",
12
14
  "to": "Hasta"
13
15
  }
@@ -8,6 +8,8 @@
8
8
  "referral-date": "Date de Référé",
9
9
  "referral-type": "Type Référé",
10
10
  "referrals-queue": "List de Référé",
11
+ "select-referral-type": "Sélectionnez le type de référé",
12
+ "select-status": "Sélectionnez le état",
11
13
  "status": "État",
12
14
  "to": "à"
13
15
  }