Bladeren bron

Fix for handling a breakpoint with 0 as the lower bound (#13588)

Added explicit isNaN checks to the results of parseInt function
because JavaScript would always convert 0 to false.

Change-Id: Ic904c321c0195ce50d9a498005459425b0c30d4c
tags/7.3.0.alpha3
Teemu Pöntelin 10 jaren geleden
bovenliggende
commit
113c6321ea

+ 3
- 3
client/src/com/vaadin/client/extensions/ResponsiveConnector.java Bestand weergeven

@@ -383,15 +383,15 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements
var min = parseInt(bp[1]);
var max = parseInt(bp[2]);

if(min && max) {
if(!isNaN(min) && !isNaN(max)) {
if(min <= size && size <= max) {
ranges += " " + bp[1] + "-" + bp[2];
}
} else if (min) {
} else if (!isNaN(min)) {
if(min <= size) {
ranges += " " + bp[1] + "-";
}
} else if (max) {
} else if (!isNaN(max)) {
if (size <= max) {
ranges += " -" + bp[2];
}

+ 3
- 0
uitest/src/com/vaadin/tests/extensions/ResponsiveUITest.java Bestand weergeven

@@ -76,6 +76,9 @@ public class ResponsiveUITest extends MultiBrowserTest {
assertEquals("-200px",
$(".v-csslayout-grid.first").getAttribute("width-range"));

moveSplitter(-100);
assertEquals("0-100px",
$(".v-csslayout-grid.second").getAttribute("width-range"));
}

private void moveSplitter(int xOffset) {

Laden…
Annuleren
Opslaan