Fixes #7213 Collapse plugin does not correctly set the "collapsed" class.

Collapse plugin does not correctly set the "collapsed" class on accordion heading links.
Patch includes fix and tests.

Before:
http://jsfiddle.net/uzSJD/2/

After:
http://jsfiddle.net/uzSJD/3/