Description
Found out exactly what's going on in #2754: the HTMLCollection returned by document.getElementsByClassName
, at least in some browsers, actually drops elements that get their className
changed such that they no longer match the criteria on which the collection was based; thus, Mocha will only unhide the first half of the hidden suites or every other one of them.
#2754 attempted to fix this by converting the collection to an array. Currently Mocha runs in some pretty old environments. If we have a shim for the array slice
method we should use that rather than assuming the native [].slice
. If we don't have such a shim, we should simply reverse the for
loop: start at .length - 1
and decrement while >= 0
instead of starting at 0
and incrementing while < .length
.
(We should also get a test for the unhiding of more than one suite. I will incorporate this into my work on testing the HTML reporter and mark it as .skip
until a fix can also be PR'd.)
I'd like to thank @ZeroBinbin for bringing this to our attention, and apologize for taking so long to get around to digging into it.