-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Authoring): Add delete button to all steps (#1633)
- Loading branch information
1 parent
0ae45e3
commit e691cdb
Showing
12 changed files
with
205 additions
and
82 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
...authoringTool/choose-node-location/node-icon-and-title/node-icon-and-title.component.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px"> | ||
<node-icon [nodeId]="nodeId" size="18"></node-icon> | ||
<span *ngIf="showPosition">{{ getNodePosition(nodeId) }}: </span>{{ getNodeTitle(nodeId) }} | ||
<span *ngIf="showPosition" class="step-number">{{ getNodePosition(nodeId) }}: </span> | ||
<span class="step-title">{{ getNodeTitle(nodeId) }}</span> | ||
</div> |
14 changes: 14 additions & 0 deletions
14
...se5/authoringTool/choose-node-location/node-icon-and-title/node-icon-and-title.harness.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing'; | ||
|
||
export class NodeIconAndTitleHarness extends ComponentHarness { | ||
static hostSelector = 'node-icon-and-title'; | ||
|
||
getStepPosition = this.locatorForOptional('.step-number'); | ||
getStepTitle = this.locatorFor('.step-title'); | ||
|
||
async getPositionAndTitle(): Promise<string> { | ||
const position = await (await this.getStepPosition())?.text(); | ||
const title = await (await this.getStepTitle()).text(); | ||
return position == null ? title : `${position} ${title}`; | ||
} | ||
} |
This file contains 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
87 changes: 51 additions & 36 deletions
87
src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,72 @@ | ||
<div | ||
id="{{ step.id }}" | ||
fxLayoutAlign="start center" | ||
class="pointer stepHeader projectItem" | ||
[ngClass]="{ branchPathStepHeader: isNodeInAnyBranchPath(step.id) }" | ||
fxLayoutGap="10px" | ||
class="step pointer" | ||
[ngClass]="{ 'branch-path-step': isNodeInAnyBranchPath(step.id) }" | ||
[ngStyle]="{ 'background-color': getStepBackgroundColor(step.id) }" | ||
(click)="setCurrentNode(step.id)" | ||
> | ||
<mat-checkbox | ||
color="primary" | ||
(change)="selectNode($event.checked)" | ||
(click)="$event.stopPropagation()" | ||
[disabled]="nodeTypeSelected() === 'lesson'" | ||
aria-label="Select step" | ||
i18n-aria-label | ||
> | ||
<node-icon-and-title [nodeId]="step.id" [showPosition]="showPosition"></node-icon-and-title> | ||
</mat-checkbox> | ||
<div fxLayoutAlign="start center" fxLayoutGap="10px"> | ||
<mat-icon | ||
*ngIf="isBranchPoint(step.id)" | ||
class="rotate-180" | ||
(click)="branchIconClicked(step.id); $event.stopPropagation()" | ||
matTooltip="Branch point with {{ getNumberOfBranchPaths(step.id) }} paths based on {{ | ||
getBranchCriteriaDescription(step.id) | ||
}}" | ||
matTooltipPosition="right" | ||
i18n-matTooltip | ||
>call_split</mat-icon | ||
> | ||
<mat-icon | ||
*ngIf="nodeHasConstraint(step.id)" | ||
(click)="constraintIconClicked(step.id); $event.stopPropagation()" | ||
matTooltip="{{ getNumberOfConstraintsOnNode(step.id) }} Constraint(s) {{ | ||
getConstraintDescriptions(step.id) | ||
}}" | ||
matTooltipPosition="right" | ||
i18n-matTooltip | ||
>block</mat-icon | ||
> | ||
<mat-icon | ||
*ngIf="nodeHasRubric(step.id)" | ||
matTooltip="Has Rubric" | ||
matTooltipPosition="right" | ||
i18n-matTooltip | ||
>message</mat-icon | ||
> | ||
</div> | ||
<div | ||
class="projectItemTitleDiv" | ||
fxLayoutAlign="start center" | ||
fxLayoutGap="10px" | ||
(click)="setCurrentNode(step.id)" | ||
class="step-click-to-enter-div" | ||
matTooltip="Click to enter step" | ||
matTooltipPosition="above" | ||
i18n-matTooltip | ||
> | ||
<node-icon-and-title [nodeId]="step.id" [showPosition]="showPosition"></node-icon-and-title> | ||
<p fxLayoutAlign="start center" fxLayoutGap="10px"> | ||
<mat-icon | ||
*ngIf="isBranchPoint(step.id)" | ||
class="rotate-180" | ||
(click)="branchIconClicked(step.id); $event.stopPropagation()" | ||
matTooltip="Branch point with {{ getNumberOfBranchPaths(step.id) }} paths based on {{ | ||
getBranchCriteriaDescription(step.id) | ||
}}" | ||
matTooltipPosition="right" | ||
i18n-matTooltip | ||
>call_split</mat-icon | ||
> | ||
<mat-icon | ||
*ngIf="nodeHasConstraint(step.id)" | ||
(click)="constraintIconClicked(step.id); $event.stopPropagation()" | ||
matTooltip="{{ getNumberOfConstraintsOnNode(step.id) }} Constraint(s) {{ | ||
getConstraintDescriptions(step.id) | ||
}}" | ||
matTooltipPosition="right" | ||
i18n-matTooltip | ||
>block</mat-icon | ||
> | ||
<mat-icon | ||
*ngIf="nodeHasRubric(step.id)" | ||
matTooltip="Has Rubric" | ||
matTooltipPosition="right" | ||
fxFlex | ||
></div> | ||
<div class="dynamic-step-buttons"> | ||
<div fxLayoutAlign="start center"> | ||
<button | ||
mat-icon-button | ||
class="delete-button" | ||
(click)="delete($event)" | ||
color="primary" | ||
matTooltip="Delete step" | ||
matTooltipPosition="above" | ||
i18n-matTooltip | ||
>message</mat-icon | ||
> | ||
</p> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
29 changes: 19 additions & 10 deletions
29
src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.scss
This file contains 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
This file contains 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
This file contains 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
28 changes: 27 additions & 1 deletion
28
src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.harness.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing'; | ||
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing'; | ||
import { NodeIconAndTitleHarness } from '../choose-node-location/node-icon-and-title/node-icon-and-title.harness'; | ||
import { MatButtonHarness } from '@angular/material/button/testing'; | ||
|
||
interface ProjectAuthoringStepHarnessFilters extends BaseHarnessFilters { | ||
title?: string | RegExp; | ||
} | ||
|
||
export class ProjectAuthoringStepHarness extends ComponentHarness { | ||
static hostSelector = 'project-authoring-step'; | ||
|
||
getStepTitleElement = this.locatorFor(NodeIconAndTitleHarness); | ||
getDeleteButton = this.locatorFor(MatButtonHarness.with({ selector: '.delete-button' })); | ||
|
||
static with( | ||
options: ProjectAuthoringStepHarnessFilters | ||
): HarnessPredicate<ProjectAuthoringStepHarness> { | ||
return new HarnessPredicate(ProjectAuthoringStepHarness, options).addOption( | ||
'title', | ||
options.title, | ||
async (harness, title) => { | ||
return HarnessPredicate.stringMatches(harness.getStepTitle(), title); | ||
} | ||
); | ||
} | ||
|
||
async getStepTitle(): Promise<string> { | ||
const stepTitleElement = await this.getStepTitleElement(); | ||
return await stepTitleElement.getPositionAndTitle(); | ||
} | ||
} |
This file contains 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
6 changes: 6 additions & 0 deletions
6
src/assets/wise5/authoringTool/project-authoring/project-authoring.harness.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing'; | ||
import { MatButtonHarness } from '@angular/material/button/testing'; | ||
import { ProjectAuthoringLessonHarness } from '../project-authoring-lesson/project-authoring-lesson.harness'; | ||
import { ProjectAuthoringStepHarness } from '../project-authoring-step/project-authoring-step.harness'; | ||
|
||
export class ProjectAuthoringHarness extends ComponentHarness { | ||
static hostSelector = 'project-authoring'; | ||
getExpandAllButton = this.locatorFor(MatButtonHarness.with({ text: '+ Expand All' })); | ||
getCollapseAllButton = this.locatorFor(MatButtonHarness.with({ text: '- Collapse All' })); | ||
getLessons = this.locatorForAll(ProjectAuthoringLessonHarness); | ||
getSteps = this.locatorForAll(ProjectAuthoringStepHarness); | ||
|
||
getStep(title: string): Promise<ProjectAuthoringStepHarness> { | ||
return this.locatorForOptional(ProjectAuthoringStepHarness.with({ title: title }))(); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.