Docs Help

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.


item :  Object

The config object being added.


The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

Sencha Test 2.4.0


Unit vs Functional Testing

Tests written within Sencha Test will fall into the following categories:

  • Unit tests

  • Functional tests

Knowing how to use each type of test to your advantage will ensure the highest degree of integrity within your applications.

Testing Style Overview

Unit testing can be described as tests targeting the underlying code of an application. This style of testing may be of particular interest to application developers.

Functional testing analyzes the running application instead of simply testing its pieces and parts.
This style of testing may be of particular interest to quality assurance and end users.

Let's clarify this generalized description by saying that unit tests are able to be performed without spinning up an application while functional tests require the application to be launched to perform testing.

This distinction is important because Sencha Test, along with Ext JS 5+, can test code without any UI present. For example, you can test validations within data models without a running application. Views used within an application can also be tested independently from the application.

Many aspects of an application may be difficult or lengthy to test when testing through a running application. A test may require you to first follow a specific set of navigational steps, or to be logged in as a particular user type.

For example, consider a scenario where you want to test that a "user" can edit a given field versus an "admin" role on a “User Details” panel. A functional test requires you to launch the app and sign in as a user, not an admin. Then, perhaps navigate to a “User List” view, select a user from the list, and click an edit button to launch the “User Details” popup. You would then need to evaluate the fields that “user” is eligible to edit.

Ultimately, we simply want to know whether a “user” can edit certain fields in a view of type “User Details”. With unit testing, just create a test that only launches the view that injects “user” permissions. You can then evaluate the editability of the fields based on permissions.

Before exploring functional testing, let’s look at some common unit testing use cases and how we can perform those tests using Sencha Studio.

Unit Testing


  • You have already followed the installation guide
  • You have created a project with a classic sample application
  • You have initialized the test project (Tests) for your application and created a scenario to hold the tests.

Note: Unit tests do not require an application or the Sencha framework. That said, we're following this model to create a front-to-back guide path.

Unit Testing Model Validation

For this unit test, let's test validation for our User model. We want to ensure that the data stub representing inputted user data is valid within our parameters.

First, let’s add our User model class to our application by adding the following file: "{appName}/app/model/User.js":

Ext.define('MyApp.model.User', {
    extend: '',
    fields: ['first', 'last', 'fullname', 'username'],

    validators: {
        first: 'presence',
        last: { type: 'length', min: 2 },
        username: [
            { type: 'exclusion', list: ['Admin', 'Operator'] },
            { type: 'format', matcher: /([a-z]+)[0-9]{2,3}/i }

The “User” model can now be instantiated for test purposes. Next, let’s add some data to the scenario that the test is able to access when validating our User model. We’ll create a folder/file in the workspace root directory of: "{workspaceRoot}/shared/userdata.js". The "userdata" file will contain the following:

var __my_user_data = {
        first: 'Rick',
        last: 'Grimes',
        username: 'rgrimes'

Next, we’ll add the "userdata" file to the test project so that any scenario’s tests may access it. We’ll do this by clicking on the + Add button under the Additional Libraries header for the test project, double-click the default field value, click on the folder icon to bring up the file picker, and choose the “userdata.js” file from the “[workspaceRoot]/shared” directory. Finally, click on the Save button in the top toolbar.

In this next step, we’ll create the unit test used to verify that the "userdata" values are validated by our “User” model class.

First, create a Scenario by clicking on the "+ Add" button under the Scenarios heading in the Test Project view. For the purpose of this guide, we’ll give it a name of “User Data”.

Next, right-click on the "User Data" node in the workspace navigation tree and select "New > Jasmine Test Suite" and give the user validation test the name of “UserValidation”. This adds the “UserValidation” test as a child of the “User Data” scenario.

Click on the “UserValidation.js” node in the workspace validation tree to open the test editor view.

Finally, replace the placeholder test script with the following:

describe("UserValidation", function() {
    it("should pass", function(done) {
        Ext.require('MyApplication.model.User', function () {
            var user = new MyApplication.model.User(__my_user_data),
                failedValidation = user.getValidation().dirty;


In this test, we’re expecting the model to validate the sample user data. If you play the test in the Scenario's test runner, you should see that it does indeed pass!

Unit Testing a Custom Button

In addition to testing non-view logic, we can also unit test pieces and parts of our larger application to ensure they’re working correctly. In this test, let’s create a button with a badge that displays the text set in the button’s badgeText config.

To start, add the following folder/file to your application at: “{workspaceRoot}/app/view/button/BadgeButton.js”

Ext.define('MyApplication.view.button.BadgeButton', {
    extend: 'Ext.button.Button',
    xtype: 'badgebutton',

    config: {
        badgeText: null

    childEls: ['badgeEl'],

    cls: 'da-badge-button',

    hideBadgeOnDisabled: true,

    initRenderData: function() {
        return Ext.apply(this.callParent(), {
            badgeText: this.badgeText

    updateBadgeText: function(text) {
        var me = this;

        if (me.rendered) {
        } else {
            me.on('render', function() {

    onDisable: function() {
        if (this.hideBadgeOnDisabled) {
    onEnable: function() {
}, function(BadgeButton) {
    BadgeButton.prototype.renderTpl += '<span id="{id}-badgeEl" class="da-badgeElCls" data-ref="badgeEl">{badgeText}</span>';

Next, create a new Scenario called “Badge Button” in our application’s test project and then right-click on the Scenario to create a new Jasmine Test Suite called “ButtonText”.

We can add a single describe() with multiple it() specs in the badge button test suite. The description of each it() will show up as nodes under the scenario test tree under “ButtonText”.

Enter the following test in the "ButtonText" tab. This will allow studio to evaluate the badge text and ensure the badge element is hidden when the button is disabled.

describe("ButtonText", function() {
    var btn;

        btn = Ext.create('MyApplication.view.button.BadgeButton', {
            renderTo: Ext.getBody()

    afterEach(function () {

    it("should have a badge of 2", function() {

    it("badge should be hidden", function() {

Running the tests should show green checkmarks for both specs in "ButtonText".

Functional Testing

Unit tests are agile and allow for discrete testing of internal code and isolated componentry. Unit tests offer a great front line of defense when guarding against bugs introduced as an application evolves and becomes more complex. However, functional testing has its place in the bug defense strategy as well and should not be discounted in favor of unit tests alone.

It's quite possible for a suite's unit tests to all pass, leading you to believe your application has been error-proofed. All this, only to discover that when you run the application, some dynamic element of the application environment wasn’t captured in the unit tests.

For some operations, the only practical way to round out your test setup is to launch the application and put it through its paces.

Complex Routing

One such example would be to navigate between views within an application.
Let’s say your application has a parent container with a card view and two child views: Home and User List.

Then, let's say you want to test whether the routing works to display a specific user’s details view when the URL contains #!/user/rgrimes.

Internally you have a route in the parent view’s viewController that routes based on #!/user/ to the user panel and the user panel’s viewController opens the user details panel using the /rgrimes portion of the hash. Testing this type of navigational logic is exactly where functional testing comes into its own. The launching of the application takes care of presenting the main container and its children, which in turn spins up their respective viewControllers to manage the routing logic between views.

Testing the Application Environment

Complex routing is one scenario in which you’d want to spin up the application from Studio and run through test logic in order to validate the functionality of the app. Another reason you may want to employ functional testing would be to test the application running in a real-world environment.

Imagine you’ve set up a unit test to ensure that “User Details” views are viewable by “users”, but editable by “supervisors” and “admins”. You have a unit test to ensure that a “Weekly Overview” shows a single user’s details when viewed by a user, but an entire team roll-up when viewed by a supervisor.

The “Admin Dashboard” that configures user roles is only accessible to admins and not supervisors and users. With all of these unit tests in place you may feel that all bases are covered and every unique facet of the application has been tested so you may deploy. Now imagine that the user launches the application and is unable to sign in because the connection to the server / database is broken. A functional test that pulled down the user role information from the remote server would have secured this issue before the application deployed.


Unit and functional testing are essential when safeguarding your application against bugs.

Fortunately, Sencha Test gives you the tools needed to manage and perform both. This guide provides some simple examples for unit tests, but as you build out your test base, you’ll want to incorporate more than just direct logical testing. You’ll want to simulate user interactions within the UI.

To see how you can easily add simulated user interactions to your unit / functional tests, check out the Event Recorder guide.

Sencha Test 2.4.0