Skip to content

Commit

Permalink
deep-worktype-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
leomendoza123 committed Jan 3, 2025
1 parent b66149d commit 83c6972
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { DeepSelectInputComponent } from './deep-select-input.component'
import { PlatformInfoService } from '../../platform-info'
import { FormBuilder } from '@angular/forms'
import { get } from 'lodash'
import { of } from 'rxjs'
import { MatMenuModule } from '@angular/material/menu'

describe('DeepSelectInputComponent', () => {
let component: DeepSelectInputComponent
Expand All @@ -9,6 +14,25 @@ describe('DeepSelectInputComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [DeepSelectInputComponent],
providers: [
{
provide: PlatformInfoService,
useValue: {
get: () => of({}),
},
},
{
provide: FormBuilder,
useValue: {
group: () => ({
get: () => ({
valueChanges: of(''),
}),
}),
},
},
],
imports: [MatMenuModule],
})
fixture = TestBed.createComponent(DeepSelectInputComponent)
component = fixture.componentInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class DeepSelectInputComponent implements ControlValueAccessor {
}

get invalid() {
return this.formControlRef.invalid && this.formControlRef.touched
return this.formControlRef?.invalid && this.formControlRef?.touched
}

getMatcher(): ErrorStateMatcher {
Expand Down
3 changes: 1 addition & 2 deletions src/app/core/record-works/record-works.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
WorkGroup,
WorksEndpoint,
} from '../../types/record-works.endpoint'
import { WorkPublicationTypes } from '../../types/works.endpoint'
import { environment } from '../../../environments/environment.local'
import { TogglzService } from '../togglz/togglz.service'
import { of, ReplaySubject } from 'rxjs'
Expand Down Expand Up @@ -139,7 +138,7 @@ export function getWork(): Work {
value: 'Book',
},
workType: {
value: WorkPublicationTypes.book,
value: 'book',
},
putCode: {
value: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const WorkTypeMenu: DeepSelectMenu[] = [
value: WorkCategories.teachingAndSupervision,
description: $localize`:@@works.teachingDescription:Working with students`,
content: [
// No value for: Speech ??
// No value for: Lecture ??
/// No value for: Teaching material ??
{
value: WorkTypes.supervisedStudentPublication,
Expand Down

0 comments on commit 83c6972

Please sign in to comment.