Mr Johnson’s continued leadership seemed in jeopardy after a fight over a federal funding plan put the government at risk of a pre-Christmas shutdown.