DropdownMenu.prototype.getFocusableMenuItems = function getFocusableMenuItems() { var node = ReactDOM.findDOMNode(this); if (!node) { return []; } return _Array$from(node.querySelectorAll('[tabIndex="-1"]')); };
it('should render a static classname given :rowClassName as a string', function () { var staticClassName = 'staticClass'; var rendered = findDOMNode(render(getMarkup({ rowClassName: staticClassName }))); var rows = rendered.querySelectorAll('.ReactVirtualized__Table__row'); _Array$from(rows).forEach(function (row) { expect(row.className).toContain(staticClassName); }); });
it('should use a custom cellRenderer if specified', function () { var rendered = findDOMNode(render(getMarkup({ cellRenderer: function cellRenderer(_ref9) { var cellData = _ref9.cellData; return 'Custom ' + cellData; } }))); var nameColumns = rendered.querySelectorAll('.ReactVirtualized__Table__rowColumn:first-of-type'); _Array$from(nameColumns).forEach(function (nameColumn, index) { var rowData = list.get(index); expect(nameColumn.textContent).toEqual('Custom ' + rowData.get('name')); }); });
it('should use a custom cellDataGetter if specified', function () { var rendered = findDOMNode(render(getMarkup({ cellDataGetter: function cellDataGetter(_ref8) { var dataKey = _ref8.dataKey, rowData = _ref8.rowData; return 'Custom ' + dataKey + ' for row ' + rowData.get('id'); } }))); var nameColumns = rendered.querySelectorAll('.ReactVirtualized__Table__rowColumn:first-of-type'); _Array$from(nameColumns).forEach(function (nameColumn, index) { expect(nameColumn.textContent).toEqual('Custom name for row ' + index); }); });
it('should support a :rowHeight function', function () { var rowHeight = function rowHeight(_ref5) { var index = _ref5.index; return 10 + index * 10; }; var rendered = findDOMNode(render(getMarkup({ rowHeight: rowHeight, rowCount: 3 }))); var rows = rendered.querySelectorAll('.ReactVirtualized__Table__row'); _Array$from(rows).forEach(function (row, index) { expect(_Number$parseInt(row.style.height, 10)).toEqual(rowHeight({ index: index })); }); });
it('should render dynamic style given :rowStyle as a function', function () { var rendered = findDOMNode(render(getMarkup({ rowStyle: function rowStyle(_ref16) { var index = _ref16.index; return index % 2 === 0 ? { backgroundColor: 'red' } : { backgroundColor: 'green' }; } }))); var rows = rendered.querySelectorAll('.ReactVirtualized__Table__row'); _Array$from(rows).forEach(function (row, index) { if (index % 2 === 0) { expect(row.style.backgroundColor).toEqual('red'); } else { expect(row.style.backgroundColor).toEqual('green'); } }); });
it('should render the expected rows and columns', function () { var rendered = findDOMNode(render(getMarkup({ rowGetter: useImmutable ? immutableRowGetter : vanillaRowGetter, headerHeight: 10, rowHeight: 20, height: 50 }))); var rows = rendered.querySelectorAll('.ReactVirtualized__Table__row'); expect(rows.length).toEqual(2); _Array$from(rows).forEach(function (row, index) { var rowData = list.get(index); var columns = row.querySelectorAll('.ReactVirtualized__Table__rowColumn'); expect(columns.length).toEqual(2); expect(columns[0].textContent).toEqual(rowData.get('name')); expect(columns[1].textContent).toEqual(rowData.get('email')); }); });
it('should render dynamic classname given :rowClassName as a function', function () { var rendered = findDOMNode(render(getMarkup({ rowClassName: function rowClassName(_ref15) { var index = _ref15.index; return index % 2 === 0 ? 'even' : 'odd'; } }))); var rows = rendered.querySelectorAll('.ReactVirtualized__Table__row'); _Array$from(rows).forEach(function (row, index) { if (index % 2 === 0) { expect(row.className).toContain('even'); expect(row.className).not.toContain('odd'); } else { expect(row.className).toContain('odd'); expect(row.className).not.toContain('even'); } }); });
return 1; case 2: _context.next = 4; return 2; case 4: _context.next = 6; return 3; case 6: case 'end': return _context.stop(); } } }, go, this); }); var arr = [].concat(_toConsumableArray(go())); var obj = { '1': 123, '2': 666, length: 3 }; var arr2 = _Array$from(obj, function (x) { return x + 3; }); console.info('==spreed=1=', arr2); // console.info('==spreed==', arr) export default {};
function assertVisibleCells(rendered, text) { expect(_Array$from(rendered.querySelectorAll('.cell')).map(function (node) { return node.textContent; }).sort().join(',')).toEqual(text); }