When you switch the item being smelted by manner of clicking it with another item, so it is never "empty" even for a short amount of time, the smelting progress remains. I know this is a bug, because brewing (which was added later) does reset the brew progress if the ingredient is switched in the same manner.
Attached video