Some of the forms I have in my project need to prompt the user if they try to leave after changing something and not saving it. To facilitate this, I am checking $scope.formName.$dirty and displaying prompts based upon that. Everything was going dandy until I started implementing unit testing. My unit tests for the controller of that form now fail because $scope.formName is undefined, and therefore can't have a $dirty property.
Is there a right way to mock the presence of a form? $compile perhaps?
If I shouldn't be checking things that way, how should I be doing it? a directive?