
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 1.97 KB | hits: 11 | expires: Never
suite.add(new Y.Test.Case({
name: 'batch',
setUp: function(){
spy.watchClass({
name: 'Ext.data.Batch',
functions: ['add', 'start']
});
spy.watchClass({
name: 'Ext.data.Operation'
});
},
tearDown: function(){
spy.unWatchClass('Ext.data.Batch');
spy.unWatchClass('Ext.data.Operation');
},
testBatch: function() {
var batchOperations = {
create : [AlienModel, HumanModel],
update : [AlienModel]
};
var batchListeners = {
complete: {
fn : Ext.emptyFn,
scope : this
}
};
var proxy = new Proxy();
var batch = proxy.batch(batchOperations, batchListeners);
// batch instanciation and functions calls
spy.verifyClass('Ext.data.Batch',{
args: [[{proxy: proxy, listeners: batchListeners}]],
functions: [{
name: 'add',
calls: 3,
scopes: [batch, batch, batch]
},{
name: 'start',
args: [[undefined]],
scopes: [batch]
}]
});
spy.verifyClass('Ext.data.Operation',{
args: [[{
action : 'create',
records: batchOperations.create
}],
[{
action : 'update',
records: batchOperations.update
}],
[{
action : 'destroy',
records: undefined
}]]
});
}
}));