Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for setting global font #9436

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
6 changes: 6 additions & 0 deletions flow-tests/test-themes/frontend/theme/app-theme/global.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@font-face {
font-family: "Ostrich";
src: url("theme/app-theme/font/ostrich-sans-regular.ttf") format("TrueType");
}

body {
background-image: url('theme/app-theme/img/bg.jpg');
font-family: "Ostrich";
pleku marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.router.Route;

@Route("com.vaadin.flow.uitest.ui.theme.Theme")
@Route("com.vaadin.flow.uitest.ui.theme.ThemeView")
public class ThemeView extends Div {

public static final String TEST_TEXT_ID = "test-text";

public ThemeView() {
add(new Span("This is the theme test view"));
final Span textSpan = new Span("This is the theme test view");
textSpan.setId(TEST_TEXT_ID);
add(textSpan);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testutil.ChromeBrowserTest;

Expand All @@ -40,9 +41,12 @@ public void applicationTheme_GlobalCss_isUsed() {
// No exception for bg-image should exist
checkLogsForErrors();

final WebElement body = findElement(By.tagName("body"));
Assert.assertEquals(
"url(\"" + getRootURL() + "/theme/app-theme/img/bg.jpg\")",
findElement(By.tagName("body")).getCssValue("background-image"));
body.getCssValue("background-image"));

Assert.assertEquals("Ostrich", body.getCssValue("font-family"));

getDriver().get(getRootURL() + "/theme/app-theme/img/bg.jpg");
Assert.assertFalse("app-theme background file should be served",
Expand Down