Tests and fix for class toggling

I believe the correct term is selector.