Browse Source

Fixes a bug in Details being open on freshly retrieved Grid rows (#16644)

Change-Id: Id337dd84ba0b0f09d55b3cdb0d8bfde67313ed21
tags/7.5.0.alpha1
Henrik Paul 9 years ago
parent
commit
251ed2cbb6

+ 4
- 1
server/src/com/vaadin/data/RpcDataProviderExtension.java View File

@@ -156,7 +156,10 @@ public class RpcDataProviderExtension extends AbstractExtension {
}

indexToItemId.forcePut(index, itemId);
detailComponentManager.createDetails(itemId, index);

if (visibleDetails.contains(itemId)) {
detailComponentManager.createDetails(itemId, index);
}
}
index++;
}

+ 26
- 3
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java View File

@@ -17,7 +17,6 @@ package com.vaadin.tests.components.grid.basicfeatures.server;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@@ -76,8 +75,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
selectMenuPath(FIRST_ITEM_DETAILS);
selectMenuPath(FIRST_ITEM_DETAILS);

// this will throw before assertNull
assertNull(getGridElement().getDetails(0));
getGridElement().getDetails(0);
}

@Test
@@ -120,6 +118,31 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
details.findElement(By.className("v-widget")));
}

@Test(expected = NoSuchElementException.class)
public void scrollingDoesNotCreateAFloodOfDetailsRows() {
selectMenuPath(CUSTOM_DETAILS_GENERATOR);

// scroll somewhere to hit uncached rows
getGridElement().scrollToRow(101);

// this should throw
getGridElement().getDetails(100);
}

@Test
public void openingDetailsOutOfView() {
getGridElement().scrollToRow(500);

selectMenuPath(CUSTOM_DETAILS_GENERATOR);
selectMenuPath(FIRST_ITEM_DETAILS);

getGridElement().scrollToRow(0);

// if this fails, it'll fail before the assertNotNull
assertNotNull("unexpected null details row", getGridElement()
.getDetails(0));
}

@Test
public void togglingAVisibleDetailsRowWithOneRoundtrip() {
selectMenuPath(CUSTOM_DETAILS_GENERATOR);

Loading…
Cancel
Save