From 1b9975a073b05b3ef997ee743b520cc73ff86ecd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bianchi Date: Thu, 30 Nov 2023 11:33:02 +0100 Subject: [PATCH] fix(angular-material): relocated tests --- packages/angular-material/karma.conf.js | 8 ++++---- .../controls/autocomplete.renderer.spec.ts} | 2 +- .../controls/boolean.renderer.spec.ts} | 2 +- .../controls/date.renderer.spec.ts} | 4 ++-- .../controls/number.renderer.spec.ts} | 2 +- .../controls/range.renderer.spec.ts} | 2 +- .../controls/text.renderer.spec.ts} | 2 +- .../controls/textarea.renderer.spec.ts} | 2 +- .../controls/toggle.renderer.spec.ts} | 2 +- .../layouts/categorization-layout.renderer.spec.ts} | 6 ++++-- .../layouts/group-layout.renderer.spec.ts} | 4 ++-- .../{test => src/layouts}/horizontal-layout.spec.ts | 4 ++-- .../layouts/vertical-layout.renderer.spec.ts} | 4 ++-- .../other/label.renderer.spec.ts} | 2 +- .../other/master-detail}/master-detail.spec.ts | 4 ++-- .../other/object.renderer.spec.ts} | 12 +++++++----- .../other/table.renderer.spec.ts} | 6 +++--- packages/angular-material/test-runner.js | 3 ++- packages/angular-material/test/tsconfig.test.json | 11 ----------- packages/angular-material/tsconfig.json | 5 ++++- packages/angular-material/tsconfig.spec.json | 4 ++++ 21 files changed, 46 insertions(+), 45 deletions(-) rename packages/angular-material/{test/autocomplete-control.spec.ts => src/controls/autocomplete.renderer.spec.ts} (99%) rename packages/angular-material/{test/boolean-control.spec.ts => src/controls/boolean.renderer.spec.ts} (96%) rename packages/angular-material/{test/date-control.spec.ts => src/controls/date.renderer.spec.ts} (99%) rename packages/angular-material/{test/number-control.spec.ts => src/controls/number.renderer.spec.ts} (99%) rename packages/angular-material/{test/range-control.spec.ts => src/controls/range.renderer.spec.ts} (99%) rename packages/angular-material/{test/text-control.spec.ts => src/controls/text.renderer.spec.ts} (99%) rename packages/angular-material/{test/text-area.spec.ts => src/controls/textarea.renderer.spec.ts} (97%) rename packages/angular-material/{test/toggle-control.spec.ts => src/controls/toggle.renderer.spec.ts} (99%) rename packages/angular-material/{test/categorization-tab-layout.spec.ts => src/layouts/categorization-layout.renderer.spec.ts} (98%) rename packages/angular-material/{test/group-layout.spec.ts => src/layouts/group-layout.renderer.spec.ts} (96%) rename packages/angular-material/{test => src/layouts}/horizontal-layout.spec.ts (96%) rename packages/angular-material/{test/vertical-layout.spec.ts => src/layouts/vertical-layout.renderer.spec.ts} (96%) rename packages/angular-material/{test/label-renderer.spec.ts => src/other/label.renderer.spec.ts} (97%) rename packages/angular-material/{test => src/other/master-detail}/master-detail.spec.ts (98%) rename packages/angular-material/{test/object-control.spec.ts => src/other/object.renderer.spec.ts} (98%) rename packages/angular-material/{test/table-control.spec.ts => src/other/table.renderer.spec.ts} (99%) delete mode 100644 packages/angular-material/test/tsconfig.test.json diff --git a/packages/angular-material/karma.conf.js b/packages/angular-material/karma.conf.js index c1de062e21..c6a7de9bce 100644 --- a/packages/angular-material/karma.conf.js +++ b/packages/angular-material/karma.conf.js @@ -2,7 +2,7 @@ // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { - config.set({ + var options = { basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ @@ -25,14 +25,13 @@ module.exports = function (config) { suppressAll: true // removes the duplicated traces }, coverageReporter: { - //dir: require('path').join(__dirname, '../../coverage/angular-material'), subdir: '.', reporters: [ { type: 'lcov' }, { type: 'text-summary' } ] }, - reporters: ['progress', 'kjhtml', 'dots'], + reporters: ['progress', 'kjhtml', 'dots', 'coverage'], browsers: [ config.singleRun ? 'ChromeHeadlessNoSandbox' : 'Chrome' ], customLaunchers: { @@ -51,5 +50,6 @@ module.exports = function (config) { webpackServer: { noInfo: true, }, - }); + }; + config.set(options); }; diff --git a/packages/angular-material/test/autocomplete-control.spec.ts b/packages/angular-material/src/controls/autocomplete.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/autocomplete-control.spec.ts rename to packages/angular-material/src/controls/autocomplete.renderer.spec.ts index d893531c51..fde2460de5 100644 --- a/packages/angular-material/test/autocomplete-control.spec.ts +++ b/packages/angular-material/src/controls/autocomplete.renderer.spec.ts @@ -46,7 +46,7 @@ import { getJsonFormsService, } from '@jsonforms/angular-test'; import { ControlElement, JsonSchema, Actions } from '@jsonforms/core'; -import { AutocompleteControlRenderer } from '../src'; +import { AutocompleteControlRenderer } from './autocomplete.renderer'; import { JsonFormsAngularService } from '@jsonforms/angular'; import { ErrorObject } from 'ajv'; import { FlexLayoutModule } from '@angular/flex-layout'; diff --git a/packages/angular-material/test/boolean-control.spec.ts b/packages/angular-material/src/controls/boolean.renderer.spec.ts similarity index 96% rename from packages/angular-material/test/boolean-control.spec.ts rename to packages/angular-material/src/controls/boolean.renderer.spec.ts index dac35861d9..64988dcf35 100644 --- a/packages/angular-material/test/boolean-control.spec.ts +++ b/packages/angular-material/src/controls/boolean.renderer.spec.ts @@ -30,7 +30,7 @@ import { booleanInputEventTest, ErrorTestExpectation, } from '@jsonforms/angular-test'; -import { BooleanControlRenderer, booleanControlTester } from '../src'; +import { BooleanControlRenderer, booleanControlTester } from './boolean.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/date-control.spec.ts b/packages/angular-material/src/controls/date.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/date-control.spec.ts rename to packages/angular-material/src/controls/date.renderer.spec.ts index 9ceb9bf010..57be2f727c 100644 --- a/packages/angular-material/test/date-control.spec.ts +++ b/packages/angular-material/src/controls/date.renderer.spec.ts @@ -45,10 +45,10 @@ import { setupMockStore, } from '@jsonforms/angular-test'; import { Actions, ControlElement, JsonSchema } from '@jsonforms/core'; -import { DateControlRenderer, DateControlRendererTester } from '../src'; +import { DateControlRenderer, DateControlRendererTester } from './date.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; -import { createTesterContext } from './util'; +import { createTesterContext } from '../../test/util'; const data = { foo: '2018-01-01' }; const schema: JsonSchema = { diff --git a/packages/angular-material/test/number-control.spec.ts b/packages/angular-material/src/controls/number.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/number-control.spec.ts rename to packages/angular-material/src/controls/number.renderer.spec.ts index 5abd1c6776..5153bf9e7f 100644 --- a/packages/angular-material/test/number-control.spec.ts +++ b/packages/angular-material/src/controls/number.renderer.spec.ts @@ -41,7 +41,7 @@ import { prepareComponent, } from '@jsonforms/angular-test'; import { Actions, ControlElement, JsonFormsCore } from '@jsonforms/core'; -import { NumberControlRenderer, NumberControlRendererTester } from '../src'; +import { NumberControlRenderer, NumberControlRendererTester } from './number.renderer'; describe('Material number field tester', () => { const uischema = { diff --git a/packages/angular-material/test/range-control.spec.ts b/packages/angular-material/src/controls/range.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/range-control.spec.ts rename to packages/angular-material/src/controls/range.renderer.spec.ts index 31213f623b..03ed565066 100644 --- a/packages/angular-material/test/range-control.spec.ts +++ b/packages/angular-material/src/controls/range.renderer.spec.ts @@ -32,7 +32,7 @@ import { rangeErrorTest, rangeInputEventTest, } from '@jsonforms/angular-test'; -import { RangeControlRenderer, RangeControlRendererTester } from '../src'; +import { RangeControlRenderer, RangeControlRendererTester } from './range.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/text-control.spec.ts b/packages/angular-material/src/controls/text.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/text-control.spec.ts rename to packages/angular-material/src/controls/text.renderer.spec.ts index 5a3afc47d2..eba98e654b 100644 --- a/packages/angular-material/test/text-control.spec.ts +++ b/packages/angular-material/src/controls/text.renderer.spec.ts @@ -34,7 +34,7 @@ import { textInputEventTest, textTypeTest, } from '@jsonforms/angular-test'; -import { TextControlRenderer, TextControlRendererTester } from '../src'; +import { TextControlRenderer, TextControlRendererTester } from './text.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/text-area.spec.ts b/packages/angular-material/src/controls/textarea.renderer.spec.ts similarity index 97% rename from packages/angular-material/test/text-area.spec.ts rename to packages/angular-material/src/controls/textarea.renderer.spec.ts index 4c19c025ad..5a67a100e2 100644 --- a/packages/angular-material/test/text-area.spec.ts +++ b/packages/angular-material/src/controls/textarea.renderer.spec.ts @@ -34,7 +34,7 @@ import { textErrorTest, textInputEventTest, } from '@jsonforms/angular-test'; -import { TextAreaRenderer, TextAreaRendererTester } from '../src'; +import { TextAreaRenderer, TextAreaRendererTester } from './textarea.renderer'; import { ControlElement, JsonSchema } from '@jsonforms/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/toggle-control.spec.ts b/packages/angular-material/src/controls/toggle.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/toggle-control.spec.ts rename to packages/angular-material/src/controls/toggle.renderer.spec.ts index 7f1e3140d5..c434ca6294 100644 --- a/packages/angular-material/test/toggle-control.spec.ts +++ b/packages/angular-material/src/controls/toggle.renderer.spec.ts @@ -33,7 +33,7 @@ import { booleanInputEventTest, ErrorTestExpectation, } from '@jsonforms/angular-test'; -import { ToggleControlRenderer, ToggleControlRendererTester } from '../src'; +import { ToggleControlRenderer, ToggleControlRendererTester } from './toggle.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/categorization-tab-layout.spec.ts b/packages/angular-material/src/layouts/categorization-layout.renderer.spec.ts similarity index 98% rename from packages/angular-material/test/categorization-tab-layout.spec.ts rename to packages/angular-material/src/layouts/categorization-layout.renderer.spec.ts index ade2194b28..015c093ff6 100644 --- a/packages/angular-material/test/categorization-tab-layout.spec.ts +++ b/packages/angular-material/src/layouts/categorization-layout.renderer.spec.ts @@ -39,10 +39,12 @@ import { } from '@jsonforms/angular'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; import { - CategorizationTabLayoutRenderer, + CategorizationTabLayoutRenderer +} from './categorization-layout.renderer'; +import { TextControlRenderer, TextControlRendererTester, -} from '../src'; +} from '../controls/text.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { setupMockStore, getJsonFormsService } from '@jsonforms/angular-test'; import { MatFormFieldModule } from '@angular/material/form-field'; diff --git a/packages/angular-material/test/group-layout.spec.ts b/packages/angular-material/src/layouts/group-layout.renderer.spec.ts similarity index 96% rename from packages/angular-material/test/group-layout.spec.ts rename to packages/angular-material/src/layouts/group-layout.renderer.spec.ts index 584e878079..c92314c688 100644 --- a/packages/angular-material/test/group-layout.spec.ts +++ b/packages/angular-material/src/layouts/group-layout.renderer.spec.ts @@ -29,11 +29,11 @@ import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; import { beforeEachLayoutTest, setupMockStore } from '@jsonforms/angular-test'; import { FlexLayoutModule } from '@angular/flex-layout'; -import { LayoutChildrenRenderPropsPipe } from '../src/layouts/layout.renderer'; +import { LayoutChildrenRenderPropsPipe } from './layout.renderer'; import { GroupLayoutRenderer, groupLayoutTester, -} from '../src/layouts/group-layout.renderer'; +} from './group-layout.renderer'; describe('Group layout tester', () => { it('should succeed', () => { diff --git a/packages/angular-material/test/horizontal-layout.spec.ts b/packages/angular-material/src/layouts/horizontal-layout.spec.ts similarity index 96% rename from packages/angular-material/test/horizontal-layout.spec.ts rename to packages/angular-material/src/layouts/horizontal-layout.spec.ts index 16cc72e685..60a1af1a67 100644 --- a/packages/angular-material/test/horizontal-layout.spec.ts +++ b/packages/angular-material/src/layouts/horizontal-layout.spec.ts @@ -29,8 +29,8 @@ import { FlexLayoutModule } from '@angular/flex-layout'; import { HorizontalLayoutRenderer, horizontalLayoutTester, -} from '../src/layouts/horizontal-layout.renderer'; -import { LayoutChildrenRenderPropsPipe } from '../src/layouts/layout.renderer'; +} from './horizontal-layout.renderer'; +import { LayoutChildrenRenderPropsPipe } from './layout.renderer'; describe('Horizontal layout tester', () => { it('should succeed', () => { diff --git a/packages/angular-material/test/vertical-layout.spec.ts b/packages/angular-material/src/layouts/vertical-layout.renderer.spec.ts similarity index 96% rename from packages/angular-material/test/vertical-layout.spec.ts rename to packages/angular-material/src/layouts/vertical-layout.renderer.spec.ts index f1cdc54a36..658a94a24b 100644 --- a/packages/angular-material/test/vertical-layout.spec.ts +++ b/packages/angular-material/src/layouts/vertical-layout.renderer.spec.ts @@ -29,8 +29,8 @@ import { FlexLayoutModule } from '@angular/flex-layout'; import { VerticalLayoutRenderer, verticalLayoutTester, -} from '../src/layouts/vertical-layout.renderer'; -import { LayoutChildrenRenderPropsPipe } from '../src/layouts/layout.renderer'; +} from './vertical-layout.renderer'; +import { LayoutChildrenRenderPropsPipe } from './layout.renderer'; describe('Vertical layout tester', () => { it('should succeed', () => { diff --git a/packages/angular-material/test/label-renderer.spec.ts b/packages/angular-material/src/other/label.renderer.spec.ts similarity index 97% rename from packages/angular-material/test/label-renderer.spec.ts rename to packages/angular-material/src/other/label.renderer.spec.ts index 7ea5ebc621..eac629e899 100644 --- a/packages/angular-material/test/label-renderer.spec.ts +++ b/packages/angular-material/src/other/label.renderer.spec.ts @@ -26,7 +26,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { JsonSchema, LabelElement } from '@jsonforms/core'; -import { LabelRenderer, LabelRendererTester } from '../src/other'; +import { LabelRenderer, LabelRendererTester } from './label.renderer'; import { setupMockStore } from '@jsonforms/angular-test'; import { JsonFormsAngularService } from '@jsonforms/angular'; diff --git a/packages/angular-material/test/master-detail.spec.ts b/packages/angular-material/src/other/master-detail/master-detail.spec.ts similarity index 98% rename from packages/angular-material/test/master-detail.spec.ts rename to packages/angular-material/src/other/master-detail/master-detail.spec.ts index bff3f6ef60..ff66c1a615 100644 --- a/packages/angular-material/test/master-detail.spec.ts +++ b/packages/angular-material/src/other/master-detail/master-detail.spec.ts @@ -37,8 +37,8 @@ import { } from '@jsonforms/angular'; import { FlexLayoutModule } from '@angular/flex-layout'; import { DebugElement } from '@angular/core'; -import { MasterListComponent } from '../src/other/master-detail/master'; -import { JsonFormsDetailComponent } from '../src/other/master-detail/detail'; +import { MasterListComponent } from './master'; +import { JsonFormsDetailComponent } from './detail'; import { getJsonFormsService, setupMockStore } from '@jsonforms/angular-test'; import { Actions } from '@jsonforms/core'; import { MatTooltipModule } from '@angular/material/tooltip'; diff --git a/packages/angular-material/test/object-control.spec.ts b/packages/angular-material/src/other/object.renderer.spec.ts similarity index 98% rename from packages/angular-material/test/object-control.spec.ts rename to packages/angular-material/src/other/object.renderer.spec.ts index c01b06ee15..3e46add892 100644 --- a/packages/angular-material/test/object-control.spec.ts +++ b/packages/angular-material/src/other/object.renderer.spec.ts @@ -36,17 +36,19 @@ import { ControlElement } from '@jsonforms/core'; import { GroupLayoutRenderer, groupLayoutTester, - TextControlRenderer, - TextControlRendererTester, VerticalLayoutRenderer, verticalLayoutTester, -} from '../src'; + LayoutChildrenRenderPropsPipe +} from '../layouts'; +import { + TextControlRenderer, + TextControlRendererTester, +} from '../controls'; import { ObjectControlRenderer, ObjectControlRendererTester, -} from '../src/other/object.renderer'; +} from './object.renderer'; import { getJsonFormsService } from '@jsonforms/angular-test'; -import { LayoutChildrenRenderPropsPipe } from '../src/layouts/layout.renderer'; const uischema1: ControlElement = { type: 'Control', scope: '#' }; const uischema2: ControlElement = { diff --git a/packages/angular-material/test/table-control.spec.ts b/packages/angular-material/src/other/table.renderer.spec.ts similarity index 99% rename from packages/angular-material/test/table-control.spec.ts rename to packages/angular-material/src/other/table.renderer.spec.ts index 3155195529..2e5ecc6b96 100644 --- a/packages/angular-material/test/table-control.spec.ts +++ b/packages/angular-material/src/other/table.renderer.spec.ts @@ -34,14 +34,14 @@ import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/t import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { JsonFormsAngularService, JsonFormsModule } from '@jsonforms/angular'; import { ControlElement } from '@jsonforms/core'; -import { TextControlRenderer, TextControlRendererTester } from '../src'; +import { TextControlRenderer, TextControlRendererTester } from '../controls'; import { TableRenderer, TableRendererTester, -} from '../src/other/table.renderer'; +} from './table.renderer'; import { FlexLayoutModule } from '@angular/flex-layout'; import { setupMockStore } from '@jsonforms/angular-test'; -import { createTesterContext } from './util'; +import { createTesterContext } from '../../test/util'; import { MatTooltipModule } from '@angular/material/tooltip'; const uischema1: ControlElement = { type: 'Control', scope: '#' }; diff --git a/packages/angular-material/test-runner.js b/packages/angular-material/test-runner.js index 73532e41f4..af481089b3 100644 --- a/packages/angular-material/test-runner.js +++ b/packages/angular-material/test-runner.js @@ -27,6 +27,7 @@ const defaultWebpackOptions = { const normalizeOptions = (options, context) => { return { + progress: true, ...defaultWebpackOptions, ...options } @@ -71,7 +72,7 @@ const karmaConfigOptionsTransform = (options, context, karmaConfigOptions) => { karmaConfig: 'packages/angular-material/karma.conf.js' } const root = `packages/${project}`; - const sourceRoot = root + '/test'; + const sourceRoot = root + '/src'; const teardownLogics = []; const context = { workspaceRoot, diff --git a/packages/angular-material/test/tsconfig.test.json b/packages/angular-material/test/tsconfig.test.json deleted file mode 100644 index 8b6cff6dc8..0000000000 --- a/packages/angular-material/test/tsconfig.test.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "../dist/test", - "target": "es6", - "inlineSourceMap": true - }, - "include": ["**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"], - "files": ["../src/index.ts"] -} diff --git a/packages/angular-material/tsconfig.json b/packages/angular-material/tsconfig.json index 08fc97a76c..febd1dadf7 100644 --- a/packages/angular-material/tsconfig.json +++ b/packages/angular-material/tsconfig.json @@ -5,7 +5,10 @@ "sourceMap": true, "target": "es5" }, - "exclude": ["node_modules"], + "exclude": [ + "node_modules", + "**/*.spec.ts", + ], "files": ["./src/index.ts"], "angularCompilerOptions": { "compilationMode": "partial", diff --git a/packages/angular-material/tsconfig.spec.json b/packages/angular-material/tsconfig.spec.json index 3f8cb37ad1..539d266801 100644 --- a/packages/angular-material/tsconfig.spec.json +++ b/packages/angular-material/tsconfig.spec.json @@ -8,10 +8,14 @@ "jasmine" ] }, + "exclude": [ + "node_modules" + ], "include": [ "**/*.spec.ts", "**/*.d.ts" ], + "files": ["./src/index.ts"], "angularCompilerOptions": { "compilationMode": "partial", "strictMetadataEmit": true,