diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-20 14:07:14 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-20 14:08:51 +0300 |
commit | 2079e8525df2b12aa8f1103755c91ec2ab1fca95 (patch) | |
tree | 59a22f56d1096f4ef96bc8a969f0bf99c0f5e829 /uitest/src/com/vaadin/tests/navigator | |
parent | 6b28dc7bf41b8590fcab3d60afd5aa407f1f1401 (diff) | |
download | vaadin-framework-2079e8525df2b12aa8f1103755c91ec2ab1fca95.tar.gz vaadin-framework-2079e8525df2b12aa8f1103755c91ec2ab1fca95.zip |
Add a means to handle missing views in Navigator (#9060)
Diffstat (limited to 'uitest/src/com/vaadin/tests/navigator')
-rw-r--r-- | uitest/src/com/vaadin/tests/navigator/NavigatorTest.html | 55 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/navigator/NavigatorTest.java | 11 |
2 files changed, 61 insertions, 5 deletions
diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html index 8c4e8f657b..030b30f37a 100644 --- a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html @@ -17,6 +17,11 @@ <td></td> </tr> <tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> + <td>1. Navigated to DefaultView with params</td> +</tr> +<tr> <td>click</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> @@ -24,7 +29,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> - <td>1. Navigated to ListView with params</td> + <td>2. Navigated to ListView with params</td> </tr> <tr> <td>assertLocation</td> @@ -39,7 +44,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> - <td>2. Navigated to EditView with params</td> + <td>3. Navigated to EditView with params</td> </tr> <tr> <td>assertLocation</td> @@ -64,7 +69,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> - <td>3. Navigated to ListView with params param=value</td> + <td>4. Navigated to ListView with params param=value</td> </tr> <tr> <td>assertLocation</td> @@ -79,7 +84,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> - <td>4. Navigated to EditView with params param=value</td> + <td>5. Navigated to EditView with params param=value</td> </tr> <tr> <td>assertLocation</td> @@ -94,13 +99,53 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> - <td>5. Prevent navigation to ForbiddenView</td> + <td>6. Prevent navigation to ForbiddenView</td> </tr> <tr> <td>assertLocation</td> <td>*#!edit/param=value</td> <td></td> </tr> +<tr> + <td>runScript</td> + <td>window.location.hash='!foo'</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> + <td>7. View 'foo' not found!</td> +</tr> +<tr> + <td>assertLocation</td> + <td>*#!foo</td> + <td></td> +</tr> +<tr> + <td>runScript</td> + <td>window.location.hash='foo'</td> + <td></td> +</tr> +<tr> + <td>pause</td> + <td>1000</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0]</td> + <td>8. Navigated to DefaultView with params</td> +</tr> +<tr> + <td>assertLocation</td> + <td>*#foo</td> + <td></td> +</tr> </tbody></table> </body> diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java index 4986bd21e6..a3f7ce9f5b 100644 --- a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java @@ -74,6 +74,15 @@ public class NavigatorTest extends UI { } } + class ErrorView extends Label implements View { + @Override + public void enter(ViewChangeEvent event) { + log.log("View '" + event.getViewName() + "' not found!"); + setValue("Tried to navigate to " + event.getViewName() + + " but such a view could not be found :("); + } + } + class NaviListener implements ViewChangeListener { @Override @@ -114,6 +123,8 @@ public class NavigatorTest extends UI { navi.addViewChangeListener(new NaviListener()); + navi.setErrorView(new ErrorView()); + navi.navigate(); addComponent(new NaviButton("list")); |