You're using jQuery here, but it's not imported. Does that mean you're assuming it's in the global scope via Dashboard? If so, this will break when testing outside of the dashboard.