Skip to content

Commit

Permalink
add trim and change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel7373 committed Sep 17, 2024
1 parent db8ade5 commit 8395417
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/js/ButtonDisabler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ document.addEventListener("DOMContentLoaded", function () {
const submitButton = document.getElementById("submitButton");
function updateButtonState() {
const examNumber = examNumberInput.value;
submitButton.disabled = examNumber === "";
submitButton.disabled = examNumber.trim() === "";
}
examNumberInput.addEventListener("input", updateButtonState);
updateButtonState();
Expand Down
6 changes: 4 additions & 2 deletions src/test/e2e/cypress/e2e/search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ it('should rename files to subject-folder they are inside of after downloading',
cy.expect(i).to.equal(3)
});

it('should disable button if not enough numbers are in input', () => {
it('should not be disabled if number is in input', () => {
cy.get('input[type="text"]').type('110');
cy.get('button').should('not.be.disabled')
cy.get('button').should('not.be.disabled');
});

it('should disable button if input is empty', () => {
cy.get('button').should('be.disabled');
cy.get('input[type="text"]').type(' ');
cy.get('button').should('be.disabled')
});

0 comments on commit 8395417

Please sign in to comment.