A trio of spring elections offered early warning signs to Republicans and President Donald Trump, as Democrats rallied against his efforts to slash the federal government.