Skip to content

Commit

Permalink
[CYB-201] [UI][COMPONENT] Fixed Karma Unit tests.
Browse files Browse the repository at this point in the history
* Fixed merge-conflict.
  • Loading branch information
vpavlenko-cv committed Mar 20, 2024
1 parent 0fb1291 commit 51dedb0
Show file tree
Hide file tree
Showing 13 changed files with 16,839 additions and 64 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core';
import {ConfigChangedEvent} from "../parser/advanced-editor/advanced-editor.component";
import {FormBuilder, FormGroup, UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
import {UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
import {select, Store} from "@ngrx/store";
import {ChainPageState, getIndexMappings} from "../../chain-page.reducers";
import {GetIndexMappingsAction} from "../../chain-page.actions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {CommonModule} from "@angular/common";
import {NzModalModule} from "ng-zorro-antd/modal";
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
import {TextDiffViewComponent} from "../text-diff-view/text-diff-view.component";
import {MonacoEditorModule} from "@materia-ui/ngx-monaco-editor";
import {MockComponent} from "ng-mocks";
import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from "@angular/core";

Expand All @@ -25,7 +24,6 @@ describe('DiffPopupComponent', () => {
CommonModule,
NoopAnimationsModule,
NzModalModule,
MonacoEditorModule
],
providers: [
provideMockStore({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* limitations governing your use of the file.
*/

import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing';
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {CheckCircleOutline, CloseCircleOutline, WarningFill} from '@ant-design/icons-angular/icons';
import {NzIconModule} from 'ng-zorro-antd/icon';
Expand All @@ -28,9 +28,7 @@ import {NzModalModule} from "ng-zorro-antd/modal";
import {NzPopoverModule} from "ng-zorro-antd/popover";
import {FormsModule} from "@angular/forms";
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
import {findEl} from "../../../../shared/test/test-helper";
import {ShowDiffModalAction} from "../diff-popup/diff-popup.actions";
import {MonacoEditorModule} from "@materia-ui/ngx-monaco-editor";
import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from "@angular/core";
import {MockComponent} from "ng-mocks";

Expand All @@ -56,7 +54,6 @@ describe('ParserByParserComponent', () => {
NzTimelineModule,
NzResultModule,
NoopAnimationsModule,
MonacoEditorModule,
NzIconModule.forRoot([CheckCircleOutline, CloseCircleOutline, WarningFill])
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {
SampleDataInternalModel,
SampleDataModel,
SampleDataType,
SampleTestStatus
SampleDataInternalModel,
SampleDataModel,
SampleDataType,
SampleTestStatus
} from "../../models/sample-data.model";
import {EntryParsingResultModel} from "../../models/live-view.model";
import {select, Store} from "@ngrx/store";
import {SampleDataTextFolderInputState} from "./sample-data-text-folder-input.reducers";
import {
getEditModalVisible,
getExecutionStatus,
getRunResults,
getSampleData, getSampleFolderPath
getEditModalVisible,
getExecutionStatus,
getRunResults,
getSampleData,
getSampleFolderPath
} from "./sample-data-text-folder-input.selectors";
import {Observable, Subject} from "rxjs";
import {
FetchSampleListTriggeredAction, SampleFolderViewInitializedAction,
SaveSampleListTriggeredAction,
ShowEditModalAction
FetchSampleListTriggeredAction,
SampleFolderViewInitializedAction,
SaveSampleListTriggeredAction,
ShowEditModalAction
} from "./sample-data-text-folder-input.actions";
import {UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
import {map, takeUntil} from "rxjs/operators";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<form class="form-inline" role="form">
<div class="form-check mb-2 mr-sm-2">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" (change)="onChangeInline($event.target.checked)"> Inline Diff
<input class="form-check-input" type="checkbox" (change)="onChangeInline($any($event.target).checked)"> Inline Diff
</label>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';

import { TextDiffViewComponent } from './text-diff-view.component';
import {MonacoEditorModule} from "@materia-ui/ngx-monaco-editor";
import {CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from "@angular/core";
import {MonacoEditorModule} from "ngx-monaco-editor-v2";

describe('TextDiffViewComponent', () => {
let component: TextDiffViewComponent;
let fixture: ComponentFixture<TextDiffViewComponent>;

beforeEach(waitForAsync( () => {
TestBed.configureTestingModule({
imports: [MonacoEditorModule],
imports: [],
declarations: [ TextDiffViewComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
})
Expand All @@ -20,8 +20,8 @@ describe('TextDiffViewComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TextDiffViewComponent);
component = fixture.componentInstance;
component.originalModel = 'original';
component.modifiedModel = 'modified';
component.originalModelJson = 'original';
component.modifiedModelJson = 'modified';
fixture.detectChanges();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class TextDiffViewComponent implements OnChanges {
}
}

onChangeInline(checked) {
this.diffOptions = Object.assign({}, this.diffOptions, {renderSideBySide: !checked});
onChangeInline(checked: boolean) {
this.diffOptions = {...this.diffOptions, renderSideBySide: !checked};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { FormsModule } from '@angular/forms';

import { AdvancedEditorComponent } from './advanced-editor.component';
import {NzFormModule} from "ng-zorro-antd/form";
import {MonacoEditorModule} from "ngx-monaco-editor-v2";

describe('AdvancedEditorComponent', () => {
let component: AdvancedEditorComponent;
Expand All @@ -24,6 +25,7 @@ describe('AdvancedEditorComponent', () => {
TestBed.configureTestingModule({
imports: [
FormsModule,
MonacoEditorModule.forRoot({}),
NzFormModule,
],
declarations: [ AdvancedEditorComponent ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="popup-content">
<div class="popup-content" >
<h1 cdkDrag
cdkDragHandle
cdkDragRootElement=".cdk-overlay-pane"
Expand All @@ -13,13 +13,13 @@
<button mat-flat-button
class="popup-action-button"
color="primary"
[mat-dialog-close]="json" cdkFocusInitial>
[mat-dialog-close]="json">
Save
</button>
<button mat-flat-button
class="popup-action-button"
[mat-dialog-close]="json"
cdkFocusInitial>
>
Cancel
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';

import { JsonEditorPopupComponent } from './json-editor-popup.component';
import {JsonEditorPopupComponent} from './json-editor-popup.component';
import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from "@angular/material/dialog";
import {MockComponent} from "ng-mocks";
import {AdvancedEditorComponent} from "../../../chain-page/components/parser/advanced-editor/advanced-editor.component";

describe('JsonEditorPopupComponent', () => {
let component: JsonEditorPopupComponent;
let fixture: ComponentFixture<JsonEditorPopupComponent>;
let dialogRef: MatDialogRef<JsonEditorPopupComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ JsonEditorPopupComponent ]
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatDialogModule],
declarations: [JsonEditorPopupComponent, MockComponent(AdvancedEditorComponent)],
providers: [
{
provide: MAT_DIALOG_DATA,
useValue: {
json: {foo: 'bar'}
}
},
{
provide: MatDialogRef,
useValue: jasmine.createSpyObj('MatDialogRef', ['closeDialog'])
}
]
})
.compileComponents();
});
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(JsonEditorPopupComponent);
component = fixture.componentInstance;
dialogRef = TestBed.inject(MatDialogRef);
fixture.detectChanges();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ module.exports = function (config) {
port: 9876,
colors: true,
logLevel: config.INFO,
autoWatch: false,
browsers: ['ChromeHeadless'],
singleRun: true,
restartOnFileChange: false
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@

// Custom Theming for Angular Material
// For more information: https://material.angular.io/guide/theming
/*!
* Copyright 2020 - 2022 Cloudera. All Rights Reserved.
*
* This file is licensed under the Apache License Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. Refer to the License for the specific permissions and
* limitations governing your use of the file.
*/
@use '@angular/material' as mat;
// Plus imports for other components in your app.

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat.core();
@import "./theme.scss";
@import "./custom-component-theme";
@import "./custom-palite";

// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
Expand All @@ -33,24 +40,6 @@ $parser-chaining-theme: mat.define-light-theme((
// that you are using.
@include mat.all-component-themes($parser-chaining-theme);

/*!
* Copyright 2020 - 2022 Cloudera. All Rights Reserved.
*
* This file is licensed under the Apache License Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. Refer to the License for the specific permissions and
* limitations governing your use of the file.
*/
@use '@angular/material' as mat;

@include mat.core();
@import "./theme.scss";
@import "./custom-component-theme";
@import "./custom-palite";

@include mat.all-component-themes($theming-material-components-theme);
@include custom-components-theme($theming-material-components-theme, $notifications-theme);

Expand Down

0 comments on commit 51dedb0

Please sign in to comment.