Skip to content

Commit

Permalink
test: Test reusable custom theme with embedded application (#9831)
Browse files Browse the repository at this point in the history
Add a reusable theme module for embedded tests.
Add module to test using reusable theme from
dependency with embedded application.

Fixes: #9828
# Conflicts:
#	flow-tests/test-embedding/pom.xml
  • Loading branch information
caalador authored and pleku committed Mar 8, 2021
1 parent 382482b commit c10f170
Show file tree
Hide file tree
Showing 19 changed files with 615 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flow-tests/test-application-theme/reusable-theme/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>test-application-theme</artifactId>
<groupId>com.vaadin</groupId>
<version>6.0-SNAPSHOT</version>
<version>2.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
66 changes: 66 additions & 0 deletions flow-tests/test-embedding/embedding-reusable-custom-theme/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2000-2021 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>test-embedding</artifactId>
<groupId>com.vaadin</groupId>
<version>2.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>flow-reusable-embedded-theme</artifactId>
<packaging>jar</packaging>
<name>Reusable custom theme for Flow Embedding test</name>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skipITs>true</skipITs>
</configuration>
</plugin>

<!-- Export the test-jar so it can be used by other modules -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<finalName>${project.artifactId}</finalName>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

package com.vaadin.reusabletheme;

import com.vaadin.flow.component.dependency.NpmPackage;

@NpmPackage(value = "@fortawesome/fontawesome-free", version = "5.15.1")
public class Dependency {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[part='radio'] {
background-color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[part="input-field"] {
background: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@font-face {
font-family: "Ostrich";
src: url("./font/ostrich-sans-regular.ttf") format("TrueType");
}

.global {
color: blue;
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:host {
width: 1200px;
height: 600px;
display: block;
background-image: url("./img/bg.jpg");
font-family: "Ostrich";
}

.internal {
color: green;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"documentCss": ["@fortawesome/fontawesome-free/css/all.css"],
"assets": {
"@fortawesome/fontawesome-free": {
"svgs/regular/**": "fortawesome/icons"
}
}
}
5 changes: 4 additions & 1 deletion flow-tests/test-embedding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@
<module>test-embedding-generic</module>
<module>test-embedding-theme-variant</module>
<module>test-embedding-production-mode</module>
<module>test-embedding-application-theme</module>

<!-- compatibility -->
<module>test-embedding-generic-compatibility</module>
<module>test-embedding-theme-variant-compatibility</module>
<module>test-embedding-production-mode-compatibility</module>
<!-- Custom theme tests -->
<module>test-embedding-application-theme</module>
<module>embedding-reusable-custom-theme</module>
<module>test-embedding-reusable-theme</module>
</modules>
</project>
122 changes: 122 additions & 0 deletions flow-tests/test-embedding/test-embedding-reusable-theme/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2000-2019 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>test-embedding</artifactId>
<groupId>com.vaadin</groupId>
<version>2.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>test-embedding-reusable-theme</artifactId>
<packaging>war</packaging>
<name>Flow Embedding resuable application theme tests</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-lumo-theme</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-html-components-testbench</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-reusable-embedded-theme</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<!-- This module is mapped to default web context -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<!-- do not allow faulty app shell annotations for module -->
<!-- This should be removed when flow-tests do not break app shell annotation-->
<!-- flow-tests should not allow faulty annotations -->
<configuration>
<systemProperties>
<systemProperty>
<name>vaadin.allow.appshell.annotations</name>
<value>false</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>

<plugin>
<groupId>com.vaadin</groupId>
<artifactId>flow-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>local-run</id>
<activation>
<property>
<name>!test.use.hub</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>${driver.binary.downloader.maven.plugin.version}</version>
<configuration>
<onlyGetDriversForHostOperatingSystem>true</onlyGetDriversForHostOperatingSystem>
<rootStandaloneServerDirectory>${project.rootdir}/driver</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>${project.rootdir}/driver_zips</downloadedZipFileDirectory>
<customRepositoryMap>${project.rootdir}/drivers.xml</customRepositoryMap>
</configuration>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2020 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.flow.webcomponent;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;

/**
* LIT version of vaadin radio button for testing component theming.
*/
@JsModule("@vaadin/vaadin-radio-button/vaadin-radio-button.js")
@Tag("vaadin-radio-button")
@NpmPackage(value = "@vaadin/vaadin-radio-button", version = "2.0.0-alpha1")
public class MyLitField extends Component {

/**
* Set the component id.
*
* @param id
* value to set
* @return this component
*/
public Component withId(String id) {
setId(id);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2020 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.flow.webcomponent;

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;

/**
* Polymer version of vaadin text field for testing component theming.
*/
@JsModule("@vaadin/vaadin-text-field/vaadin-text-field.js")
@Tag("vaadin-text-field")
@NpmPackage(value="@vaadin/vaadin-text-field", version = "2.7.1")
public class MyPolymerField extends Component {

/**
* Set the component id.
*
* @param id
* value to set
* @return this component
*/
public Component withId(String id) {
setId(id);
return this;
}
}
Loading

0 comments on commit c10f170

Please sign in to comment.