Skip to content

Commit

Permalink
fix prettier and last integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
njaeggi committed May 25, 2023
1 parent f65b3d4 commit 1d378af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
1 change: 0 additions & 1 deletion frontend/app/components/encryptable/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default class Form extends BaseFormComponent {
withSymbols = this.withSymbols,
passwordLength = this.passwordLength
) {
console.log("tes");
let pass = "";
const array = new Uint32Array(1);
const PASSWORD_CHARS =
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/templates/components/encryptable/form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
<Input
id="withSymbols"
@type="checkbox"
@checked={{this.withSymbols}} {{on "change" (fn this.setRandomPassword invertedWithSymbols passwordLength)}}></Input>
@checked={{this.withSymbols}} {{on "change" (fn this.setRandomPassword this.invertedWithSymbols this.passwordLength)}}></Input>
</label>
<label for="formControlRange">
{{passwordLength}}
<Input @type="range" class="custom-range" id="formControlRange" @value={{passwordLength}} min="16" max="32" {{on "change" (fn setRandomPassword this.withSymbols passwordLength)}}>
{{this.passwordLength}}
<Input @type="range" class="custom-range" id="formControlRange" @value={{this.passwordLength}} min="14" max="32" {{on "change" (fn setRandomPassword this.withSymbols passwordLength)}}>
</Input>
</label>
</div>
Expand Down
16 changes: 2 additions & 14 deletions frontend/tests/integration/components/encryptable/form-test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { module, test } from "qunit";
import { setupRenderingTest } from "ember-qunit";
import {
click,
render,
triggerKeyEvent,
pauseTest,
triggerEvent,
find
} from "@ember/test-helpers";
import { click, render, triggerEvent } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import Service from "@ember/service";
import { clickTrigger } from "ember-power-select/test-support/helpers";
import { selectChoose } from "ember-power-select/test-support";
import { setLocale } from "ember-intl/test-support";
import { scrollTo } from "@ember/test-helpers";

const navServiceStub = Service.extend({
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
Expand Down Expand Up @@ -337,16 +329,12 @@ module("Integration | Component | encryptable/form", function (hooks) {
);
});

//Last test to fix
//The function in called correctly but the value passwordLength isnt updated
test("Password with the right length should be generated", async function (assert) {
await render(hbs`<Encryptable::Form />`);
const slider = this.element.querySelector("input#formControlRange");
slider.value = 17;
await triggerEvent(slider, "change");
await triggerEvent(slider, "input");
await pauseTest();
console.log(slider.value);
await triggerEvent(slider, "change");
assert.equal(
this.element.querySelector("input[name='cleartextPassword']").value
.length,
Expand Down

0 comments on commit 1d378af

Please sign in to comment.