diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-10-02 08:04:04 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-02 08:04:04 +0000 |
commit | 88dbeb172c52bb5963616b67729618d55a8eb6b6 (patch) | |
tree | 72d683bedf198a485944c93e02a9ac24c9521056 /uitest | |
parent | 25b4d23647b1056097c2a4b2761bfe25d8928b7a (diff) | |
parent | afa50a4cb6a0ebef4ff396389daeb29d9ee7c60f (diff) | |
download | vaadin-framework-88dbeb172c52bb5963616b67729618d55a8eb6b6.tar.gz vaadin-framework-88dbeb172c52bb5963616b67729618d55a8eb6b6.zip |
Merge "Merged tests for initial fragment events (#9558)"
Diffstat (limited to 'uitest')
4 files changed, 223 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html b/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html new file mode 100644 index 0000000000..8276f0fd89 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html @@ -0,0 +1,37 @@ +<?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> diff --git a/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html b/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html new file mode 100644 index 0000000000..972d3d6143 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html @@ -0,0 +1,79 @@ +<?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> diff --git a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java new file mode 100644 index 0000000000..b4a7d4e181 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java @@ -0,0 +1,60 @@ +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; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html new file mode 100644 index 0000000000..933274eae6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html @@ -0,0 +1,47 @@ +<?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> |