Tl;dr: My SO shouted and hit my phone off my hand, i shouted back at her and now she wants to break up. 

Me and my SO (both 19, she is my first / i am her fourth) just finished a half-term test today. While doing the test we and another classmate were confused with a question, my SO chose C while me and the other classmate chose D. My SO switched her answer to D when the test almost end but later found out the correct answer was C. She started shouting and threw a tantrum, the janitor just happended to past by and do his job (lock doors, turn off lights, etc. since it was time to leave). When she turned off the light my SO was still checking a few things with her notebook. My SO then shout at the janitor with some very bad words and i just quietly told her it's time to go but she then shout at me that it was too dark and she can't get things in her backpack (it was not that dark) so i turn on the flashlight and its all good. Later on, while we were walking in the hallway she said "take this" to me. I didn't understand if it was her backpack or her phone since she's holding them with both hands so i just grabbed the backpack thinking it was the one she meant but she then use her phone to hit my phone that i was holding in my other hand to the floor while shouting " i meant the phone!". She then picked up my phone and handed it to me but instead of saying sorry she just looked at me with hostile eyes and hiss. I lost my control at that moment and shout "I am tired of this, i can't be around doing this all the time!" to her then walked off the other direction. 15 mins later i found her walking home and approach to say sorry, she then pushed me back and walk home alone. Later that night i tried to call her but she didn't answer and now i just got her texts saying she has nothing else to say and want to break up. We have been together for almost a year now and she was always almost insufferable when it comes to tests time, I know what happened was most likely an accident from her part and i was probably an idiot (She still hit violently enough for my phone to fly away from my hand though) but i want to know if my action was appropriate and how i should have reacted instead. Thank you for reading this long post!