@@ -0,0 +1,1576 @@
+package com.itmill.toolkit.tests.components.tabsheet;%0A%0Aimport com.itmill.toolkit.tests.components.TestBase;%0Aimport com.itmill.toolkit.ui.Button;%0Aimport com.itmill.toolkit.ui.HorizontalLayout;%0Aimport com.itmill.toolkit.ui.TabSheet;%0Aimport com.itmill.toolkit.ui.Button.ClickEvent;%0A%0Apublic class AddAndRemoveTabs extends TestBase %7B%0A    private TabSheet tabSheet;%0A%0A    private int counter = 0;%0A%0A    @Override%0A    public void setup() %7B%0A        tabSheet = new TabSheet();%0A        addTab();%0A        addComponent(tabSheet);%0A%0A        Button addTabBtn = new Button(%22Add new tab%22,%0A                new Button.ClickListener() %7B%0A%0A                    public void buttonClick(ClickEvent event) %7B%0A                        addTab();%0A                    %7D%0A%0A                %7D);%0A        addComponent(addTabBtn);%0A    %7D%0A%0A    private void addTab() %7B%0A        final HorizontalLayout layout = new HorizontalLayout();%0A        layout.setCaption(%22Test %22 + counter);%0A%0A        Button closeTab = new Button(%22Close tab%22, new Button.ClickListener() %7B%0A%0A            public void buttonClick(ClickEvent event) %7B%0A                tabSheet.removeComponent(layout);%0A%0A            %7D%0A%0A        %7D);%0A%0A        layout.addComponent(closeTab);%0A%0A        tabSheet.addComponent(layout);%0A        counter++;%0A    %7D%0A%0A    @Override%0A    protected String getDescription() %7B%0A        return %22Removing all tabs and then adding new tabs should work properly and without javascript errors. All new tabs should be displayed and not only the first one%22;%0A    %7D%0A%0A    @Override%0A    protected Integer getTicketNumber() %7B%0A        return 2861;%0A    %7D%0A%0A%7D%0A

Test case for #2861