Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
mtnstar committed Jun 25, 2024
2 parents e9c42f9 + 95aff12 commit 044694e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
1 change: 1 addition & 0 deletions frontend/app/components/folder/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class ShowComponent extends Component {

@action
toggleEncryptableCredentialCreating() {
this.navService.selectedFolder = this.args.folder;
this.isNewEncryptableCredential = !this.isNewEncryptableCredential;
}

Expand Down
49 changes: 44 additions & 5 deletions frontend/tests/integration/components/encryptable/form-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,26 @@ const navServiceStub = Service.extend({
return 2;
}
}
]
],
/* eslint-enable ember/avoid-leaking-state-in-ember-objects */
selectedFolder: {
id: 1,
name: "bbt",
teamId: 1,
team: {
id: 1,
name: "bbteam",
get() {
return 1;
}
},
get(property) {
if (property === "team") {
return this.team;
}
return this[property];
}
}
});

const userServiceStub = Service.extend({
Expand Down Expand Up @@ -115,7 +133,7 @@ module("Integration | Component | encryptable/form", function (hooks) {
this.element
.querySelector("#team-power-select")
.innerText.replace(/\s+/g, " "),
"Team Select a Team"
"Team bbteam"
);

await selectChoose(
Expand Down Expand Up @@ -179,7 +197,7 @@ module("Integration | Component | encryptable/form", function (hooks) {
this.element
.querySelector("#team-power-select")
.innerText.replace(/\s+/g, " "),
"Team Wähle ein Team aus"
"Team bbteam"
);

await selectChoose(
Expand Down Expand Up @@ -243,7 +261,7 @@ module("Integration | Component | encryptable/form", function (hooks) {
this.element
.querySelector("#team-power-select")
.innerText.replace(/\s+/g, " "),
"Team Wähl äs Team us"
"Team bbteam"
);

await selectChoose(
Expand Down Expand Up @@ -314,7 +332,7 @@ module("Integration | Component | encryptable/form", function (hooks) {
this.element
.querySelector("#team-power-select")
.innerText.replace(/\s+/g, " "),
"Équipe Choisissez une équipe"
"Équipe bbteam"
);

await selectChoose(
Expand Down Expand Up @@ -543,4 +561,25 @@ module("Integration | Component | encryptable/form", function (hooks) {
assert.ok(this.element.textContent.trim().includes("Team"));
assert.ok(this.element.textContent.trim().includes("bob"));
});


test("Check prefill of team and folder", async function (assert) {
setLocale("en");

await render(hbs`<Encryptable::Form />`);

assert.equal(
this.element
.querySelector("#team-power-select .ember-power-select-selected-item")
.innerText.replace(/\s+/g, " "),
"bbteam"
);

assert.equal(
this.element
.querySelector("#folder-power-select .ember-power-select-selected-item")
.innerText.replace(/\s+/g, " "),
"bbt"
);
});
});

0 comments on commit 044694e

Please sign in to comment.