|
|
@@ -891,7 +891,7 @@ describe('home learning modules', () => {
|
|
|
expect(play.calls.argsFor(1)[0]).toContain('apple.mp3');
|
|
|
});
|
|
|
|
|
|
- it('offers four course passes, gates repeats by the whole book and keeps first-pass progress at 100%', async () => {
|
|
|
+ it('allows second and third passes per word before the whole book is finished and stops selection after three passes', async () => {
|
|
|
user.set({userId:300,groupId:3});session.groupId.set(3);session.student.set({userId:100,groupId:1});
|
|
|
const api=TestBed.inject(ApiService) as unknown as LearningModulesApiService;
|
|
|
api.courseWords=[{GeneralID:1001,NodeID:811,Title:'apple',w_learned:1},{GeneralID:1002,NodeID:811,Title:'banana',w_learned:2},{GeneralID:1003,NodeID:811,Title:'pear',w_learned:3}];
|
|
|
@@ -902,21 +902,23 @@ describe('home learning modules', () => {
|
|
|
harness.fixture.detectChanges();
|
|
|
expect(harness.routeNativeElement!.querySelectorAll('.course-pass-tabs button').length).toBe(4);
|
|
|
tab(1).click();harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement!.querySelector('.word-select-check')).toBeNull();
|
|
|
+ expect(harness.routeNativeElement!.querySelector('.word-select-check')).not.toBeNull();
|
|
|
+ expect(harness.routeNativeElement!.textContent).toContain('选择单词开始第二遍学习');
|
|
|
expect(learning().firstPassProgress()).toBe(75);
|
|
|
- api.courseBookCounts=[0,1,1,1];tab(0).click();tab(1).click();harness.fixture.detectChanges();
|
|
|
- expect(learning().firstPassProgress()).toBe(100);
|
|
|
const select=harness.routeNativeElement!.querySelector('.word-select-check') as HTMLButtonElement;
|
|
|
select.click();harness.fixture.detectChanges();
|
|
|
expect(learning().selected().size).toBe(1);
|
|
|
tab(2).click();harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement!.querySelector('.word-select-check')).toBeNull();
|
|
|
- api.courseBookCounts=[0,0,2,1];tab(1).click();tab(2).click();harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement!.querySelector('.word-select-check')).not.toBeNull();
|
|
|
+ const secondPass=harness.routeNativeElement!.querySelector('.word-select-check') as HTMLButtonElement;
|
|
|
+ expect(secondPass).not.toBeNull();
|
|
|
+ secondPass.click();harness.fixture.detectChanges();
|
|
|
+ expect(learning().selected().size).toBe(2);
|
|
|
+ secondPass.click();harness.fixture.detectChanges();
|
|
|
+ expect(learning().selected().size).toBe(1);
|
|
|
tab(3).click();harness.fixture.detectChanges();
|
|
|
expect(harness.routeNativeElement!.textContent).toContain('已完成三遍学习');
|
|
|
expect(harness.routeNativeElement!.querySelector('.word-select-check')).toBeNull();
|
|
|
- expect(learning().firstPassProgress()).toBe(100);
|
|
|
+ expect(learning().firstPassProgress()).toBe(75);
|
|
|
// Selecting a learned word must actually enter the regular learning flow.
|
|
|
tab(1).click();harness.fixture.detectChanges();
|
|
|
(harness.routeNativeElement!.querySelector('.selection-header .primary-button') as HTMLButtonElement).click();
|
|
|
@@ -944,6 +946,8 @@ describe('home learning modules', () => {
|
|
|
tab(3).click();harness.fixture.detectChanges();
|
|
|
expect(learning().words().find(word=>word.word==='apple')?.['w_learned']).toBe(3);
|
|
|
expect(harness.routeNativeElement!.querySelector('.word-select-check')).toBeNull();
|
|
|
+ expect(learning().firstPassProgress()).toBe(75);
|
|
|
+ api.courseBookCounts=[0,0,1,3];tab(0).click();tab(3).click();harness.fixture.detectChanges();
|
|
|
expect(learning().firstPassProgress()).toBe(100);
|
|
|
},30000);
|
|
|
|