|
37 | 37 | import com.vaadin.flow.router.BeforeEnterEvent; |
38 | 38 | import com.vaadin.flow.router.ErrorParameter; |
39 | 39 | import com.vaadin.flow.router.HasErrorParameter; |
| 40 | +import com.vaadin.flow.router.Layout; |
40 | 41 | import com.vaadin.flow.router.NotFoundException; |
41 | 42 | import com.vaadin.flow.router.Route; |
| 43 | +import com.vaadin.flow.router.RouterLayout; |
42 | 44 | import com.vaadin.flow.server.UIInitListener; |
43 | 45 | import com.vaadin.flow.server.VaadinServiceInitListener; |
44 | 46 | import com.vaadin.flow.server.frontend.scanner.samples.ErrorComponent; |
@@ -280,6 +282,24 @@ public void classInMultipleEntryPoints_collectEntryPointsNotOverrideInitial() { |
280 | 282 | "@vaadin/common-frontend/ConnectionIndicator.js"); |
281 | 283 | } |
282 | 284 |
|
| 285 | + @Test // 20074 |
| 286 | + public void layoutClasses_collectedAsEntrypoint() { |
| 287 | + Mockito.when(classFinder.getAnnotatedClasses(Layout.class)) |
| 288 | + .thenReturn(Collections.singleton(MainLayout.class)); |
| 289 | + |
| 290 | + FrontendDependencies dependencies = new FrontendDependencies( |
| 291 | + classFinder, false); |
| 292 | + |
| 293 | + Optional<EntryPointData> layoutEndpointData = dependencies |
| 294 | + .getEntryPoints().stream().filter(entryPoint -> entryPoint |
| 295 | + .getName().equals(MainLayout.class.getName())) |
| 296 | + .findAny(); |
| 297 | + Assert.assertTrue("MainLayout should be visited", |
| 298 | + layoutEndpointData.isPresent()); |
| 299 | + DepsTests.assertImports(dependencies.getModules(), "reference.js", |
| 300 | + "@vaadin/common-frontend/ConnectionIndicator.js"); |
| 301 | + } |
| 302 | + |
283 | 303 | @Test // #9861 |
284 | 304 | public void visitedExporter_previousEntryPointsNotOverridden() |
285 | 305 | throws InstantiationException, IllegalAccessException { |
@@ -504,4 +524,9 @@ public static class ChildRoute extends ParentRoute { |
504 | 524 | public static class GrandChildRoute extends ChildRoute { |
505 | 525 | } |
506 | 526 |
|
| 527 | + @Tag("div") |
| 528 | + @Layout |
| 529 | + @JsModule("reference.js") |
| 530 | + public static class MainLayout extends Component implements RouterLayout { |
| 531 | + } |
507 | 532 | } |
0 commit comments