{I" class:ETI"BundledAsset;FI"logical_path;TI"#netzke/testing/helpers/grid.js;TI" pathname;TI"i/Users/mxgrn/code/netzke/netzke-testing/app/assets/javascripts/netzke/testing/helpers/grid.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+äÉõTI" length;TiåI" digest;TI"%7f203a759180c518d6242a8bf3ab719e;FI" source;TI"å(function() { Ext.apply(window, { grid: function(title) { if (title) { return Ext.ComponentQuery.query('grid[title="' + title + '"]')[0]; } else { return Ext.ComponentQuery.query('grid{isVisible(true)}')[0]; } }, expandRowCombo: function(field, params) { var column, editor, g; g = g || this.grid(); editor = g.getPlugin('celleditor'); column = g.headerCt.items.findIndex('name', field) - 1; editor.startEditByPosition({ row: g.getSelectionModel().getCurrentPosition().rowIdx, column: column }); return editor.activeEditor.field.onTriggerClick(); }, addRecords: function() { var j, len, params, record; params = arguments[arguments.length - 1]; for (j = 0, len = arguments.length; j < len; j++) { record = arguments[j]; if (record !== params) { record = params.to.getStore().add(record)[0]; record.isNew = true; } } if (params.submit) { return click(button('Apply')); } }, addRecord: function(recordData, params) { var grid, record; params = params || []; grid = params.to || this.grid(); record = grid.getStore().add(recordData); return grid.getSelectionModel().select(grid.getStore().last()); }, updateRecord: function(recordData, params) { var grid, key, record, results, value; params = params || []; grid = params.to || this.grid(); record = grid.getSelectionModel().getSelection()[0]; results = []; for (key in recordData) { value = recordData[key]; results.push(record.set(key, value)); } return results; }, selectAssociation: function(attr, value, callback) { expandRowCombo(attr); return wait(function() { select(value, { "in": combobox(attr) }); return callback.call(); }); }, valuesInColumn: function(name, params) { var grid, out; if (params == null) { params = {}; } grid = params["in"] || this.grid(); out = []; grid.getStore().each(function(r) { var assocValue; assocValue = r.get('meta').associationValues[name]; return out.push(assocValue ? assocValue : r.get(name)); }); return out; }, selectAllRows: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().selectAll(); }, rowDisplayValues: function(params) { var grid, i, record, visibleColumns; if (params == null) { params = {}; } grid = params["in"] || this.grid(); record = params.of || grid.getSelectionModel().getSelection()[0]; visibleColumns = []; Ext.each(grid.columns, function(c) { if (c.isVisible()) { return visibleColumns.push(c); } }); i = -1; return Ext.Array.map(Ext.DomQuery.select('table[data-recordid="' + record.internalId + '"] tbody tr td div'), function(cell) { i++; if (visibleColumns[i].attrType === 'boolean') { return record.get(visibleColumns[i].name); } else { return cell.innerHTML; } }); }, selectLastRow: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().select(grid.getStore().last()); }, selectFirstRow: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().select(grid.getStore().first()); }, editLastRow: function() { var data, grid, key, record, results, store; data = arguments[0]; grid = Ext.ComponentQuery.query("grid")[0]; store = grid.getStore(); record = store.last(); results = []; for (key in data) { results.push(record.set(key, data[key])); } return results; }, completeEditing: function(g) { var e; g = g || this.grid(); e = g.getPlugin('celleditor'); return e.completeEdit(); } }); }).call(this); ;TI"required_assets_digest;TI"%9372f8783cbd1ebed5a28e09fdde317b;FI" _version;TI"%4bf7b15359fe8e0974f7f263e26e27f4;F