fix JS tests around location dropdowns, including defining String.trim for JS contexts where it does not exist