-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add RouterLayout as bean classes (#85)
Currently RouterLayout implementations are ignored by CDI in Quarkus This change specify RouterLayout implementors as additional bean classes to be analyzed during bean discovery. Fixes #75
- Loading branch information
1 parent
500c8e9
commit 8b8e795
Showing
4 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...common-test-code/src/main/java/com/vaadin/flow/quarkus/it/layout/LayoutWithInjection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.vaadin.flow.quarkus.it.layout; | ||
|
||
import javax.inject.Inject; | ||
|
||
import com.vaadin.flow.component.AttachEvent; | ||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.component.html.Span; | ||
import com.vaadin.flow.quarkus.it.Counter; | ||
import com.vaadin.flow.router.RouterLayout; | ||
|
||
public class LayoutWithInjection extends Div implements RouterLayout { | ||
|
||
public static final String LAYOUT_COUNTER_ID = "layoutCounter"; | ||
|
||
@Inject | ||
Counter counter; | ||
|
||
@Override | ||
protected void onAttach(AttachEvent attachEvent) { | ||
int value = counter.increment(LayoutWithInjection.class.getName()); | ||
Span span = new Span("Counter: " + value); | ||
span.setId(LAYOUT_COUNTER_ID); | ||
getElement().appendChild(span.getElement()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...on-test-code/src/main/java/com/vaadin/flow/quarkus/it/layout/LayoutWithInjectionView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.vaadin.flow.quarkus.it.layout; | ||
|
||
import com.vaadin.flow.component.html.Div; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@Route(value = "injected-layout-view", layout = LayoutWithInjection.class) | ||
public class LayoutWithInjectionView extends Div { | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...ests/common-test-code/src/test/java/com/vaadin/flow/quarkus/it/LayoutWithInjectionIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.vaadin.flow.quarkus.it; | ||
|
||
import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import com.vaadin.flow.quarkus.it.layout.LayoutWithInjection; | ||
|
||
@QuarkusIntegrationTest | ||
class LayoutWithInjectionIT extends AbstractCdiIT { | ||
|
||
@Override | ||
protected String getTestPath() { | ||
return "/injected-layout-view"; | ||
} | ||
|
||
@Test | ||
void layout_injectedComponent() { | ||
open(); | ||
WebElement spanElement = waitUntil(driver -> driver | ||
.findElement(By.id(LayoutWithInjection.LAYOUT_COUNTER_ID))); | ||
|
||
Assertions.assertEquals("Counter: 1", spanElement.getText()); | ||
} | ||
|
||
} |