diff options
author | Leif Åstrand <legioth@gmail.com> | 2017-04-13 13:30:28 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-04-13 12:30:28 +0200 |
commit | 7d4595c25cc510d36eef2c327a57d45c44b192dd (patch) | |
tree | e6cffe97771a19cb3b6228c811e17fb7839eb4d5 /uitest | |
parent | a4a4d9e064f06ad4cdc2801db75955872a3acf45 (diff) | |
download | vaadin-framework-7d4595c25cc510d36eef2c327a57d45c44b192dd.tar.gz vaadin-framework-7d4595c25cc510d36eef2c327a57d45c44b192dd.zip |
Add LoadStyle.NONE for completely omitting a connector
Diffstat (limited to 'uitest')
4 files changed, 131 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/NoneLoadStyleConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/NoneLoadStyleConnector.java new file mode 100644 index 0000000000..b15ad5b661 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/NoneLoadStyleConnector.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.widgetset.client; + +import com.google.gwt.user.client.ui.Label; +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.Connect.LoadStyle; +import com.vaadin.tests.widgetset.server.NoneLoadStyleComponent; + +@Connect(value = NoneLoadStyleComponent.class, loadStyle = LoadStyle.NONE) +public class NoneLoadStyleConnector extends AbstractComponentConnector { + + @Override + protected void init() { + super.init(); + + getWidget().setText(NoneLoadStyleConnector.class.getSimpleName()); + } + + @Override + public Label getWidget() { + return (Label) super.getWidget(); + } +} diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyle.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyle.java new file mode 100644 index 0000000000..886956344c --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyle.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.widgetset.server; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; + +@Widgetset(TestingWidgetSet.NAME) +public class NoneLoadStyle extends AbstractTestUI { + + @Override + protected String getTestDescription() { + return NoneLoadStyleComponent.class.getName() + + " should resolve to UnknownComponentConnector"; + } + + @Override + protected void setup(VaadinRequest request) { + NoneLoadStyleComponent component = new NoneLoadStyleComponent(); + component.setId("component"); + addComponent(component); + } +} diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyleComponent.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyleComponent.java new file mode 100644 index 0000000000..4599848f24 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/NoneLoadStyleComponent.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.widgetset.server; + +import com.vaadin.ui.AbstractComponent; + +public class NoneLoadStyleComponent extends AbstractComponent { + +} diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java new file mode 100644 index 0000000000..ce1829796a --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/NoneLoadStyleTest.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.widgetset.server; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class NoneLoadStyleTest extends SingleBrowserTest { + @Test + public void connectorNotLoaded() { + openTestURL(); + + String componentText = findElement(By.id("component")).getText(); + + Assert.assertTrue(componentText.contains("does not contain")); + } +} |