Author Archives: tom

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

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

Fix Sencha Touch 2.2 box layouts in latest Chrome

A recent update to Chrome has changed how box layouts and min-height work.  There is an easy fix by changing one of the base sass files in the Sencha Touch 2.2 library. The file we’re looking for is /touch/resources/themes/stylesheets/sencha-touch/base/mixins/_Class.scss Look … Continue reading