Hadith.3355 - Al-Ala narrated from Muhammad ibn Muslim:
He said
I asked Abu Ja'far Imam Muhammad ibn Ali Al-Baqir (as) about a dhimmi (non-Muslim under Islamic protection) and a slave who bore witness to a testimony. Then the dhimmi embraced Islam and the slave was emancipated, would their testimony about what they were made witnesses to before be valid?
Imam (as) said: "Yes, if goodness is known from them afterward, their testimony is valid."