State Legislatures appoint Presidential electors as they see fit.
It so happens that all 50 have seen fit to use popular voting in some form to determine the choice of electors, but it is not required.
In fact, I don't think there is anything in the Constitution to govern or to restrict this power - a State Legislature could arguably say that no Catholics could be appointed as electors, for example.
So, a State Legislature is within its rights to say that Presidential electors will be appointed as a result of a "beauty contest" vote between the nominees of the Republican and the Democrat parties.
-PJ