rich media cards: bugfixes and regression tests
This MR adds regression tests for the rich media card rendering itself based on various commonly seen input permutations. It also fixes a regression introduced by a previous bugfix.
As far as I know, the rich media feature should be completely solid after this MR is accepted. Now that I've said that, its probably cursed but oh well.