refactor(alert): move logic to controller & add tests

Move logic to controller, so it is easier to modify behavior. For example to accomplish something like in #1305 :-)
Also, added some missing tests that `close` button is actually visible, because tests were passing even if link function was empty.

@pkozlowski-opensource Does this LGTY?