diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-08-02 10:20:40 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-08-02 10:20:46 +0300 |
commit | d97cfbc9a1409582bbe4456f08f648921b7e3300 (patch) | |
tree | 35f60cb64968d342f28540db4e37a8205b82cd8f /uitest | |
parent | f5872981ddf8ff274a12ee59d7a0116e61bde602 (diff) | |
download | vaadin-framework-d97cfbc9a1409582bbe4456f08f648921b7e3300.tar.gz vaadin-framework-d97cfbc9a1409582bbe4456f08f648921b7e3300.zip |
Refine handling of null and empty URI fragments (#12207)
Change-Id: Ie133694b010a586c6336e9b04be7bcd94d2525e9
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.html | 61 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java | 15 |
2 files changed, 75 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.html b/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.html index bcb9f52afe..ba24b55f64 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.html +++ b/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.html @@ -71,7 +71,66 @@ <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> <td>Current URI fragment: test</td> </tr> - +<!--Open other URL in between to ensure the page is loaded again (testbench doesn't like opening a URI that only changes the fragment)--> +<tr> + <td>open</td> + <td>/run/</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.ui.UriFragmentTest?restartApplication</td> + <td></td> +</tr> +<!--Empty initial fragment--> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>No URI fragment set</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Still no # after setting to null--> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>No URI fragment set</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Empty # is added when setting to ""--> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Current URI fragment:</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Current URI fragment: test</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<!--Setting to null when there is a fragment actually sets it to #--> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsuiUriFragmentTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td> + <td>Current URI fragment:</td> +</tr> </tbody></table> </body> </html> diff --git a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java b/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java index 2172b00ee3..bfd784280a 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java @@ -29,6 +29,21 @@ public class UriFragmentTest extends AbstractTestUI { getPage().setUriFragment("test"); } })); + + addComponent(new Button("Navigate to #", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + getPage().setUriFragment(""); + } + })); + + addComponent(new Button("setUriFragment(null)", + new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + getPage().setUriFragment(null); + } + })); } private void updateLabel() { |