contributte / forms-multiplier

:repeat: Form multiplier & replicator for Nette Framework
https://contributte.org/packages/contributte/forms-multiplier.html
MIT License
26 stars 20 forks source link

tests: Demonstrate orphan fieldsets #83

Closed jtojnar closed 8 months ago

jtojnar commented 1 year ago

When group is created inside the modifier, clicking the create button will cause one more fieldset to be created than there are containers:

  <form action="/" method="post" id="frm-form">

  <fieldset>
  <legend>Team member #1</legend>

  <table>
  <tr>
    <th><label for="frm-form-members-0-name">Name</label></th>

    <td><input type="text" name="members[0][name]" id="frm-form-members-0-name" class="text"></td>
  </tr>
  </table>
  </fieldset>

  <fieldset>
  <legend>Team member #2</legend>

  <table>
  <tr>
    <th><label for="frm-form-members-1-name">Name</label></th>

    <td><input type="text" name="members[1][name]" id="frm-form-members-1-name" class="text"></td>
  </tr>
  </table>
  </fieldset>

  <fieldset>
  <legend>Team member #3</legend>
  </fieldset>

  <table>
  <tr>
    <th></th>

    <td><input type="submit" name="members[multiplier_creator]" class=" button" value="add" formnovalidate data-nette-validation-scope='["members"]'></td>
  </tr>
  </table>

  <input type="hidden" name="_do" value="form-submit">
  </form>
 Test  tests/unit/CreateButtonTest.php:testFieldsets
After adding a container, there should be two fieldsets.
Failed asserting that actual size 3 matches expected size 2.
jtojnar commented 8 months ago

Note that this test case currently fails, I opened it to demonstrate an issue I have but was unable to fix it yet.

f3l1x commented 8 months ago

Yep, I've noticed now. :-D

jtojnar commented 8 months ago

Sorry, I thought CI would make it clear but I should still have mentioned it explicitly.