-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #766 from puzzle/bug/765-delete-team-from-user
resolve error after delete team from user
- Loading branch information
Showing
8 changed files
with
95 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 47 additions & 2 deletions
49
frontend/tests/integration/components/admin/user/deletion-form-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,63 @@ | ||
import { module, test } from "qunit"; | ||
import { setupRenderingTest } from "ember-qunit"; | ||
import { render } from "@ember/test-helpers"; | ||
import { render, waitFor } from "@ember/test-helpers"; | ||
import { hbs } from "ember-cli-htmlbars"; | ||
import Service from "@ember/service"; | ||
import { setLocale } from "ember-intl/test-support"; | ||
|
||
|
||
|
||
const storeStub = Service.extend({ | ||
query(modelName, params) { | ||
return [ | ||
{ name: "Team1", description: "description1", destroyRecord: () => {}}, | ||
{ name: "Team2", description: "description2", destroyRecord: () => {}} | ||
]; | ||
} | ||
}); | ||
|
||
module("Integration | Component | admin/user/deletion-form", function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
|
||
hooks.beforeEach(function () { | ||
this.owner.unregister("service:store"); | ||
this.owner.register("service:store", storeStub); | ||
setLocale("en"); | ||
|
||
}); | ||
|
||
test("it renders with block", async function (assert) { | ||
await render(hbs` | ||
<Admin::User::DeletionForm> | ||
Delete | ||
</Admin::User::DeletionForm> | ||
`); | ||
|
||
assert.equal(this.element.textContent.trim(), "Delete"); | ||
}); | ||
|
||
test("Refreshes teams after delete", async function (assert) { | ||
this.set("user", { | ||
id: 12, | ||
givenname: "Bob", | ||
surname: "Muster", | ||
username: "bob" | ||
}); | ||
|
||
await render(hbs` | ||
<Admin::User::DeletionForm @user={{this.user}}> | ||
Delete | ||
</Admin::User::DeletionForm>`); | ||
|
||
this.element.querySelector("span[role='button']").click() | ||
|
||
await waitFor('[data-test-id="delete"]', { timeout: 2000 }) | ||
|
||
|
||
this.element.querySelectorAll('[data-test-id="delete"]').forEach((e) => e.click()); | ||
await waitFor('[data-test-id="delete-user-text"]', { timeout: 2000 }) | ||
|
||
const teamsLeft = this.element.querySelectorAll("[data-test-id='delete']").length | ||
assert.equal(teamsLeft, 0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters