Damage from a spell should be determined as soon as it leaves the casters hands, but what I suspect is happening is that it's determined when the spell hits the target. I suspect this because you're supposed to be able to cast frostbolt=>ice land against a frozen target and get the ice lance 3x bonus even if the frostbolt breaks the freeze. However this is not happening. Another way to test might be pvp vs a rogue, cast a spell and while it's traveling have the rogue cloak of shadows. They should not get any resist bonus against that cast.
Another easy way to validate I've found is spell power trinkets. If you cast a traveling spell and then use your trinket the spell casted before you used the trinket will gain the bonus spell power.
Damage from a spell should be determined as soon as it leaves the casters hands, but what I suspect is happening is that it's determined when the spell hits the target. I suspect this because you're supposed to be able to cast frostbolt=>ice land against a frozen target and get the ice lance 3x bonus even if the frostbolt breaks the freeze. However this is not happening. Another way to test might be pvp vs a rogue, cast a spell and while it's traveling have the rogue cloak of shadows. They should not get any resist bonus against that cast.