SQL Server - How does Always On in a shared nothing config maintain transaction durability during a failover?
You use synchronous commit mode. This means transactions committed on the primary will also be committed on the secondary (over your network). So, if you failover during a transaction it will be rolled back when the secondary is brought online after recovery.

https://msdn.microsoft.com/en-us/library/ff877931.aspx


  Synchronous-commit mode protects your data by requiring the data to be synchronized between two places, at the cost of somewhat increasing
  the latency of the transaction.