Widget: Avoid adding extra spaces to the result of this._classes(...)

Closes gh-1372
Widget: Test processing of empty classes key

Tests previous commit