PLA-390 refactor SearchAbTests.js and add some unit tests

JUST FOR REVIEW. DON'T MERGE JUST YET

Refactoring of SearchABTest frontend part.