在 ExtJs 应用程序中,为了使 getStore 工作控制器,在 Application.js 中添加模型和存储。但是对于午睡测试,我无法在 Application.js 中进行任何更改。
直接调用 Ext.getStore(storeId) 返回未定义。我已经尝试通过在预加载中添加模型,但它没有帮助。
我该怎么办?
-------------------------testFile AnalysisController.t.js 中的代码---------------- -----
StartTest(function(t){
var testStore = Ext.getStore('Nm.store.analysis.TestStore'); //testStore is undefined
});
-------------------------testModel.js 中的代码-------------------- -----
Ext.define('Nm.model.analysis.TestModel',
{
extend: 'Ext.data.Model',
fields: [
{name:'lastName',type:'string'},
{name:'age',type:'int'},
{name:'relationDescription',type:'string'},
{name:'dateOfBirth',type:'date',dateFormat: 'm-D-Y'}
]
});
-------------------------testStore.js 中的代码-------------------- -----
Ext.define('Nm.store.analysis.TestStore',{
extend : 'Ext.data.Store',
requires: ['Nm.model.analysis.TestModel'],
model : 'Nm.model.analysis.TestModel'
});
-------------------------线束文件testIndex.js中的代码----
var Harness = Siesta.Harness.Browser.ExtJS;
Harness.configure({
title : 'Samples',
loaderPath : { 'Nm' : 'app' },
preload : [
"http://cdn.sencha.io/ext/gpl/4.2.0/resources/css/ext-all.css",
"http://cdn.sencha.io/ext/gpl/4.2.0/ext-all-debug.js"
]
});
Harness.start({
group : 'Controller',
items : [
'test/AnalysisController.t.js'
]}
);