Skip to content

Commit

Permalink
Make confirm modal case-insensitive (#6768)
Browse files Browse the repository at this point in the history
Close #6676
  • Loading branch information
seyeong authored and di committed Oct 8, 2019
1 parent 9822834 commit a36dc12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions tests/frontend/confirm_controller_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ describe("Confirm controller", () => {
});
});

describe("entering incorrect casing text", function() {
it("enables the button", function() {
fireEvent.input(document.getElementById("input-target"), { target: { value: "PACKAGE" } });

const buttonTarget = document.getElementById("button-target");
expect(buttonTarget).not.toHaveAttribute("disabled");
});
});

describe("entering incorrect text", function() {
it("disables the button", function() {
fireEvent.input(document.getElementById("input-target"), { target: { value: "foobar" } });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class extends Controller {
}

check() {
if (this.inputTarget.value == this.buttonTarget.dataset.expected) {
if (this.inputTarget.value.toLowerCase() === this.buttonTarget.dataset.expected.toLowerCase()) {
this.buttonTarget.disabled = false;
} else {
this.buttonTarget.disabled = true;
Expand Down

0 comments on commit a36dc12

Please sign in to comment.