When did the law pass that every newborn be tested for any traits?

Varies with state. Various screening programs have been developed since the 1950"s and the content or specifics of each screening varies by the state. Passage & incorporation of screening programs were a necessary effort to limit the number of kids that had preventable forms of disability or retardation that would otherwise become a burden on the states welfare system.