Skip to content

Commit

Permalink
Merge pull request #2085 from musicEnfanthen/feature/add-preamble-for…
Browse files Browse the repository at this point in the history
…-tka

feat(edition): add preamble for tka
  • Loading branch information
musicEnfanthen authored Dec 20, 2024
2 parents 85cf5a9 + a80e2bf commit 847af10
Show file tree
Hide file tree
Showing 62 changed files with 23,670 additions and 22,937 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ export class EditionIntroComponent implements OnDestroy, OnInit {
const seriesNumber = urlSegments[seriesIndex];
const sectionNumber = urlSegments[sectionIndex];

const isValidSeriesNumber = (value: string | undefined): boolean => value !== undefined && /^[1-3]$/.test(value);
const isValidSeriesNumber = (value: string | undefined): boolean =>
value !== undefined && /^[1-3]$/.test(value);

const isValidSectionNumber = (value: string | undefined): boolean => value !== undefined && /^[1-5]+[ab]?$/.test(value);
const isValidSectionNumber = (value: string | undefined): boolean =>
value !== undefined && /^[1-5]+[ab]?$/.test(value);

return {
seriesNumber: isValidSeriesNumber(seriesNumber) ? seriesNumber : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
[compile-html]="correction.label + ':'"
[compile-html-ref]="ref"></summary>
<div class="p-3 border rounded-3">
@for (description of correction.description; track description) {
@for (evaluation of correction.evaluations; track $index) {
<p
class="awg-source-description-correction-desc mb-0"
[compile-html]="description"
class="awg-source-description-correction-evaluation mb-0"
[compile-html]="evaluation"
[compile-html-ref]="ref"></p>
}
@if (correction.comments.length > 0) {
@if (correction.commentary.comments.length > 0) {
<awg-edition-tka-table
[textcriticalCommentBlocks]="correction.comments"
[commentary]="correction.commentary"
[isCorrections]="true"
[isRowTable]="correction.rowtable"
(navigateToReportFragmentRequest)="navigateToReportFragment($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import {
import { mockEditionData } from '@testing/mock-data';

import { CompileHtmlComponent } from '@awg-shared/compile-html';
import { TextcriticalCommentBlock, Textcritics } from '@awg-views/edition-view/models';
import { TextcriticalCommentary, Textcritics } from '@awg-views/edition-view/models';

import { SourceDescriptionCorrectionsComponent } from './source-description-corrections.component';

// Mock components
@Component({ selector: 'awg-edition-tka-table', template: '' })
class EditionTkaTableStubComponent {
@Input()
textcriticalCommentBlocks: TextcriticalCommentBlock[];
commentary: TextcriticalCommentary;
@Input()
isCorrections = false;
@Input()
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('SourceDescriptionCorrectionsComponent (DONE)', () => {
});
});

it('... should contain a paragraph with as many descriptions as each corrections detail has', () => {
it('... should contain a paragraph with as many evaluations as each corrections detail has', () => {
const detailsDes = getAndExpectDebugElementByCss(
compDe,
'details.awg-source-description-correction-details',
Expand All @@ -231,19 +231,19 @@ describe('SourceDescriptionCorrectionsComponent (DONE)', () => {
detailsDes.forEach((detailsDe, index) => {
const pDes = getAndExpectDebugElementByCss(
detailsDe,
'p.awg-source-description-correction-desc',
'p.awg-source-description-correction-evaluation',
1,
1
);
const pEl: HTMLParagraphElement = pDes[0].nativeElement;

expect(pEl).toBeTruthy();
expectToEqual(pEl.textContent.trim(), expectedCorrections[index].description[index].trim());
expectToEqual(pEl.textContent.trim(), expectedCorrections[index].evaluations[index].trim());
});
});

it('... should contain no EditionTkaTableComponent in corrections detail if no comments are given', () => {
component.corrections[0].comments = [];
it('... should contain no EditionTkaTableComponent in corrections detail if no commentary.comments are given', () => {
component.corrections[0].commentary.comments = [];
detectChangesOnPush(fixture);

const detailsDes = getAndExpectDebugElementByCss(
Expand All @@ -258,7 +258,7 @@ describe('SourceDescriptionCorrectionsComponent (DONE)', () => {
});
});

it('... should contain one EditionTkaTableComponent in each corrections detail if comments are given', () => {
it('... should contain one EditionTkaTableComponent in each corrections detail if commentary.comments are given', () => {
const detailsDes = getAndExpectDebugElementByCss(
compDe,
'details.awg-source-description-correction-details',
Expand All @@ -271,7 +271,7 @@ describe('SourceDescriptionCorrectionsComponent (DONE)', () => {
});
});

it('... should pass down `comments` to EditionTkaTableComponent (stubbed)', () => {
it('... should pass down `commentary` to EditionTkaTableComponent (stubbed)', () => {
const detailsDes = getAndExpectDebugElementByCss(
compDe,
'details.awg-source-description-correction-details',
Expand All @@ -290,7 +290,7 @@ describe('SourceDescriptionCorrectionsComponent (DONE)', () => {
EditionTkaTableStubComponent
) as EditionTkaTableStubComponent;

expectToEqual(editionTkaTableCmp.textcriticalCommentBlocks, expectedCorrections[index].comments);
expectToEqual(editionTkaTableCmp.commentary, expectedCorrections[index].commentary);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
<div ngbAccordionCollapse>
<div ngbAccordionBody>
<ng-template>
<div>
<div class="mb-4">
<p class="smallcaps">
<awg-edition-tka-label
[id]="textcritics.id"
[labelType]="'evaluation'"></awg-edition-tka-label
>:
</p>
@if (utils.isNotEmptyArray(textcritics.description)) {
<awg-edition-tka-description
[textcriticalDescriptions]="textcritics.description"
@if (utils.isNotEmptyArray(textcritics.evaluations)) {
<awg-edition-tka-evaluations
[evaluations]="textcritics.evaluations"
(navigateToReportFragmentRequest)="navigateToReportFragment($event)"
(openModalRequest)="openModal($event)"
(selectSvgSheetRequest)="selectSvgSheet($event)"></awg-edition-tka-description>
(selectSvgSheetRequest)="selectSvgSheet($event)"></awg-edition-tka-evaluations>
} @else {
<ng-container *ngTemplateOutlet="noContent"></ng-container>
}
Expand All @@ -47,12 +47,15 @@
<p class="smallcaps">
<awg-edition-tka-label
[id]="textcritics.id"
[labelType]="'comment'"></awg-edition-tka-label
[labelType]="'commentary'"></awg-edition-tka-label
>:
</p>
@if (utils.isNotEmptyArray(textcritics.comments)) {
@if (
utils.isNotEmptyObject(textcritics.commentary) &&
utils.isNotEmptyArray(textcritics.commentary.comments)
) {
<awg-edition-tka-table
[textcriticalCommentBlocks]="textcritics.comments"
[commentary]="textcritics.commentary"
[isRowTable]="textcritics.rowtable"
[isSketchId]="utils.isSketchId(textcritics.id)"
(navigateToReportFragmentRequest)="navigateToReportFragment($event)"
Expand Down
Loading

0 comments on commit 847af10

Please sign in to comment.