From 54597654e13a2d2dd98fae14e762eb8e325ec514 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 14 Feb 2013 14:49:20 +0200 Subject: Fixed problem with removing the icon from a Button (#10543) Change-Id: Ia119b93643678494db95d36ffe031a44b76ba578 --- .../tests/components/button/ButtonToggleIcons.html | 72 ++++++++++++++++++++++ .../tests/components/button/ButtonToggleIcons.java | 38 ++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html create mode 100644 uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java (limited to 'uitest/src') diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html new file mode 100644 index 0000000000..642abd8120 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.html @@ -0,0 +1,72 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.button.ButtonToggleIcons?restartApplication
assertNotCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]v-icon
assertNotCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]v-icon
clickvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]v-icon
mouseClickvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]40,14
assertCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]v-icon
clickvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]
assertNotCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]v-icon
mouseClickvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]40,14
assertNotCSSClassvaadin=runcomvaadintestscomponentsbuttonButtonToggleIcons::/VVerticalLayout[0]/Slot[1]/VNativeButton[0]/domChild[0]v-icon
+ + diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java new file mode 100644 index 0000000000..626ed1d250 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java @@ -0,0 +1,38 @@ +package com.vaadin.tests.components.button; + +import com.vaadin.server.ThemeResource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class ButtonToggleIcons extends UI { + + @Override + protected void init(final VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + setContent(layout); + + final ThemeResource iconResource = new ThemeResource( + "../runo/icons/16/arrow-left.png"); + + final ClickListener iconToggleListener = new ClickListener() { + @Override + public void buttonClick(final ClickEvent event) { + final Button btn = event.getButton(); + if (btn.getIcon() == null) { + btn.setIcon(iconResource); + } else { + btn.setIcon(null); + } + } + }; + + layout.addComponent(new Button("Toggle icon", iconToggleListener)); + layout.addComponent(new NativeButton("Toggle icon", iconToggleListener)); + } +} \ No newline at end of file -- cgit v1.2.3