Shock acceleration of electrons in the presence of synchrotron losses – I. Test-particle theory