-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development
: Migrate exam and exam exercise import client code to signals
#10106
base: develop
Are you sure you want to change the base?
Conversation
# Conflicts: # src/main/webapp/app/exam/manage/exam-management.module.ts
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
# Conflicts: # src/main/webapp/app/exam/manage/exam-management.module.ts # src/main/webapp/app/exam/manage/exams/exam-exercise-import/exam-exercise-import.component.ts # src/main/webapp/app/exam/manage/exams/exam-import/exam-import-paging.service.ts # src/main/webapp/app/exam/manage/exams/exam-import/exam-import.component.ts # src/test/javascript/spec/component/exam/exam-update.component.spec.ts
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
# Conflicts: # src/main/webapp/app/exam/manage/exam-management.module.ts # src/test/javascript/spec/component/exam/manage/exam-import.component.spec.ts
General
: Migrate exam and exam exercise import to signals, inject and standaloneGeneral
: Migrate exam and exam exercise import to signals
WalkthroughThis pull request refactors how component inputs are accessed by transitioning from direct property access to function calls. In several Angular components and their corresponding tests, the use of the Changes
Sequence Diagram(s)sequenceDiagram
participant P as Parent Component/Test
participant E as ExamExerciseImportComponent
P->>E: Set input using setInput('exam', examObject)
E->>E: Initialize exam via input.required<Exam>()
E->>E: Invoke exam() to retrieve exam data
E->>Template: Bind exam().exerciseGroups in HTML
sequenceDiagram
participant P as Parent Component/Test
participant I as ExamImportComponent
P->>I: Set inputs using setInput (e.g., subsequentExerciseGroupSelection, targetExamId)
I->>I: Initialize inputs via input() functions
I->>I: Call input functions (e.g., subsequentExerciseGroupSelection()) during processing
I->>Child: Access child component via viewChild.required()
Possibly related PRs
Suggested labels
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/javascript/spec/component/exam/manage/exercise-groups/exercise-groups.component.spec.ts (1)
283-286
: Enhance test coverage for signal-based properties.While the signal initialization is correct, consider adding test cases to verify:
- Signal value updates during the modal interaction
- Signal subscriptions and their effects
Example test case to add:
it('updates signal values in the import modal', fakeAsync(() => { const mockReturnValue = { componentInstance: { subsequentExerciseGroupSelection: signal<boolean>(false), targetCourseId: signal<number | undefined>(undefined), targetExamId: signal<number | undefined>(undefined), }, result: Promise.resolve([]), } as NgbModalRef; jest.spyOn(modalService, 'open').mockReturnValue(mockReturnValue); comp.openExerciseGroupImportModal(); // Test signal updates mockReturnValue.componentInstance.subsequentExerciseGroupSelection.set(true); mockReturnValue.componentInstance.targetCourseId.set(123); mockReturnValue.componentInstance.targetExamId.set(456); tick(); expect(mockReturnValue.componentInstance.subsequentExerciseGroupSelection()).toBeTrue(); expect(mockReturnValue.componentInstance.targetCourseId()).toBe(123); expect(mockReturnValue.componentInstance.targetExamId()).toBe(456); }));
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/test/javascript/spec/component/exam/manage/exercise-groups/exercise-groups.component.spec.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/test/javascript/spec/**/*.ts`: jest: true; mock: NgMock...
src/test/javascript/spec/**/*.ts
: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}
src/test/javascript/spec/component/exam/manage/exercise-groups/exercise-groups.component.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: client-style
- GitHub Check: client-tests-selected
- GitHub Check: client-tests
- GitHub Check: server-style
- GitHub Check: server-tests
- GitHub Check: Call Build Workflow / Build .war artifact
- GitHub Check: Call Build Workflow / Build and Push Docker Image
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Analyse
🔇 Additional comments (1)
src/test/javascript/spec/component/exam/manage/exercise-groups/exercise-groups.component.spec.ts (1)
32-32
: LGTM!The import of
signal
from@angular/core
is correctly placed and necessary for the signal-based reactivity system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS4, error does not occur anymore and all test steps were valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. One issue:
src/test/javascript/spec/component/exam/manage/exam-management.component.spec.ts
Outdated
Show resolved
Hide resolved
e6a709c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change. Code looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manual testing, unchanged by client test change
Development
: Migrate exam and exam exercise import to signalsDevelopment
: Migrate exam and exam exercise import client code to signals
# Conflicts: # src/test/javascript/spec/component/exam/manage/exercise-groups/exercise-groups.component.spec.ts
2a3b14a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approve code
Checklist
General
Client
Description
This PR updates the Exam and Exam Exercise Import components to use Signals.
Steps for Testing
Prerequisites:
Review Progress
Code Review
Manual Tests
Summary by CodeRabbit
Summary by CodeRabbit