Skip to content

Commit

Permalink
Make index a row details template instance property
Browse files Browse the repository at this point in the history
  • Loading branch information
Saulis committed Mar 31, 2017
1 parent dba3e0b commit 3b408c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/row-details.html
Expand Up @@ -26,6 +26,30 @@
</template>
</test-fixture>

<dom-module id="x-grid">
<template>
<vaadin-grid id="grid" style="width: 50px; height: 400px;">
<template class="row-details"><span>[[index]]</span>-details</template>
<vaadin-grid-column>
<template>[[index]]</template>
</vaadin-grid-column>
</vaadin-grid>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'x-grid'
});
});
</script>
</dom-module>

<test-fixture id="with-scope">
<template>
<x-grid></x-grid>
</template>
</test-fixture>

<test-fixture id="repeat">
<template>
<vaadin-grid style="width: 200px; height: 400px;" size="100">
Expand Down Expand Up @@ -160,6 +184,27 @@
});
});

describe('inside a parent scope', function() {

beforeEach(function() {
grid = fixture('with-scope').$.grid;
grid.items = ['foo', 'bar', 'baz'];
bodyRows = getRows(grid.$.scroller.$.items);
Polymer.dom.flush();
});

it('should have the correct index on details template', function() {
// expand item 1
grid.expandItem('bar');

// expand item 0
grid.expandItem('foo');

var cells = getRowCells(bodyRows[1]);
expect(getCellContent(cells[1]).textContent.trim()).to.equal('1-details');
});
});

describe('repeat', function() {

var items = [];
Expand Down
1 change: 1 addition & 0 deletions vaadin-grid-row-details-behavior.html
Expand Up @@ -68,6 +68,7 @@
var templatizer = new vaadin.elements.grid.Templatizer(this.dataHost);
templatizer._instanceProps = {
expanded: true,
index: true,
item: true,
selected: true
};
Expand Down

0 comments on commit 3b408c9

Please sign in to comment.