Conversation
|
Should a test get verified that a tab gets hidden and unhidden properly? |
|
Yeah, we don't have any JS tests so this might be a good opportunity to get at least one in... Any experience with writing tests for JS? I'm yet to give it a try. Also, looks like |
Codecov Report
@@ Coverage Diff @@
## master #106 +/- ##
==========================================
+ Coverage 97.10% 97.12% +0.02%
==========================================
Files 1 2 +1
Lines 207 209 +2
==========================================
+ Hits 201 203 +2
Misses 6 6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
My attempt at testing the simplest function in the module is failing. Not sure if you have experience testing JS using I must be using this incorrectly, as the const tabs = require('../tabs')
describe("Selecting a tab", () => {
test("tab become selected", () => {
// Set up our document body
document.body.innerHTML =
'<div>' +
' <button id="test-button" aria-controls="panel-id" aria-selected="false">Test</button>' +
' <div id="panel-id" hidden="true">Test</div>' +
'</div>';
let button = document.getElementById('test-button');
let panel = document.getElementById('panel-id');
expect(button.getAttribute('aria-selected')).toEqual('false')
expect(panel.getAttribute('hidden')).toEqual("true")
tabs.selectTab(button)
expect(button.getAttribute('aria-selected')).toEqual('true')
expect(panel.getAttribute('hidden')).toEqual("false")
})
}) |
|
I'm not familiar with Javascript beyond a basic extent. Mostly a python developer and documentation writer myself. If tests are blocking, we can always merge now and test properly later. |
|
Same here to be honest 😅 yeah that's fair, I'll ask a friend about the testing and get it in later. Are you happy with the changes in this PR (fix has been verified by those who raised the issue) and #107? |
Changes:
Closes #105