]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for handling a breakpoint with 0 as the lower bound (#13588)
authorTeemu Pòˆntelin <teemu@vaadin.com>
Sun, 1 Jun 2014 20:57:25 +0000 (23:57 +0300)
committerVaadin Code Review <review@vaadin.com>
Mon, 2 Jun 2014 17:07:47 +0000 (17:07 +0000)
Added explicit isNaN checks to the results of parseInt function
because JavaScript would always convert 0 to false.

Change-Id: Ic904c321c0195ce50d9a498005459425b0c30d4c

client/src/com/vaadin/client/extensions/ResponsiveConnector.java
uitest/src/com/vaadin/tests/extensions/ResponsiveUITest.java

index b2230a4846e31c8e9c7820eb2b58b4777f059237..1392a1a49a3bf98ee696a870ff9f5fa778614836 100644 (file)
@@ -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];
                 }
index 6827bd0a5d89ddece5dd17f6e4a8af8494ea22a5..f7cbd9477c5c3e621f46308e1dc2f19b26ae0055 100644 (file)
@@ -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) {