Class('Test.Run.Harness.Browser.UI.AssertionGrid', {
isa : Ext.grid.GridPanel,
have : {
url : null
},
before : {
initComponent : function() {
Ext.apply(this, {
columns : [
{
header : '#',
width : 23,
dataIndex : 'index',
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 : [
'index',
'ok',
'isTodo',
'description',
'status',
'type'
],
autoDestroy : true,
data : []
})
})
}
},
methods : {
resultRenderer : function (value, metaData, record, rowIndex, colIndex, store) {
if (record.get('isTodo'))
metaData.css = value == 'ok' ? 'x-test-assert-row-ok-todo-cell' : 'x-test-assert-row-bug-todo-cell'
else
metaData.css = value == 'ok' ? 'x-test-assert-row-ok-cell' : 'x-test-assert-row-bug-cell'
return ''
}
}
})
Ext.reg('assertgrid', Test.Run.Harness.Browser.UI.AssertionGrid)