Fixes #10437tags/8.12.0.alpha2
margin-left: 0; | margin-left: 0; | ||||
} | } | ||||
&:not([aria-hidden="true"]) ~ td .v-caption { | |||||
margin-left: round($v-unit-size/2); | |||||
} | |||||
&:focus { | &:focus { | ||||
outline: none; | outline: none; | ||||
margin-left: 0; | margin-left: 0; | ||||
} | } | ||||
:not([aria-hidden="true"]) ~ td .v-caption { | |||||
margin-left: $tab-spacing or first-number($v-border) * -1; | |||||
} | |||||
@if $frame-inactive-tabs { | @if $frame-inactive-tabs { | ||||
.#{$primary-stylename}-tabitem .v-caption { | .#{$primary-stylename}-tabitem .v-caption { | ||||
border-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5)); | border-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5)); |
package com.vaadin.tests.components.tabsheet; | |||||
import com.vaadin.server.VaadinRequest; | |||||
import com.vaadin.tests.components.AbstractTestUI; | |||||
import com.vaadin.ui.Button; | |||||
import com.vaadin.ui.Label; | |||||
import com.vaadin.ui.TabSheet; | |||||
import com.vaadin.ui.VerticalLayout; | |||||
public class TabNotVisibleInTheMiddleOfTabsheet extends AbstractTestUI { | |||||
private TabSheet.Tab secondTab; | |||||
@Override | |||||
protected void setup(VaadinRequest request) { | |||||
TabSheet tabSheet = new TabSheet(); | |||||
tabSheet.setWidth("600px"); | |||||
tabSheet.addTab(new Label("first visible tab"), "first visible tab"); | |||||
secondTab = tabSheet.addTab(new Label("second visible tab"), | |||||
"second visible tab"); | |||||
for (int i = 3; i < 10; i++) { | |||||
tabSheet.addTab(new Label("visible tab " + i), "visible tab " + i); | |||||
} | |||||
addComponent(new VerticalLayout(tabSheet, new Button( | |||||
"Toggle second tab", | |||||
event -> secondTab.setVisible(!secondTab.isVisible())))); | |||||
} | |||||
@Override | |||||
protected Integer getTicketNumber() { | |||||
return 10437; | |||||
} | |||||
@Override | |||||
protected String getTestDescription() { | |||||
return "First and third tab should have the usual gap " | |||||
+ "between them when second tab gets hidden."; | |||||
} | |||||
} |
package com.vaadin.tests.components.tabsheet; | |||||
import static org.junit.Assert.assertEquals; | |||||
import static org.junit.Assert.assertFalse; | |||||
import java.util.List; | |||||
import org.junit.Test; | |||||
import org.openqa.selenium.WebElement; | |||||
import com.vaadin.testbench.By; | |||||
import com.vaadin.testbench.elements.ButtonElement; | |||||
import com.vaadin.testbench.elements.TabSheetElement; | |||||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||||
public class TabNotVisibleInTheMiddleOfTabsheetTest extends MultiBrowserTest { | |||||
@Test | |||||
public void testFirstTabIsVisibleAfterBeingInvisible() { | |||||
openTestURL(); | |||||
TabSheetElement tabSheet = $(TabSheetElement.class).first(); | |||||
List<WebElement> captionElements = tabSheet | |||||
.findElements(By.className("v-caption")); | |||||
int secondPosition = captionElements.get(1).getLocation().getX(); | |||||
int thirdPosition = captionElements.get(2).getLocation().getX(); | |||||
assertGreater( | |||||
"Third tab should be further than the second tab: " | |||||
+ thirdPosition + " vs. " + secondPosition, | |||||
thirdPosition, secondPosition); | |||||
toggleSecondTabVisibility(); | |||||
assertFalse("TabSheet should not have second tab visible", | |||||
captionElements.get(1).isDisplayed()); | |||||
thirdPosition = captionElements.get(2).getLocation().getX(); | |||||
assertEquals("Third tab should be where second tab was:", | |||||
secondPosition, thirdPosition); | |||||
} | |||||
private void toggleSecondTabVisibility() { | |||||
$(ButtonElement.class).caption("Toggle second tab").first().click(); | |||||
} | |||||
} |