Monthly Archives: September 2013

Should you test views in an MVC application built in Sencha Touch?

A common debate is whether or not to write unit tests for views in Sencha Touch.  In theory an MVC app should be made up of: Fat Models Skinny Controllers Dumb Views So what does that mean?  Well, the majority … Continue reading

Listening to arbitrary config in ExtJS & Sencha Touch

Did you know you can listen to any arbitrary config value on any of your Observable instances in ExtJS.  Suppose you defined a view in ExtJS or Sencha Touch, and you gave it an arbitrary config of `controlledByTabMaster:true`.  You can … Continue reading

Modifying Jasmine spies after creation with Sencha Touch

Sometimes you might want to spy on a method which doesn’t call through but then later in the same suite of tests does call through.  For example I might spy on Ext.create because I want to check it was called … Continue reading

Checking for presence of class in array of classes in Sencha Touch and Jasmine

When unit testing in Sencha Touch it’s sometimes a requirement to check that you’re defining the correct dependencies of a file using the ‘requires’ statement in the config. Let’s take a controller as an example: In our test we want … Continue reading

Checking haveBeenCalledWith more than once in the same method call with Jasmine

Sometimes in Jasmine you want to spy on a method and check it’s been called multiple times.  This is especially relevant with Sencha Touch for global methods like Ext.create. There are a couple of things you can do.  Firstly you … Continue reading

Instantiating controllers for unit testing in Sencha Touch 2.2

When unit testing controllers you may want to create a new instance of the controller for each test.  It’s not possible to instantiate controllers directly in Sencha Touch simply using Ext.create. You need to pass a reference to a Sencha … Continue reading