Skip to content

Commit 2b1b28d

Browse files
committed
test: - visualise error messages in Edit Task modal
1 parent 6c6a253 commit 2b1b28d

3 files changed

+17
-11
lines changed

tests/ui/EditTask.test.Edit_Modal_HTML_snapshot_tests_should_match_snapshot.approved.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@
105105
<input
106106
id="scheduled"
107107
type="text"
108-
class="tasks-modal-date-input"
108+
class="tasks-modal-date-input tasks-modal-error"
109109
placeholder="Try 'Mon' or 'tm' then space"
110110
accesskey="s" />
111-
<div class="tasks-modal-parsed-date">
111+
<code class="tasks-modal-parsed-date">
112112
113-
<input class="tasks-modal-date-editor-picker" type="date" id="date-editor-picker" tabindex="-1" />
114-
</div>
113+
<i>invalid scheduled date</i>
114+
</code>
115115
<label for="start">
116116
St
117117
<span class="accesskey">a</span>
@@ -257,7 +257,7 @@
257257
</div>
258258
</section>
259259
<section class="tasks-modal-button-section">
260-
<button type="submit" class="mod-cta">Apply</button>
260+
<button type="submit" class="mod-cta" disabled="">Apply</button>
261261
<button type="button">Cancel</button>
262262
</section>
263263
</form>

tests/ui/EditTask.test.Edit_Modal_HTML_snapshot_tests_should_match_snapshot_-_without_access_keys.approved.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,15 @@
6161
<input class="tasks-modal-date-editor-picker" type="date" id="date-editor-picker" tabindex="-1" />
6262
</div>
6363
<label for="scheduled">Scheduled</label>
64-
<input id="scheduled" type="text" class="tasks-modal-date-input" placeholder="Try 'Mon' or 'tm' then space" />
65-
<div class="tasks-modal-parsed-date">
64+
<input
65+
id="scheduled"
66+
type="text"
67+
class="tasks-modal-date-input tasks-modal-error"
68+
placeholder="Try 'Mon' or 'tm' then space" />
69+
<code class="tasks-modal-parsed-date">
6670
67-
<input class="tasks-modal-date-editor-picker" type="date" id="date-editor-picker" tabindex="-1" />
68-
</div>
71+
<i>invalid scheduled date</i>
72+
</code>
6973
<label for="start">Start</label>
7074
<input id="start" type="text" class="tasks-modal-date-input" placeholder="Try 'Mon' or 'tm' then space" />
7175
<div class="tasks-modal-parsed-date">
@@ -159,7 +163,7 @@
159163
</div>
160164
</section>
161165
<section class="tasks-modal-button-section">
162-
<button type="submit" class="mod-cta">Apply</button>
166+
<button type="submit" class="mod-cta" disabled="">Apply</button>
163167
<button type="button">Cancel</button>
164168
</section>
165169
</form>

tests/ui/EditTask.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ describe('Edit Modal HTML snapshot tests', () => {
658658
});
659659

660660
function verifyModalHTML() {
661-
const task = taskFromLine({ line: '- [ ] absolutely to do', path: '' });
661+
// Populate task a valid and an invalid date. Note that the valid date value
662+
// is not visible in the HTML output.
663+
const task = taskFromLine({ line: '- [ ] absolutely to do 🛫 2024-01-01 ⏳ 2024-02-33', path: '' });
662664
const onSubmit = () => {};
663665
const allTasks = [task];
664666
const { container } = renderAndCheckModal(task, onSubmit, allTasks);

0 commit comments

Comments
 (0)