Skip to content

Commit

Permalink
UIHandler: test formaction and formmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
jiripudil committed Apr 26, 2024
1 parent d37c49f commit 565d1a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Naja.UIHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ describe('UIHandler', function () {
this.form5.id = 'externalForm';
this.externalButton = document.createElement('button');
this.externalButton.setAttribute('form', 'externalForm');
this.externalButton.formAction = '/UIHandler/externalSubmitOverride';
this.externalButton.formMethod = 'POST';
this.externalButton.name = 'externalSubmit';
this.externalButton.classList.add('ajax');
document.body.appendChild(this.form5);
Expand Down Expand Up @@ -548,7 +550,7 @@ describe('UIHandler', function () {
const containsSubmit = sinon.match((value) => value.has('externalSubmit'));

mock.expects('makeRequest')
.withExactArgs('GET', '/UIHandler/externalSubmit', sinon.match.instanceOf(FormData).and(containsSubmit), {fetch: {}})
.withExactArgs('POST', '/UIHandler/externalSubmitOverride', sinon.match.instanceOf(FormData).and(containsSubmit), {fetch: {}})
.once();

const handler = new UIHandler(naja);
Expand Down

0 comments on commit 565d1a4

Please sign in to comment.