diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-08-09 16:36:39 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-08-09 16:39:37 +0300 |
commit | 2b0cb55ef291f8f8a95e45c4afa87ca3b2e650b8 (patch) | |
tree | 0cba80f2bb10e5eb1e933be3a539a372753ad9b1 /tests/testbench/com | |
parent | bfaf549a7814cfabbc6ce95b6c865d0fff0b5ead (diff) | |
download | vaadin-framework-2b0cb55ef291f8f8a95e45c4afa87ca3b2e650b8.tar.gz vaadin-framework-2b0cb55ef291f8f8a95e45c4afa87ca3b2e650b8.zip |
Add an API for modifying the bootstrap page. (#9274)
Diffstat (limited to 'tests/testbench/com')
3 files changed, 92 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModify.html b/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModify.html new file mode 100644 index 0000000000..d5ab5af108 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModify.html @@ -0,0 +1,31 @@ +<?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="" /> +<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.vaadincontext.BoostrapModifyRoot?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsvaadincontextBoostrapModifyRoot::/VVerticalLayout[0]/VLabel[0]</td> + <td>There should be a static h1 in the HTML of the bootstrap page for this Root</td> +</tr> +<tr> + <td>assertText</td> + <td>//h1</td> + <td>This is a heading</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModifyRoot.java b/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModifyRoot.java new file mode 100644 index 0000000000..3af096ff37 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/vaadincontext/BoostrapModifyRoot.java @@ -0,0 +1,28 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.vaadincontext; + +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.tests.components.AbstractTestRoot; + +public class BoostrapModifyRoot extends AbstractTestRoot { + + @Override + protected void setup(WrappedRequest request) { + // TODO Auto-generated method stub + + } + + @Override + protected String getTestDescription() { + return "There should be a static h1 in the HTML of the bootstrap page for this Root"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(9274); + } + +} diff --git a/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java b/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java new file mode 100644 index 0000000000..fa2767a023 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java @@ -0,0 +1,33 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.vaadincontext; + +import com.vaadin.terminal.gwt.server.BootstrapListener; +import com.vaadin.terminal.gwt.server.BootstrapResponse; +import com.vaadin.terminal.gwt.server.VaadinContextEvent; +import com.vaadin.terminal.gwt.server.VaadinContextListener; +import com.vaadin.ui.Root; + +public class TestVaadinContextListener implements VaadinContextListener { + @Override + public void contextCreated(VaadinContextEvent event) { + event.getVaadinContext().addBootstrapListener(new BootstrapListener() { + @Override + public void modifyBootstrap(BootstrapResponse response) { + Root root = response.getRoot(); + if (root != null && root.getClass() == BoostrapModifyRoot.class) { + response.getApplicationTag().before( + "<h1>This is a heading</h1>"); + } + } + }); + } + + @Override + public void contextDestoryed(VaadinContextEvent event) { + // Nothing to do + } + +} |