Refactor ContentView.path and related code

Reduce the amount of duplicate code used to implement method `ContentView.path`.
Make the relevant tests easier to read, and alphabetically sort the relevant
test's data.
Merge pull request #1368 from Ichimonji10/content-view-path

Refactor ContentView.path and related code