Search in sources :

Example 1 with DefaultPageTitleGenerator

use of com.vaadin.flow.router.legacy.DefaultPageTitleGenerator in project flow by vaadin.

the class ViewRendererTest method testViewTitle_customPageTitle_generator_isAlwaysUsed.

@Test
public void testViewTitle_customPageTitle_generator_isAlwaysUsed() {
    setPageTitleGenerator(lce -> "foobar");
    new TestViewRenderer(DynamicTitleView.class).handle(dummyEvent);
    verifyViewTitleUpdate("foobar");
    setPageTitleGenerator(lce -> "akbar");
    new TestViewRenderer(AnotherTestView.class).handle(dummyEvent);
    verifyViewTitleUpdate("akbar");
    setPageTitleGenerator(new DefaultPageTitleGenerator());
    new TestViewRenderer(DynamicTitleView.class).handle(dummyEvent);
    verifyViewTitleUpdate(DYNAMIC_VIEW_TITLE);
}
Also used : DefaultPageTitleGenerator(com.vaadin.flow.router.legacy.DefaultPageTitleGenerator) Test(org.junit.Test)

Example 2 with DefaultPageTitleGenerator

use of com.vaadin.flow.router.legacy.DefaultPageTitleGenerator in project flow by vaadin.

the class ViewRendererTest method testViewTitle_customPageTitle_generator_isAlwaysUsed.

@Test
public void testViewTitle_customPageTitle_generator_isAlwaysUsed() {
    setPageTitleGenerator(lce -> "foobar");
    new TestViewRenderer(DynamicTitleView.class).handle(dummyEvent);
    verifyViewTitleUpdate("foobar");
    setPageTitleGenerator(lce -> "akbar");
    new TestViewRenderer(AnotherTestView.class).handle(dummyEvent);
    verifyViewTitleUpdate("akbar");
    setPageTitleGenerator(new DefaultPageTitleGenerator());
    new TestViewRenderer(DynamicTitleView.class).handle(dummyEvent);
    verifyViewTitleUpdate(DYNAMIC_VIEW_TITLE);
}
Also used : DefaultPageTitleGenerator(com.vaadin.flow.router.legacy.DefaultPageTitleGenerator) TestViewRenderer(com.vaadin.flow.router.legacy.TestViewRenderer) Test(org.junit.Test)

Aggregations

DefaultPageTitleGenerator (com.vaadin.flow.router.legacy.DefaultPageTitleGenerator)2 Test (org.junit.Test)2 TestViewRenderer (com.vaadin.flow.router.legacy.TestViewRenderer)1