diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModel.kt index b2b1aa1c..28b59c51 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModel.kt @@ -16,6 +16,6 @@ class SoftwareSystemContainerSectionPageViewModel( companion object { fun url(container: Container, section: Section) = - "${url(container.softwareSystem, Tab.SECTIONS)}/${container.name.normalize()}/${section.order}" + "${url(container.softwareSystem, Tab.SECTIONS)}/${container.name.normalize()}/${section.contentTitle().normalize()}" } } diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModel.kt index 35f7a980..901e2deb 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModel.kt @@ -9,7 +9,7 @@ class SoftwareSystemContainerSectionsPageViewModel(generatorContext: GeneratorCo SoftwareSystemPageViewModel(generatorContext, container.softwareSystem, Tab.SECTIONS) { override val url = url(container) val sectionsTable = createSectionsTableViewModel(container.documentation.sections, dropFirst = false) { - "$url/${it.order}" + "$url/${it.contentTitle().normalize()}" } val visible = container.hasSections() diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModel.kt index 4509aaf7..45484f29 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModel.kt @@ -2,6 +2,7 @@ package nl.avisi.structurizr.site.generatr.site.model import com.structurizr.documentation.Section import com.structurizr.model.SoftwareSystem +import nl.avisi.structurizr.site.generatr.normalize import nl.avisi.structurizr.site.generatr.site.GeneratorContext class SoftwareSystemSectionPageViewModel( @@ -15,6 +16,6 @@ class SoftwareSystemSectionPageViewModel( companion object { fun url(softwareSystem: SoftwareSystem, section: Section) = - "${url(softwareSystem, Tab.SECTIONS)}/${section.order}" + "${url(softwareSystem, Tab.SECTIONS)}/${section.contentTitle().normalize()}" } } diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModel.kt index ed73b98a..85c18a01 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModel.kt @@ -3,12 +3,13 @@ package nl.avisi.structurizr.site.generatr.site.model import com.structurizr.model.SoftwareSystem import nl.avisi.structurizr.site.generatr.hasContainerDocumentationSections import nl.avisi.structurizr.site.generatr.hasDocumentationSections +import nl.avisi.structurizr.site.generatr.normalize import nl.avisi.structurizr.site.generatr.site.GeneratorContext class SoftwareSystemSectionsPageViewModel(generatorContext: GeneratorContext, softwareSystem: SoftwareSystem) : SoftwareSystemPageViewModel(generatorContext, softwareSystem, Tab.SECTIONS) { val sectionsTable = createSectionsTableViewModel(softwareSystem.documentation.sections) { - "$url/${it.order}" + "$url/${it.contentTitle().normalize()}" } private val containerSectionsVisible = softwareSystem.hasContainerDocumentationSections() diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModelTest.kt index f39aa053..52db2a0a 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionPageViewModelTest.kt @@ -19,7 +19,7 @@ class SoftwareSystemContainerSectionPageViewModelTest : ViewModelTest() { val viewModel = SoftwareSystemContainerSectionPageViewModel(generatorContext, container, section) assertThat(SoftwareSystemContainerSectionPageViewModel.url(container, section)) - .isEqualTo("/${softwareSystem.name.normalize()}/sections/${container.name.normalize()}/${section.order}") + .isEqualTo("/${softwareSystem.name.normalize()}/sections/${container.name.normalize()}/${section.contentTitle().normalize()}") assertThat(viewModel.url) .isEqualTo(SoftwareSystemContainerSectionPageViewModel.url(container, section)) } diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModelTest.kt index 1b622bf3..26acf4c7 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemContainerSectionsPageViewModelTest.kt @@ -35,7 +35,7 @@ class SoftwareSystemContainerSectionsPageViewModelTest : ViewModelTest() { LinkViewModel( viewModel, "Content", - "/software-system/sections/api-application/1" + "/software-system/sections/api-application/content" ) ) } diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModelTest.kt index 367f01f4..3b3fb759 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionPageViewModelTest.kt @@ -16,7 +16,7 @@ class SoftwareSystemSectionPageViewModelTest : ViewModelTest() { val viewModel = SoftwareSystemSectionPageViewModel(generatorContext, softwareSystem, section) assertThat(SoftwareSystemSectionPageViewModel.url(softwareSystem, section)) - .isEqualTo("/${softwareSystem.name.normalize()}/sections/${section.order}") + .isEqualTo("/${softwareSystem.name.normalize()}/sections/${section.contentTitle().normalize()}") assertThat(viewModel.url) .isEqualTo(SoftwareSystemSectionPageViewModel.url(softwareSystem, section)) } diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModelTest.kt index 5d054f07..ada2fd93 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemSectionsPageViewModelTest.kt @@ -1,6 +1,9 @@ package nl.avisi.structurizr.site.generatr.site.model +import assertk.all import assertk.assertThat +import assertk.assertions.hasSize +import assertk.assertions.index import assertk.assertions.isEqualTo import assertk.assertions.isFalse import nl.avisi.structurizr.site.generatr.normalize @@ -20,17 +23,22 @@ class SoftwareSystemSectionsPageViewModelTest : ViewModelTest() { @Test fun `sections table`() { - listOf("Section 0000", "Section 0001") + listOf("# Section 0000", "# Section 0001") .forEach { softwareSystem.documentation.addSection(createSection(it)) } val viewModel = SoftwareSystemSectionsPageViewModel(generatorContext, softwareSystem) - assertThat(viewModel.sectionsTable) - .isEqualTo( - viewModel.createSectionsTableViewModel(softwareSystem.documentation.sections) { - "/${softwareSystem.name.normalize()}/sections/2" - } - ) + assertThat(viewModel.sectionsTable.bodyRows).all { + hasSize(1) + index(0).transform { (it.columns[1] as TableViewModel.LinkCellViewModel).link } + .isEqualTo( + LinkViewModel( + viewModel, + "Section 0001", + "/software-system/sections/section-0001" + ) + ) + } } @Test