From: David ‘Bombe’ Roden Date: Fri, 17 May 2019 09:10:30 +0000 (+0200) Subject: ✨ Annotate IndexPage with MenuName X-Git-Tag: v79^2~46 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=125dab18d4412f547334f4fa2b27e5f7676eec5c;p=Sone.git ✨ Annotate IndexPage with MenuName --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt index f44b145..68e7e8f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -14,6 +14,7 @@ import javax.inject.Inject * The index page shows the main page of Sone. This page will contain the posts * of all friends of the current user. */ +@MenuName("Index") class IndexPage @Inject constructor(template: Template, webInterface: WebInterface, private val postVisibilityFilter: PostVisibilityFilter) : LoggedInPage("index.html", template, "Page.Index.Title", webInterface) { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt index 39be2d6..07eb64a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/IndexPageTest.kt @@ -159,4 +159,9 @@ class IndexPageTest: WebPageTest({ template, webInterface -> IndexPage(template, assertThat(baseInjector.getInstance(), notNullValue()) } + @Test + fun `page is annotated with correct menuname`() { + assertThat(page.menuName, equalTo("Index")) + } + } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt index d48f5fd..5c842df 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt @@ -54,6 +54,8 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag val sessionManager = mock() val page by lazy { pageSupplier(template, webInterface) } + val SoneTemplatePage.menuName get() = javaClass.getAnnotation(MenuName::class.java)?.value + val httpRequest = mock() val freenetRequest = mock() init {