Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): hide task form after creating new project task #221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions frontend/app/projects/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default class ProjectsController extends Controller {
}

this.fetchTasksByProject.perform(this.selectedProject);
this.selectedTask = undefined;
}

@dropTask
Expand Down
35 changes: 30 additions & 5 deletions frontend/tests/acceptance/project-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ module("Acceptance | projects", function (hooks) {
assert.dom("[data-test-task-form]").exists();
assert.dom("[data-test-save]").isDisabled();

assert.dom("[data-test-name]").exists();
assert.dom("[data-test-name]").isVisible();
await fillIn("[data-test-name]", "FooBar Task 1");
assert.dom("[data-test-save]").isNotDisabled();

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

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

assert.dom("[data-test-name]").hasValue("FooBar Task 1");
assert.dom("[data-test-reference]").hasValue("Reference of FooBar Task 1");
assert.dom("[data-test-estimated-time]").hasValue("02:15");
Comment on lines -83 to -85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's test for this stuff later in the flow. Simply save the inputs and then click on the created task again.

assert.dom("[data-test-task-table-row]").exists({ count: 1 });
});

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

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

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

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

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

test("The cancel button will hide the form", async function (assert) {
await visit("/projects");
assert.strictEqual(currentURL(), "/projects");

await selectChoose(
"[data-test-customer-selection]",
".ember-power-select-option",
0
);

await selectChoose(
"[data-test-project-selection]",
".ember-power-select-option",
0
);

assert.dom("[data-test-add-task]").exists();
assert.dom("[data-test-task-table-row]").doesNotExist();

await click("[data-test-add-task]");
assert.dom("[data-test-task-form]").exists();
assert.dom("[data-test-save]").isDisabled();

await click("[data-test-cancel]");

assert.dom("[data-test-task-form]").doesNotExist();
});

Comment on lines +144 to +171
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could cover that in the before mentioned test for the task details. Assert the formerly created input data and after that click cancel and assert that it's closed.

test("shows all customers to superuser", async function (assert) {
const user = this.server.create("user", { isSuperuser: true });
this.server.create("project");
Expand Down
Loading