You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Simplify BacklinkField & add test for #1927 (#1949)
* test: Add test to show that #1927 is already fixed
It was fixed in f3c6a41.
* test: Fix fromLine() test function behaviour when no heading
The actual behaviour of the Tasks plugin when there is no available
preceding heading is to use null, not an empty string.
This makes the test helper fromLine() in TestHelpers.ts behave the same way.
All tests still pass.
(TestBuilder already used null as the default heading, so no extra work was
needed there.)
* test: Add full test coverage for Task backlinks code
* test: BacklinkField.test.ts heading types now match those in Task
Task allows heading to be string or null, not string or undefined.
* test: BacklinkField.test.ts path type now matches that in Task
Task only allows path to be string, not null or undefined.
* refactor: Simplify BacklinkField.value()
Now the test types for BacklinkField match the types used in
Task, it turns out we can use Task.getLinkText() directly
and all tests pass.
* refactor: Simplify BacklinkField.grouper()
This avoids doing substring calculations, which makes the code
a bit easier to reason about.
* test: Fix names of tests - heading was accidentally labelled path
* test: Format test code to match the start of this branch
To make the pull request easier to review.
* comment: Clarify descriptive comments in grouper()
* comment: Clarify some comments
0 commit comments