function a {
obj.someFunction({callback: function b(){
//load store
}
}
How do I call function a from my test and then test that the thing that happened inside the callback function b worked? Just a time delay I guess?
Also, this is still weird behavior:
So... this is weird. When I log my store in the console inside a test it shows me something like this:
console.log(myStore)
Ext.Class.newClass
-data: Ext.Class.newClass
-events: Object
-eventsSuspended: false
-filters: Ext.Class.newClass
-groupers: Ext.Class.newClass
-loading: false
-model: function () {
-modelDefaults: Object
-proxy: Ext.Class.newClass
-removed: Array[0]
-sorters: Ext.Class.newClass
-storeId: "AllActivities"
-totalCount: 14
-__proto__: Class.registerPreprocessor.prototype
If I expand myStore.data it shows a length property of 14, but if I log myStore.data.length is displays as 0.
t.is(myStore.data.length, 14, 'Loaded 14 records'); fails because of this. Any ideas here? I'm baffled.
StartTest(function (t) {
var button = Ext.getCmp('btnLogin');
t.ok(button, 'button ok');
console.log(button);
t.click(button.btnEl);
var controller = MyApp.app.getController('MyApp.desktop.controller.ActivityController');
var store = Ext.getStore('AllActivities');
console.dir('about to call loadActivities');
controller.loadActivities();
console.dir('called loadActivities');
console.log('store:');
console.log(Object.keys(store));
console.log(store); // Shows a property, totalCount, in the console with a value of 14
console.log(store.totalCount); // undefined (???)
console.log(store.data); // store.data.length shows 14
console.log(store.data.length); // 0???
t.is(store.data.length, 14, 'Loaded 14 records');
/*
Ext.Ajax.request({
url: 'https://localhost:8001/api/resource',
success: function (response, opts) {
var obj = Ext.decode(response.responseText);
console.dir(obj);
t.ok(response, "got response");
},
failure: function (response, opts) {
t.fail("request failed");
t.endAsync(async);
}
});
*/
t.done();
});