Added regression tests for navigation

See the change to `_config.yml` for how to activate the tests.
This commit is contained in:
PLanCompS 2020-08-13 16:52:30 +02:00
parent 591a3c2351
commit ca367e09d5
55 changed files with 798 additions and 18 deletions

View File

@ -19,7 +19,15 @@ baseurl: "/just-the-docs" # the subpath of your site, e.g. /blog
url: "https://pmarsceill.github.io" # the base hostname & protocol for your site, e.g. http://example.com
permalink: pretty
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile", "docs/tests/"]
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"
, "docs/tests/"
]
# Regression tests
# By default, the pages in /docs/tests are excluded when the ste is built.
# To include them, comment-out the relevant line above.
# Uncommenting the following line doesn't work - see https://github.com/jekyll/jekyll/issues/4791
# include: ["docs/tests/"]
# Set a path/url to a logo that will be displayed instead of the title
#logo: "/assets/images/just-the-docs.png"

View File

@ -1,11 +0,0 @@
---
layout: default
title: 42
search_exclude: true
---
# The answer is 42
A link to this page should appear in the navigation after all pages where
the `nav_order` value is a number, because titles are treated as strings
when used as default `nav_order`s.

16
docs/tests/index.md Normal file
View File

@ -0,0 +1,16 @@
---
layout: default
title: Tests
has_children: true
nav_order: 100
---
# Tests
The main documentation pages of this theme illustrate the use of many of its features, which to some extent tests their implementation. The pages linked below provide further test cases for particular features, and may be useful for regression testing when developing new features.
The default configuration does not include the test pages. To include them, add the following option to `_config.yml':
```yaml
include: ["docs/tests/"]
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Excluded Child
parent: Not Excluded
nav_exclude: true
---
# Excluded Child
This child page is explicitly excluded, and should not appear in the navigation.
```yaml
title: Excluded Child
parent: Not Excluded
nav_exclude: true
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: true
---
# Excluded Grandchild
This grandchild page is explicitly excluded, and should not appear in the navigation.
```yaml
title: Excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: true
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Excluded
has_children: true
nav_exclude: true
---
# Excluded
This top-level page is explicitly excluded, and should not appear in the navigation. Any child pages are implicitly excluded.
```yaml
title: Excluded
has_children: true
nav_exclude: true
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Non-excluded Child of Excluded
parent: Excluded
nav_exclude: false
---
# Non-excluded Child of Excluded
This child page is explicitly not excluded, but its parent page is excluded, so it should not appear in the navigation.
```yaml
title: Non-excluded Child of Excluded
parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Non-excluded Child
parent: Non-excluded
has_children: true
nav_exclude: false
---
# Non-excluded Child
This child page is explicitly not excluded, and should appear in the navigation.
```yaml
title: Non-excluded Child
parent: Non-excluded
nav_exclude: false
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
---
# Non-excluded Grandchild of Excluded
This grandchild page is explicitly not excluded, and neither is its parent page; but its grandparent page is excluded, so it should not appear in the navigation.
```yaml
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,17 @@
---
layout: default
title: Non-excluded Grandchild
parent: Non-excluded Child
grand_parent: Non-excluded
nav_exclude: false
---
# Non-excluded Grandchild
This grandchild page is explicitly not excluded, and neither is its parent page nor its grandparent page, so it should appear in the navigation.
```yaml
title: Non-excluded Grandchild of Excluded
parent: Non-excluded Child
grand_parent: Excluded
nav_exclude: false
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: Non-excluded
has_children: true
nav_exclude: false
---
# Non-excluded
This top-level page is explicitly not excluded, and should appear in the navigation.
```yaml
title: Non-excluded
nav_exclude: false
```

View File

@ -0,0 +1,6 @@
---
layout: default
---
# Untitled
This page has no `title`, and should not appear in the navigation.

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
has_children: true
---
# A
A top-level page
```yaml
title: A
has_children: true
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: B
has_children: true
---
# B
A top-level page
```yaml
title: B
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: C
parent: A
has_children: true
---
# C
A child of page A, and parent of page D
```yaml
title: C
parent: A
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: C
parent: B
has_children: true
---
# C
A child of page B, and parent of page D
```yaml
title: C
parent: B
has_children: true
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: D
parent: C
grand_parent: A
---
# D
A grandchild of page A
```yaml
title: D
parent: C
grand_parent: A
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: D
parent: C
grand_parent: B
---
# D
A grandchild of page B
```yaml
title: D
parent: C
grand_parent: B
```

View File

@ -0,0 +1,28 @@
---
layout: default
title: Navigation
parent: Tests
---
# Navigation
## Parent page disambiguation
- [Page A](grandparent/a/) has a child [page with title C](grandparent/ca/), and a grandchild [page with title D](grandparent/dca/).
- [Page B](grandparent/b/) has a child [page with title C](grandparent/cb/), and a grandchild [page with title D](grandparent/dcb/).
- The grandchild pages specify their parent and grandparent pages, so there is no ambiguity.
## Page exclusion
- An [untitled page](exclude/untitled/) is excluded from the navigation.
- An excluded [top level page](exclude/excluded/), [child page](exclude/excluded-child/), or [grandchild page](exclude/excluded-grandchild/) does not appear.
- A non-excluded [top level page](exclude/non-excluded/) appears; and a non-excluded [child page](exclude/non-excluded-child/) or [grandchild page](exclude/non-excluded-grandchild/) appears if its parent appears.
- A non-excluded child page or grandchild page does not appear if its parent is excluded.
## Page order
- [Default](order/default/), using `title` instead of `nav_order` fields.
- [Strings](order/strings/), lexicographically ordered, possibly case-insensitively.
- [Integers](order/integers/), numerically ordered.
- [Floats](order/floats/), numerically ordered.
- [Mixture](order/mixture/), with numbers before strings.

View File

@ -0,0 +1,14 @@
---
layout: default
title: "10"
parent: Default
grand_parent: Order
---
# 10
```yaml
title: "10"
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "2"
parent: Default
grand_parent: Order
---
# 2
```yaml
title: "2"
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
parent: Default
grand_parent: Order
---
# A
```yaml
title: A
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: aa
parent: Default
grand_parent: Order
---
# aa
```yaml
title: aa
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: Aa
parent: Default
grand_parent: Order
---
# Aa
```yaml
title: Aa
parent: Default
grand_parent: Order
```

View File

@ -0,0 +1,15 @@
---
layout: default
title: Default
parent: Order
nav_order: 1
has_children: true
---
# Default Order
When `nav_order` fields are omitted, the pages are ordered alphabetically by their titles.
By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case).
Digits precede letters, and numeric titles are ordered lexicographically: `10` precedes `2` (in contrast to explicit numeric `nav_order` values).

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1.1"
nav_order: -1.1
parent: Floats
grand_parent: Order
---
# -1.1
```yaml
title: "-1.1"
nav_order: -1.1
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0.0"
nav_order: 0.0
parent: Floats
grand_parent: Order
---
# 0.0
```yaml
title: "0.0"
nav_order: 0.0
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10.0"
nav_order: 10.0
parent: Floats
grand_parent: Order
---
# 10.0
```yaml
title: "10.0"
nav_order: 10.0
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2.2222"
nav_order: 2.2222
parent: Floats
grand_parent: Order
---
# 2.2222
```yaml
title: "2.2222"
nav_order: 2.2222
parent: Floats
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Floats
parent: Order
nav_order: 4
has_children: true
---
# Floating-Point Order
When `nav_order` fields are floating-point numbers, the pages are ordered in increasing order of the numerical values.
Floats include `0.0` and negative values.

View File

@ -0,0 +1,8 @@
---
layout: default
title: Order
has_children: true
nav_order: 110
---
# Order

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1"
nav_order: -1
parent: Integers
grand_parent: Order
---
# -1
```yaml
title: "-1"
nav_order: -1
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0"
nav_order: 0
parent: Integers
grand_parent: Order
---
# 0
```yaml
title: "0"
nav_order: 0
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10"
nav_order: 10
parent: Integers
grand_parent: Order
---
# 10
```yaml
title: "10"
nav_order: 10
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2"
nav_order: 2
parent: Integers
grand_parent: Order
---
# 2
```yaml
title: "2"
nav_order: 2
parent: Integers
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Integers
parent: Order
nav_order: 3
has_children: true
---
# Integer Order
When `nav_order` fields are integers, the pages are ordered in increasing order of the numerical values.
Integers include `0` and negative values. Integers can be reused for top-level pages and for different sets of child pages.

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1.1"
nav_order: -1.1
parent: Mixture
grand_parent: Order
---
# -1.1
```yaml
title: "-1.1"
nav_order: -1.1
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "-1"
nav_order: -1
parent: Mixture
grand_parent: Order
---
# -1
```yaml
title: "-1"
nav_order: -1
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0.0"
nav_order: 0.0
parent: Mixture
grand_parent: Order
---
# 0.0
```yaml
title: "0.0"
nav_order: 0.0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "0"
nav_order: 0
parent: Mixture
grand_parent: Order
---
# 0
```yaml
title: "0"
nav_order: 0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10.0"
nav_order: 10.0
parent: Mixture
grand_parent: Order
---
# 10.0
```yaml
title: "10.0"
nav_order: 10.0
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "10"
parent: Mixture
grand_parent: Order
---
# 10
```yaml
title: "10"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2.2222"
nav_order: 2.2222
parent: Mixture
grand_parent: Order
---
# 2.2222
```yaml
title: "2.2222"
nav_order: 2.2222
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: "2"
parent: Mixture
grand_parent: Order
---
# 2
```yaml
title: "2"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,14 @@
---
layout: default
title: A
parent: Mixture
grand_parent: Order
---
# A
```yaml
title: A
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: aa
nav_order: "aa"
parent: Mixture
grand_parent: Order
---
# aa
```yaml
title: aa
nav_order: "aa"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Aa
nav_order: "Aa"
parent: Mixture
grand_parent: Order
---
# Aa
```yaml
title: Aa
nav_order: "Aa"
parent: Mixture
grand_parent: Order
```

View File

@ -0,0 +1,11 @@
---
layout: default
title: Mixture
parent: Order
nav_order: 5
has_children: true
---
# Mixed Order
It seems unlikely that different types of `nav_order` values are needed for the children of the same parent.

View File

@ -0,0 +1,16 @@
---
layout: default
title: "10"
nav_order: "10"
parent: Strings
grand_parent: Order
---
# 10
```yaml
title: "10"
nav_order: "10"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: "2"
nav_order: "2"
parent: Strings
grand_parent: Order
---
# 2
```yaml
title: "2"
nav_order: "2"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: A
nav_order: A
parent: Strings
grand_parent: Order
---
# A
```yaml
title: A
nav_order: A
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: aa
nav_order: "aa"
parent: Strings
grand_parent: Order
---
# aa
```yaml
title: aa
nav_order: "aa"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,16 @@
---
layout: default
title: Aa
nav_order: "Aa"
parent: Strings
grand_parent: Order
---
# Aa
```yaml
title: Aa
nav_order: "Aa"
parent: Strings
grand_parent: Order
```

View File

@ -0,0 +1,13 @@
---
layout: default
title: Strings
parent: Order
nav_order: 2
has_children: true
---
# String Order
By default, all Capital letters come before all lowercase letters; you can add `nav_sort: case_insensitive` in the configuration file to ignore the case).
Digits precede letters, and numeric titles are ordered lexicographically: `"10"` precedes `"2"` (in contrast to explicit numeric `nav_order` values).

View File

@ -1,6 +0,0 @@
---
layout: default
---
# Untitled test page
This page should not appear in the navigation.