spec passes properly, javascript works on first load