Get help with testing, discuss unit testing strategies etc.


Post by estesbubba »

Code I use all over in our app to click grid rows doesn't seem to work for a grid in a window. Here is the test code and row does contain a value.
        t.it('Should allow row selection in window', function(t) {
            t.chain(
                { waitForCQVisible: 'window grid' },
                { waitForRowsVisible: 'window grid' },
                function(next) {
                    store = t.cq1('window grid').getStore();
                    rowIdx = store.findExact('c1', 'Row 1');
                    row = t.getRow('window grid', rowIdx);
                    console.log(row);
                    next();
                },
                { action: 'click', target: row },
                function(next) {
                    t.is(t.cq1('window grid').getSelection().length, 1, '1 row selected');
                    next();
                }
            );
        });
This is with Ext JS 5, and in order for a window to inherit ViewModel data, you need to do container.add(window).show(). I don't know if this might be the problem. I attached a ZIP file with a test case.

I could be doing something wrong, but since I use this grid click method in other places and it works, think it might be an Ext JS 5 issue.
Attachments
999-bugs.zip
(9.03 KiB) Downloaded 251 times

Post by nickolay »

Try the following:
{ action: 'click', target: function () { return row } },
In your version the "row" variable is evaluated at the time of "t.chain" call, when its not initialized yet.

Post by estesbubba »

That was it. In all other places I do this outside the chain which works. With the window it doesn't show until inside the chain and why I needed to get row there.
            row = t.getRow(me.listGrid, rowIdx);
            t.chain(
                {action: 'click', target: row},
Thanks for the help.

Post Reply