vendredi 25 mars 2016

What are the equivalents of stub() and replace() WCT functions in Polymer Dart testing?

I've been spending a lot of time trying to figure out how to stub out elements in Polymer Dart applications, and I'm coming up a bit short when trying to find equivalents of the stub and replace functions from WCT. It seems relatively simple to stub out an element with sinon in JS, but when trying to do this in Polymer Dart, what I end up having to do is something like this:

elementToTest.$['otherElementId'] = new MockOtherElement()

where MockOtherElement is a mockito mock that implements the interface of OtherElement. It works, but it feels like a bit of a hack to access the $ property on my element, almost like property injection.

Aucun commentaire:

Enregistrer un commentaire