Get help with testing, discuss unit testing strategies etc.


Post by jflowers45 »

I have a case where I click to activate a filter and wait on a data store to finish loading before I proceed and the following syntax works well.
 { click : '#filters => .x-menu-item-text' },
      function(next) {
        t.cq1('supplywrgrid').getStore().on('load', function() {
          next();
        });
      },
However, to prevent possible race condition in the case of caching, I'd like to use a trigger config, but the following isn't working - it gets stuck with the observable waiting on load, probably because i'm passing a function that returns the store rather than the store itself.
 {     waitFor : 'Event', 
          args    : [ function() {return t.cq1('supplywrgrid').getStore(); }, 'load' ],
          trigger : { click : '#filters => .x-menu-item-text' }
      },
Is there some other syntax I can use? if I wrap a call to t.waitForEvent in a function call I don't know where to place the trigger object.

Thanks!

Post by mats »

Try
     {     
                     waitForEvent : function() { return [t.cq1('supplywrgrid').getStore(), 'load']; },
                    trigger : { click : '#filters => .x-menu-item-text' }
          },

Post by jflowers45 »

Worked like a charm. Thanks!

Post Reply