Skip to content

Commit 77fe1aa

Browse files
committed
fix(frontend): hide task form after creating new project task
1 parent b088900 commit 77fe1aa

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

frontend/app/projects/controller.js

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export default class ProjectsController extends Controller {
9898
}
9999

100100
this.fetchTasksByProject.perform(this.selectedProject);
101+
this.selectedTask = undefined;
101102
}
102103

103104
@dropTask

frontend/tests/acceptance/project-test.js

+30-5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ module("Acceptance | projects", function (hooks) {
7272
assert.dom("[data-test-task-form]").exists();
7373
assert.dom("[data-test-save]").isDisabled();
7474

75+
assert.dom("[data-test-name]").exists();
76+
assert.dom("[data-test-name]").isVisible();
7577
await fillIn("[data-test-name]", "FooBar Task 1");
7678
assert.dom("[data-test-save]").isNotDisabled();
7779

@@ -80,9 +82,6 @@ module("Acceptance | projects", function (hooks) {
8082

8183
await click("[data-test-save]");
8284

83-
assert.dom("[data-test-name]").hasValue("FooBar Task 1");
84-
assert.dom("[data-test-reference]").hasValue("Reference of FooBar Task 1");
85-
assert.dom("[data-test-estimated-time]").hasValue("02:15");
8685
assert.dom("[data-test-task-table-row]").exists({ count: 1 });
8786
});
8887

@@ -116,7 +115,6 @@ module("Acceptance | projects", function (hooks) {
116115
await fillIn("[data-test-estimated-time]", "02:15");
117116

118117
await click("[data-test-save]");
119-
await click("[data-test-cancel]");
120118

121119
assert.dom("[data-test-task-form]").doesNotExist();
122120
assert.dom("[data-test-table-name]").hasText("FooBar Task 1");
@@ -135,7 +133,6 @@ module("Acceptance | projects", function (hooks) {
135133
await click("[data-test-archived] input");
136134

137135
await click("[data-test-save]");
138-
await click("[data-test-cancel]");
139136

140137
assert.dom("[data-test-task-form]").doesNotExist();
141138
assert.dom("[data-test-table-name]").hasText("FooBar Task 1 updated");
@@ -144,6 +141,34 @@ module("Acceptance | projects", function (hooks) {
144141
assert.dom("[data-test-table-archived]").hasClass("fa-square-check");
145142
});
146143

144+
test("The cancel button will hide the form", async function (assert) {
145+
await visit("/projects");
146+
assert.strictEqual(currentURL(), "/projects");
147+
148+
await selectChoose(
149+
"[data-test-customer-selection]",
150+
".ember-power-select-option",
151+
0
152+
);
153+
154+
await selectChoose(
155+
"[data-test-project-selection]",
156+
".ember-power-select-option",
157+
0
158+
);
159+
160+
assert.dom("[data-test-add-task]").exists();
161+
assert.dom("[data-test-task-table-row]").doesNotExist();
162+
163+
await click("[data-test-add-task]");
164+
assert.dom("[data-test-task-form]").exists();
165+
assert.dom("[data-test-save]").isDisabled();
166+
167+
await click("[data-test-cancel]");
168+
169+
assert.dom("[data-test-task-form]").doesNotExist();
170+
});
171+
147172
test("shows all customers to superuser", async function (assert) {
148173
const user = this.server.create("user", { isSuperuser: true });
149174
this.server.create("project");

0 commit comments

Comments
 (0)