Can I inject a mock $window for a single directive but use the real $window in my test code?
64 views
Skip to first unread message
John Therrell
unread,
Feb 27, 2015, 4:18:38 PM2/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Hi Everyone,
I want to test a directive using a mock $window object so I can control the $window.location.protocol property which the directive inspects. However, my mock $window seems to also be used in my test code and my $compile calls in the test code and I can't create an element to test the directive.
Does angular provide a way for me to inject my mock $window only into my directive and allow me to use the real $window in other modules and test code?