Permalink
Browse files
fix(ngAnimate): safe-guard against missing document
In tests, the $document service might be mocked out without providing a real
document, which can lead to errors when the animator is attempting to read properties from it.
This commit provides an object {hidden: true}, if the $document service doesn't have
a document. This will prevent the animation process from trying to run any animations.
This commit also changes the check for document.hidden slightly. It
should be accessed independently of the current animationsEnabled state.
Since animations are only enabled after two digests, it's possible that
some tests never reach the animationsEnabled = true state and therefore
aren't actually checking the document.hidden state, which means that
the previous fix only works if no more than two digests happen in the test.
(#14633)- Loading branch information
Showing
with
35 additions
and 2 deletions.