Nickolay - Test.Run-0.05

Documentation | Source
Class('Test.Run.Harness.Browser.UI.AssertionGrid', {

    isa : Ext.grid.GridPanel,
    
    have : {
        url         : null
    },

    
    
    before : {
        initComponent : function() {
            Ext.apply(this, {
                
//                iconCls : 'x-test-test-status-question',
                
                columns : [
                    {
                        header : '#',
                        width : 23,
                        dataIndex : 'indx',
                        align : 'center'
                    },
                    {
                        header : 'Result',
                        width : 60,
                        sortable : true,
                        dataIndex : 'ok',
                        align : 'center',
                        
                        renderer : this.resultRenderer
                    },
                    {
                        header : 'Assertion',
                        width : 500,
                        sortable : true,
                        dataIndex : 'description'
                    }, 
                    {
                        header : 'Status',
                        width : 60,
                        sortable : true,
                        dataIndex : 'status'
                    }
                ],

                view : new Ext.grid.GridView({
                    forceFit : true,
                    enableRowBody : true,
                    
                    getRowClass : function(record, index, rowParams, store) {
                        var type = record.get('type')
                        
                        if (type == 'Test.Run.Result.Diagnostic') {
                            rowParams.body = '<h2>' + record.get('description') + '</h2>'
                            return 'x-test-diagnostic-row'
                        } else {
                            rowParams.body = ''
                        }
                    }
                }),

                store : new Ext.data.ArrayStore({
                    fields : ['indx', 'ok', 'description', 'status', 'type' ],

                    autoDestroy : true,
                    data : []
                })

            })
        }
    },

    
    after : {
        initComponent : function() {
        }
    },
    
    
    methods : {
        resultRenderer : function (value, metaData, record, rowIndex, colIndex, store) {
            if (value == 'ok') 
                metaData.css = 'x-test-assert-row-ok-cell'
            else
                metaData.css = 'x-test-assert-row-bug-cell'
            
            return ''
        }
    }

})

Ext.reg('assertgrid', Test.Run.Harness.Browser.UI.AssertionGrid)