Skip to content

Commit 1d2119d

Browse files
Klaster1akuznetsov-os
authored andcommitted
GG-19447 Web Console: Updated Angular from 7 to 8. Fixes #135.
1 parent 56ad1d8 commit 1d2119d

File tree

6 files changed

+241
-199
lines changed

6 files changed

+241
-199
lines changed

modules/web-console/frontend/app-angular/components/form-field/error.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class FormFieldError implements AfterViewInit {
2525
@Input()
2626
error: string;
2727

28-
@ViewChild('errorTemplate')
28+
@ViewChild('errorTemplate', {static: false})
2929
template: TemplateRef<any>;
3030

3131
static parameters = [[new Inject(ElementRef)], [new Inject(FormField)]];

modules/web-console/frontend/app-angular/components/form-field/errors.component.spec.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import 'app/../test/angular-testbed-init';
1818
import {FormFieldErrors} from './errors.component';
1919
import {assert} from 'chai';
20-
import {TestBed, async, ComponentFixture, tick, fakeAsync} from '@angular/core/testing';
21-
import {Component, NO_ERRORS_SCHEMA, Input, ViewChild, ElementRef} from '@angular/core';
20+
import {TestBed, ComponentFixture, fakeAsync} from '@angular/core/testing';
21+
import {Component, NO_ERRORS_SCHEMA, ViewChild, ElementRef} from '@angular/core';
2222

2323
suite('Angular form-field-errors component', () => {
2424
let fixture: ComponentFixture<HostComponent>;
@@ -40,11 +40,13 @@ suite('Angular form-field-errors component', () => {
4040
`
4141
})
4242
class HostComponent {
43-
@ViewChild('inline', {read: ElementRef})
44-
inline: HTMLElement
45-
@ViewChild('icon', {read: ElementRef})
46-
icon: HTMLElement
47-
errorType = 'unique'
43+
@ViewChild('inline', {read: ElementRef, static: false})
44+
inline: HTMLElement;
45+
46+
@ViewChild('icon', {read: ElementRef, static: false})
47+
icon: HTMLElement;
48+
49+
errorType = 'unique';
4850
}
4951

5052
setup(fakeAsync(async() => {
@@ -55,32 +57,39 @@ suite('Angular form-field-errors component', () => {
5557
],
5658
schemas: [NO_ERRORS_SCHEMA]
5759
}).compileComponents();
60+
5861
fixture = TestBed.createComponent(HostComponent);
5962
fixture.detectChanges();
6063
}));
64+
6165
test('Error style', () => {
6266
assert.ok(
6367
fixture.debugElement.componentInstance.inline.nativeElement.querySelector('.inline'),
6468
'It can show inline errors'
6569
);
70+
6671
assert.ok(
6772
fixture.debugElement.componentInstance.icon.nativeElement.querySelector('.icon'),
6873
'It can show icon errors'
6974
);
7075
});
76+
7177
test('Validation message', () => {
7278
assert.equal(
7379
'Value is required',
7480
fixture.debugElement.componentInstance.inline.nativeElement.textContent,
7581
'It shows default message'
7682
);
83+
7784
assert.equal(
7885
'Value should be unique',
7986
fixture.debugElement.componentInstance.icon.nativeElement.textContent,
8087
'It shows custom message'
8188
);
89+
8290
fixture.componentInstance.errorType = 'foo';
8391
fixture.detectChanges();
92+
8493
assert.equal(
8594
'Value is invalid: foo',
8695
fixture.debugElement.componentInstance.icon.nativeElement.textContent,

modules/web-console/frontend/app-angular/components/form-field/formField.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export class FormField implements AfterViewInit {
4949

5050
extraMessages = {};
5151

52-
@ContentChild(FormControlName)
52+
@ContentChild(FormControlName, {static: false})
5353
control: FormControlName;
5454

55-
@ContentChild(FormFieldHint)
55+
@ContentChild(FormFieldHint, {static: false})
5656
hint: FormFieldHint;
5757

5858
@HostBinding('class.form-field__required')

modules/web-console/frontend/app-angular/components/form-field/hint.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ import {PopperContent} from 'ngx-popper';
2626
`
2727
})
2828
export class FormFieldHint {
29-
@ViewChild(PopperContent)
29+
@ViewChild(PopperContent, {static: true})
3030
popper: PopperContent
3131
}

0 commit comments

Comments
 (0)