|
|
@@ -369,6 +369,53 @@ describe('home learning modules', () => {
|
|
|
expect(play).toHaveBeenCalledTimes(2);
|
|
|
});
|
|
|
|
|
|
+ it('lets a student study selected words from their wordbook while keeping course stages teacher-led', async () => {
|
|
|
+ localStorage.removeItem('xiaoshu.learning.100.100.practice.learn_mode');
|
|
|
+ localStorage.removeItem('xiaoshu.learning.100.100.practice.choose_newword_learn');
|
|
|
+ const harness = await RouterTestingHarness.create();
|
|
|
+ const router = TestBed.inject(Router);
|
|
|
+ await harness.navigateByUrl('/pages/member/starshop');
|
|
|
+ (harness.routeNativeElement?.querySelector('.word-select-list > button') as HTMLButtonElement).click();
|
|
|
+ (harness.routeNativeElement?.querySelector('.selection-header .primary-button') as HTMLButtonElement).click();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ harness.fixture.detectChanges();
|
|
|
+
|
|
|
+ const learning = () => harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
|
|
|
+ expect(router.url).toContain('/pages/stu/stu_con');
|
|
|
+ expect(learning().words().map((word) => word.word)).toEqual(['tend']);
|
|
|
+ learning().skipStudyList();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ harness.fixture.detectChanges();
|
|
|
+ expect(router.url).toContain('/pages/stu/stu3');
|
|
|
+ expect(learning().words().map((word) => word.word)).toEqual(['tend']);
|
|
|
+ learning().chooseMatch('left', learning().words()[0]);
|
|
|
+ learning().chooseMatch('right', learning().words()[0]);
|
|
|
+ learning().continueAfterStage();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ harness.fixture.detectChanges();
|
|
|
+ expect(router.url).toContain('/pages/stu/stu4');
|
|
|
+ expect(learning().words().map((word) => word.word)).toEqual(['tend']);
|
|
|
+ learning().chooseMeaning(learning().words()[0]);
|
|
|
+ learning().continueAfterStage();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ harness.fixture.detectChanges();
|
|
|
+ expect(router.url).toContain('/pages/stu/stu5');
|
|
|
+ for (const letter of learning().current()!.word) {
|
|
|
+ const index = learning().letters().findIndex((choice) => !choice.used && choice.value === letter);
|
|
|
+ expect(index).toBeGreaterThanOrEqual(0);
|
|
|
+ learning().spellLetter(index);
|
|
|
+ }
|
|
|
+ learning().nextSpellingWord();
|
|
|
+ learning().continueAfterStage();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ expect(router.url).toBe('/pages/member/starshop');
|
|
|
+ expect(localStorage.getItem('xiaoshu.learning.100.100.practice.learn_mode')).toBeNull();
|
|
|
+
|
|
|
+ await harness.navigateByUrl('/pages/stu/stu_con?nids=811&pnid=801');
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ expect(router.url).toBe('/pages/home/cart');
|
|
|
+ });
|
|
|
+
|
|
|
it('still pronounces pending and completed words when a coach reveals them', async () => {
|
|
|
user.set({ userId: 300, userName: 'coach', honeyName: '张老师', groupId: 3 });
|
|
|
session.groupId.set(3);
|