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

fix(analysis): skip reset if edit is cancled #1187

Merged
Merged
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
5 changes: 4 additions & 1 deletion app/analysis/index/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ export default class AnalysisIndexRoute extends Route {
model() {
/* eslint-disable-next-line ember/no-controller-access-in-routes */
const controller = this.controllerFor("analysis.index");
const skipReset = controller.skipResetOnSetup;
next(() => {
controller._reset();
if (!skipReset) {
controller._reset();
}
});
}

Expand Down
8 changes: 5 additions & 3 deletions app/components/task-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

if (this.args.liveTracking) {
// we track "_activity" here since we can not track the public getters directly
this.tracking.addObserver(

Check warning on line 64 in app/components/task-selection/component.js

View workflow job for this annotation

GitHub Actions / Lint (js)

Don't use observers
"_activity",
this.handleTrackingActiveActivityChanged.perform
);
Expand Down Expand Up @@ -97,6 +97,8 @@
task: null,
};

const options = { preventAction: true };

// the objects are possibily wrapped in a proxy which would
// confuse the upcoming null check
const [customer, project, task] = await Promise.all([
Expand All @@ -106,11 +108,11 @@
]);

if (task) {
this.onTaskChange(task);
this.onTaskChange(task, options);
} else if (project) {
this.onProjectChange(project);
this.onProjectChange(project, options);
} else if (customer) {
this.onCustomerChange(customer);
this.onCustomerChange(customer, options);
} else {
this.tracking.fetchCustomers.perform();
}
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/analysis-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module("Acceptance | analysis", function (hooks) {
await authenticateSession({ user_id: this.user.id });

this.server.createList("report", 40, { userId: this.user.id });
this.reportIntersection = this.server.create("report-intersection", {
verified: false,
review: true,
});
});

test("can visit /analysis", async function (assert) {
Expand Down Expand Up @@ -169,6 +173,12 @@ module("Acceptance | analysis", function (hooks) {

assert.ok(find("tbody > tr:first-child.selected"));

// check if selection remains after canceling the edit
await click("button[data-test-edit-selected]");
await click("button[data-test-cancel]");

assert.ok(find("tbody > tr:first-child.selected"));

await click("tbody > tr:first-child");

assert.notOk(find("tbody > tr:first-child.selected"));
Expand Down
Loading