{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+Ù¸7UI" length;TiáI" digest;TI"%7ae87542be8855e28fcf590beba01154;FI" source;TI"á(function() { Ext.apply(window, { grid: function(value, lookup) { lookup = lookup || 'title'; if (value && lookup === 'title') { return Ext.ComponentQuery.query('grid[title="' + value + '"]')[0]; } else if (value && lookup === 'name') { return Ext.ComponentQuery.query('grid[name="' + value + '"]')[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) { var action; action = function(cb) { expandRowCombo(attr); return wait(function() { select(value, { "in": combobox(attr) }); return cb(); }); }; if (callback) { return action(callback); } else { return new Promise(function(resolve, reject) { return action(resolve); }); } }, 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; }, valueInCell: function(column, row, params) { var assocValue, grid, r; if (params == null) { params = {}; } grid = params["in"] || this.grid(); r = grid.getStore().getAt(row); assocValue = r.get('meta').associationValues[column]; if (assocValue) { return assocValue; } else { return r.get(column); } }, 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()); }, selectRow: function(n, params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().select(n); }, 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"%f402a6ec09416f12799d9fca58d235df;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F