Search in sources :

Example 1 with RootViewWithTheme

use of com.vaadin.flow.server.frontend.scanner.ScannerTestComponents.RootViewWithTheme in project flow by vaadin.

the class ScannerThemeTest method should_defaultToLumoTheme_when_noThemeDefinedByExporter.

@Test
public void should_defaultToLumoTheme_when_noThemeDefinedByExporter() throws Exception {
    // RootViewWithTheme is added to the list just to make sure exporter
    // handles theming default, not the other crawlers
    DefaultClassFinder finder = spy(new DefaultClassFinder(new HashSet<>(Arrays.asList(NoThemeExporter.class, RootViewWithTheme.class))));
    Mockito.doReturn(Theme4.class).when(finder).loadClass(FrontendDependencies.LUMO);
    FrontendDependencies deps = new FrontendDependencies(finder);
    assertEquals("Theme4 should have been returned when default theme was selected", Theme4.class, deps.getThemeDefinition().getTheme());
    assertTrue("Theme4 should have been visited and JsModule collected", deps.getModules().contains("./theme-4.js"));
}
Also used : DefaultClassFinder(com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder) NoThemeExporter(com.vaadin.flow.server.frontend.scanner.ScannerTestComponents.NoThemeExporter) RootViewWithTheme(com.vaadin.flow.server.frontend.scanner.ScannerTestComponents.RootViewWithTheme) ScannerDependenciesTest.getFrontendDependencies(com.vaadin.flow.server.frontend.scanner.ScannerDependenciesTest.getFrontendDependencies) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

DefaultClassFinder (com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder)1 ScannerDependenciesTest.getFrontendDependencies (com.vaadin.flow.server.frontend.scanner.ScannerDependenciesTest.getFrontendDependencies)1 NoThemeExporter (com.vaadin.flow.server.frontend.scanner.ScannerTestComponents.NoThemeExporter)1 RootViewWithTheme (com.vaadin.flow.server.frontend.scanner.ScannerTestComponents.RootViewWithTheme)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1