--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:9999/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication#foo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td></td>
+</tr>
+<!--Changing the fragment to the initial fragment should not cause an event-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:9999/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication#initial</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td></td>
+</tr>
+<!--Reloading with the same fragment but without restartApplication should not cause any event-->
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.ui.InitialFragmentEvent#initial</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td></td>
+</tr>
+<!--Changing the fragment should cause an event-->
+<tr>
+ <td>runScript</td>
+ <td>window.location.hash='second'</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>500</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td>1. Fragment changed from "no event received" to second</td>
+</tr>
+<!--Clearing the fragment should cause an event-->
+<tr>
+ <td>runScript</td>
+ <td>window.location.hash=''</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>500</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td>2. Fragment changed from second to</td>
+</tr>
+</tbody></table>
+</body>
+</html>
--- /dev/null
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.Page.FragmentChangedEvent;
+import com.vaadin.server.Page.FragmentChangedListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class InitialFragmentEvent extends AbstractTestUI {
+
+ private String lastKnownFragment = "\"no event received\"";
+ private Log log = new Log(5);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ getPage().addFragmentChangedListener(new FragmentChangedListener() {
+
+ public void fragmentChanged(FragmentChangedEvent source) {
+ String newFragment = source.getFragment();
+ log.log("Fragment changed from " + lastKnownFragment + " to "
+ + newFragment);
+ lastKnownFragment = newFragment;
+ }
+ });
+ addComponent(log);
+ addComponent(new Button("Set fragment to 'foo'",
+ new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ setFragment("foo");
+ }
+ }));
+ addComponent(new Button("Set fragment to 'bar'",
+ new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ setFragment("bar");
+ }
+ }));
+ }
+
+ protected void setFragment(String fragment) {
+ getPage().setFragment(fragment);
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:9999/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication</td>
+ <td></td>
+</tr>
+<!--There is no fragment change event when the fragment is initially empty-->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td></td>
+</tr>
+<tr>
+ <td>runScript</td>
+ <td>window.location.hash='bar'</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>500</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0</td>
+ <td>1. Fragment changed from "no event received" to bar</td>
+</tr>
+</tbody></table>
+</body>
+</html>