When an option's index matches the index of it's optgroup among sibling optgroups, there is a failure. For example: optgroup 0 and option 0, or optgroup 2 and option 2.
This particular unit test checks for the presence of ::-ms-clear support in the browser. The same approach, if I'm not mistaken, should be sufficient for any other pseudo-element.