JENKINS-22787 Broken placement of parallel stages in some cases

In some cases parallel stages will not render correctly. Have done some javascript fixes and added a test case for the placement.