Writing unit tests for Flex 4 app..problems testing with skins

danatroymedia's Avatar


12 Jul, 2013 04:53 PM

I'm embarking on my first major foray into writing unit tests in tandem with refactoring legacy code. The examples in AS Developer's Guide to Robotlegs have provided adequate guidance thus far. However, I am experiencing the following issues, both related to the corresponding skins:

1. The tests for mediators eventually pass, but I get warnings indicating that skins cannot be found.
2. I have a skin which contains a click event that is listened to by a mediator 2 levels up through eventMap.maplistener(view.parent.label...). The problem is that I get a null reference to this label when I run the test. I have attempted to dispatch an event from the skin and addContextListener to the mediator to listen for this event, but this does not seem to work.

Any suggestions for either issue?

  1. Support Staff 1 Posted by Shaun Smith on 21 Jul, 2013 03:07 PM

    Shaun Smith's Avatar

    Hello. So you're first issue (1) doesn't seem to really be a problem, just a compiler warning.

    The second issue is because of that view.parent.label reference. This is very bad, and you should really try and rearrange your code so that the mediator is not digging around through the Display List like that. Your mediator is currently interacting with things outside of the scope of your view (it is digging up via parent), which is very fragile.

  2. Ondina D.F. closed this discussion on 17 Aug, 2013 10:52 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac