Add test cases for alignment directive

Refactor directive to set alignment when changed