fiduswriter / simple-datatables

DataTables but in TypeScript transpiled to Vanilla JS
Other
1.31k stars 231 forks source link

Fixes footers and captions disappearing on empty tables #352

Closed SandroHc closed 6 months ago

SandroHc commented 6 months ago

Custom table footers and captions were not being rendered on empty tables. The snippet bellow will render a datatable without the <caption> and <tfoot>.

This was my first time using Mocha. Please let me know if there's a better way to write the tests.

<table>
    <caption>This is a table caption.</caption>
    <thead>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
    </thead>
    <tbody>
        <!-- No data! -->
    </tbody>
    <tfoot>
        <tr>
            <td colspan="2">
                This is a table footer.
            </td>
        </tr>
    </tfoot>
</table>
<script>
    new window.simpleDatatables.DataTable("table")
</script>
johanneswilm commented 6 months ago

Mocha usage looks fine to me @SandroHc . We don't need to use it if you want to migrate the tests to something else. I just picked a framework that was popular at the time, if I recall correctly.

SandroHc commented 6 months ago

Mocha is fine by me. It's the perfect opportunity for me to learn it!