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/6/

After:
http://jsfiddle.net/uzSJD/5/