Tests and fix for class toggling

BTW, this is `last()` and not `first()` because the `addback()` in `parentsOrSelf` reverses the array.