jkroepke/featurebook-js

View on GitHub
packages/featurebook-html/resources/feature.pug

Summary

Maintainability
Test Coverage
mixin printStep(step)
  div.featurebook-step
    span.featurebook-step-keyword= step.keyword
    span.featurebook-step-text= step.text
    if step.dataTable
      table.featurebook-data-table
        each row in step.dataTable.rows
          tr
            each cell in row.cells
              td= cell.value

    if step.docString
      pre.featurebook-doc-string= step.docString.content

include _layout.pug
div.featurebook-container
  include _metadata.pug
  include _spec-tree.pug

  main.featurebook-main
    each feature in features
      if feature.feature.tags
        each tag in feature.feature.tags
          div.featurebook-tag= tag.name

      div.featurebook-feature-name #{feature.feature.keyword}: #{feature.feature.name}

      div.featurebook-feature-description.featurebook-markdown !{feature.feature.description}

      if feature.feature.children
        each children in feature.feature.children
          if children.background
            div.featurebook-background
              div.featurebook-background-name #{children.background.keyword}: #{children.background.name}
              each step in children.background.steps
                +printStep(step)

          if children.scenario || children.scenarioOutline
            div.featurebook-scenario-definition
              if children.scenario.tags
                each tag in children.scenario.tags
                  div.featurebook-tag= tag.name
              div.featurebook-scenario-definition-name= children.scenario.keyword + ': ' + children.scenario.name
              div !{children.scenario.description}
              each step in children.scenario.steps
                +printStep(step)

              if children.scenario.examples
                each example in children.scenario.examples
                  div.featurebook-examples
                    div.featurebook-examples-name= example.keyword + ': ' + example.name
                    table.featurebook-data-table
                      tr
                        each cell in example.tableHeader.cells
                          th= cell.value
                      each row in example.tableBody
                        tr
                          each cell in row.cells
                            td= cell.value