diff --git a/src/app/teacher/authoring-tool.module.ts b/src/app/teacher/authoring-tool.module.ts index 350762969ae..127c67e7a71 100644 --- a/src/app/teacher/authoring-tool.module.ts +++ b/src/app/teacher/authoring-tool.module.ts @@ -65,7 +65,6 @@ import { AddStepButtonComponent } from '../../assets/wise5/authoringTool/add-ste @NgModule({ declarations: [ AddComponentButtonComponent, - AddLessonButtonComponent, AddLessonChooseLocationComponent, AddLessonChooseTemplateComponent, AddLessonConfigureComponent, @@ -113,6 +112,7 @@ import { AddStepButtonComponent } from '../../assets/wise5/authoringTool/add-ste ProjectListComponent ], imports: [ + AddLessonButtonComponent, AddStepButtonComponent, StudentTeacherCommonModule, ComponentAuthoringModule, diff --git a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html index 2b20f121180..67238ea5655 100644 --- a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html +++ b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html @@ -1,20 +1,47 @@ - - - - - + + + + + + + + + + + + + diff --git a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.scss b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.scss deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.spec.ts b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.spec.ts index e204c673798..a6a57e2d25d 100644 --- a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.spec.ts +++ b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.spec.ts @@ -12,8 +12,8 @@ describe('AddLessonButtonComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [AddLessonButtonComponent], imports: [ + AddLessonButtonComponent, HttpClientTestingModule, StudentTeacherCommonServicesModule, MatIconModule, diff --git a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.ts b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.ts index e9383531032..1a8d174973c 100644 --- a/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.ts +++ b/src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.ts @@ -1,26 +1,31 @@ import { Component, Input, ViewChild } from '@angular/core'; import { TeacherProjectService } from '../../services/teacherProjectService'; import { temporarilyHighlightElement } from '../../common/dom/dom'; -import { MatMenuTrigger } from '@angular/material/menu'; +import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu'; +import { CommonModule } from '@angular/common'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTooltipModule } from '@angular/material/tooltip'; @Component({ selector: 'add-lesson-button', templateUrl: './add-lesson-button.component.html', - styleUrls: ['./add-lesson-button.component.scss'] + standalone: true, + imports: [CommonModule, MatButtonModule, MatIconModule, MatMenuModule, MatTooltipModule] }) export class AddLessonButtonComponent { @Input() active: boolean; + @Input() first: boolean; @Input() lessonId: string; @ViewChild(MatMenuTrigger) menuTrigger: MatMenuTrigger; constructor(private projectService: TeacherProjectService) {} - protected addLesson(): void { - if (this.lessonId == null) { - this.addFirstLesson(); - } else { - this.menuTrigger.openMenu(); - } + protected addFirstLesson(): void { + const newLesson = this.createNewLesson(); + const insertLocation = this.active ? 'group0' : 'inactiveGroups'; + this.projectService.createNodeInside(newLesson, insertLocation); + this.updateProject(newLesson.id); } protected addLessonBefore(): void { @@ -34,13 +39,6 @@ export class AddLessonButtonComponent { } } - private addFirstLesson(): void { - const newLesson = this.createNewLesson(); - const insertLocation = this.active ? 'group0' : 'inactiveGroups'; - this.projectService.createNodeInside(newLesson, insertLocation); - this.updateProject(newLesson.id); - } - protected addLessonAfter(): void { const newLesson = this.createNewLesson(); this.projectService.createNodeAfter(newLesson, this.lessonId); diff --git a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html index b9125997bac..d0019cc8199 100644 --- a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html +++ b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html @@ -68,7 +68,7 @@
There are no lessons
-
+
@@ -90,7 +91,7 @@
Unused Lessons
There are no unused lessons
-
+
Unused Lessons >
diff --git a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.spec.ts b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.spec.ts index 0ca33327206..aeea9472650 100644 --- a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.spec.ts +++ b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.spec.ts @@ -39,8 +39,6 @@ import { HttpClient } from '@angular/common/http'; import { AddLessonButtonComponent } from '../add-lesson-button/add-lesson-button.component'; import { AddStepButtonComponent } from '../add-step-button/add-step-button.component'; -const addLessonAfterRegex = /Add Lesson After/; -const addLessonBeforeRegex = /Add Lesson Before/; let configService: ConfigService; let component: ProjectAuthoringComponent; let getConfigParamSpy: jasmine.Spy; @@ -55,7 +53,6 @@ describe('ProjectAuthoringComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ - AddLessonButtonComponent, ConcurrentAuthorsMessageComponent, NodeAuthoringComponent, NodeIconComponent, @@ -66,6 +63,7 @@ describe('ProjectAuthoringComponent', () => { TeacherNodeIconComponent ], imports: [ + AddLessonButtonComponent, AddStepButtonComponent, BrowserAnimationsModule, FormsModule, @@ -122,7 +120,6 @@ describe('ProjectAuthoringComponent', () => { moveSpecificStep(); deleteSpecificLesson(); moveSpecificLesson(); - addLesson(); }); function collapseAllButtonClicked() { @@ -245,114 +242,3 @@ function moveSpecificLesson() { }); }); } - -function addLesson() { - addLessonBefore(); - addLessonBeforeFirstLesson(); - addLessonAfter(); - addInactiveLessonBefore(); - addInactiveLessonBeforeFirstLesson(); - addInactiveLessonAfter(); -} - -function addLessonBeforeFirstLesson() { - describe('add lesson button is clicked on a lesson that is the first lesson', () => { - describe('add lesson before is chosen on the menu', () => { - it('adds a lesson before the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[0].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonBeforeRegex }); - const newLesson = await harness.getLesson('1: New Lesson'); - expect(newLesson).not.toEqual(null); - }); - }); - }); -} - -function addLessonBefore() { - describe('add lesson button is clicked on a lesson that is not the first lesson', () => { - describe('add lesson before is chosen on the menu', () => { - it('adds a lesson before the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[1].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonBeforeRegex }); - const newLesson = await harness.getLesson('2: New Lesson'); - expect(newLesson).not.toEqual(null); - }); - }); - }); -} - -function addLessonAfter() { - describe('add lesson button is clicked', () => { - describe('add lesson after is chosen on the menu', () => { - it('adds a lesson after the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[0].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonAfterRegex }); - const newLesson = await harness.getLesson('2: New Lesson'); - expect(newLesson).not.toEqual(null); - }); - }); - }); -} - -function addInactiveLessonBeforeFirstLesson() { - describe('add lesson button is clicked on an inactive lesson that is the first inactive lesson', () => { - describe('add lesson before is chosen on the menu', () => { - it('adds a lesson before the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[5].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonBeforeRegex }); - const unusedLessonTitles = await harness.getUnusedLessonTitles(); - expect(unusedLessonTitles).toEqual([ - 'New Lesson', - 'Inactive Lesson One', - 'Inactive Lesson Two' - ]); - }); - }); - }); -} - -function addInactiveLessonBefore() { - describe('add lesson button is clicked on an inactive lesson that is not the first inactive lesson', () => { - describe('add lesson before is chosen on the menu', () => { - it('adds a lesson before the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[6].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonBeforeRegex }); - const unusedLessonTitles = await harness.getUnusedLessonTitles(); - expect(unusedLessonTitles).toEqual([ - 'Inactive Lesson One', - 'New Lesson', - 'Inactive Lesson Two' - ]); - }); - }); - }); -} - -function addInactiveLessonAfter() { - describe('add lesson button is clicked next to an inactive lesson', () => { - describe('add lesson after is chosen on the menu', () => { - it('adds a lesson after the chosen lesson', async () => { - const addLessonButtons = await harness.getAddLessonButtons(); - addLessonButtons[6].click(); - const addLessonMenu = await harness.getOpenedAddStepMenu(); - await addLessonMenu.clickItem({ text: addLessonAfterRegex }); - const unusedLessonTitles = await harness.getUnusedLessonTitles(); - expect(unusedLessonTitles).toEqual([ - 'Inactive Lesson One', - 'Inactive Lesson Two', - 'New Lesson' - ]); - }); - }); - }); -} diff --git a/src/messages.xlf b/src/messages.xlf index f52bd12e825..486090055cf 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -8981,28 +8981,36 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Add lesson src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html - 7 + 6 + + + src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html + 20 - - Add Lesson Before + + Add lesson before src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html - 15 + 28 - - Add Lesson After + + Add lesson after src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html - 18 + 31 + + + src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.html + 40 New Lesson src/assets/wise5/authoringTool/add-lesson-button/add-lesson-button.component.ts - 51 + 49 @@ -9131,7 +9139,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html - 88 + 89 @@ -9729,7 +9737,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html - 109 + 111 @@ -12290,14 +12298,14 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.There are no unused lessons src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html - 90 + 91 There are no unused steps src/assets/wise5/authoringTool/project-authoring/project-authoring.component.html - 110 + 112