Repository navigation
test: reach 100% coverage and fix navigation for parents without question - #2
Merged
Merged
Conversation
getNavigation() threw a TypeError when a parent navigation item had no question but its children had. The parent is now derived from its children (hasValue, isValid). Parents without any question are skipped. Also extract _getQuestionFromItem to remove a dead null check in _validate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- move misc.spec.ts to src/quaire.spec.ts and add edge case tests - rename tests to describe the behaviour and fix copy-paste names - remove duplicated assertions and split long custom component test - enforce 100% coverage thresholds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is accomplished by your PR?
Bug fix
getNavigation()threw aTypeErrorwhen a parent navigation item had no own question, but its children had.setActiveQuestionByNavigationItemIdalready supports this case. Now the parent is shown andhasValue/isValidare derived from its children. Parents without any question are still skipped.Tests (19 → 28, coverage 100%)
examples/misc.spec.tstosrc/quaire.spec.ts(unit test, not an example) and add edge case tests: unknown question/navigation IDs, saving without active question, validation, navigation items without questions, restore without itemslinear-flow-skip-question,extending-data-definition)dependencies-between-questionscustom-component-typestest into three testsRefactoring
_getQuestionFromItemto remove a deadnullcheck in_validateIs there something controversial in your PR?
_getParentNavigationItemObjectand a new parameter on_addNavigationItem. Subclasses that override_addNavigationItemmust add the parameter.getNavigation()still crashes when a child comes before its parent innavigationItems.Checklist
🤖 Generated with Claude Code