1
1
import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
2
- import { FormGroup , FormsModule , ReactiveFormsModule } from '@angular/forms' ;
2
+ import { FormGroup , FormsModule , NgModel , ReactiveFormsModule } from '@angular/forms' ;
3
3
import { ParameterComponent } from './parameter.component' ;
4
4
import { MultiItemsInputComponent } from '../shared-components/multi-items-input/multi-items-input.component' ;
5
5
import { DebugElement } from '@angular/core' ;
6
6
import { By } from '@angular/platform-browser' ;
7
7
import { ParameterObject } from 'openapi3-ts' ;
8
8
import { MarkdownModule } from 'ngx-markdown' ;
9
9
import { CodeInputComponent } from '../shared-components/code-input/code-input.component' ;
10
- import { AceComponent , AceModule } from 'ngx-ace-wrapper' ;
11
10
import { JsonSchemaComponent } from '../shared-components/json-schema/json-schema.component' ;
11
+ import { CodemirrorComponent , CodemirrorModule } from '@ctrl/ngx-codemirror' ;
12
12
13
13
describe ( 'ParameterComponent' , ( ) => {
14
14
let fixture : ComponentFixture < ParameterComponent > ;
@@ -17,7 +17,7 @@ describe('ParameterComponent', () => {
17
17
18
18
beforeEach ( async ( ( ) => {
19
19
TestBed . configureTestingModule ( {
20
- imports : [ FormsModule , ReactiveFormsModule , MarkdownModule . forRoot ( ) , AceModule ] ,
20
+ imports : [ FormsModule , ReactiveFormsModule , MarkdownModule . forRoot ( ) , CodemirrorModule ] ,
21
21
declarations : [ ParameterComponent , MultiItemsInputComponent , CodeInputComponent , JsonSchemaComponent ]
22
22
} ) . compileComponents ( ) ;
23
23
fixture = TestBed . createComponent ( ParameterComponent ) ;
@@ -115,9 +115,9 @@ describe('ParameterComponent', () => {
115
115
expect ( component . formGroup . get ( 'body' ) ) . toBeDefined ( ) ;
116
116
expect ( component . formGroup . get ( 'body' ) . value ) . toEqual ( JSON . stringify ( { name : '' , tag : '' } , null , 2 ) ) ;
117
117
118
- const input = element . query ( By . directive ( AceComponent ) ) ;
119
- const ace : AceComponent = input . componentInstance ;
120
- input . componentInstance . valueChange . next ( '{}' ) ;
118
+ const input = element . query ( By . directive ( CodemirrorComponent ) ) ;
119
+ const dir = input . injector . get ( NgModel ) ;
120
+ dir . control . setValue ( '{}' ) ;
121
121
expect ( component . formGroup . get ( 'body' ) . value ) . toEqual ( '{}' ) ;
122
122
} ) ;
123
123
} ) ;
0 commit comments