diff --git a/.eslintrc.js b/.eslintrc.js index c69ac51d3ce..e16fa51890c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,6 @@ module.exports = { root: true, + ignorePatterns: [ 'projects/**/*', '**/node_modules/**/*', @@ -10,7 +11,9 @@ module.exports = { '**/scripts', '**/docs' ], + plugins: ['@nrwl/nx'], + overrides: [ { files: ['*.ts'], @@ -196,5 +199,7 @@ module.exports = { extends: ['plugin:@angular-eslint/template/process-inline-templates'], excludedFiles: ['*.spec.ts'] } - ] + ], + + extends: ['plugin:storybook/recommended'] }; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000000..81894c2c7d3 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": ["./.eslintrc.js"] +} diff --git a/.gitignore b/.gitignore index 1d9d69714c9..1a0976ffb68 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ licenses.txt .DS_Store .angular NX +.nx diff --git a/.storybook/main.js b/.storybook/main.js index 51d3372dc53..9d8a8ebcd92 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,7 +1,10 @@ module.exports = { + framework: { + name: '@storybook/angular', + options: {} + }, + staticDirs: [{ from: '../../../demo-shell/src/app.config.json', to: 'app.config.json' }], + docs: {}, stories: [], - addons: ['@storybook/addon-essentials'], - framework: '@storybook/angular', - staticDirs: [ { from: '../../../demo-shell/src/app.config.json', to: 'app.config.json' } ], - core: { builder: 'webpack5' } + addons: [] }; diff --git a/.storybook/preview.js b/.storybook/preview.js index 4a981ec5dbe..fe3cb0ffe70 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -2,3 +2,4 @@ export const parameters = { docs: { inlineStories: true }, controls: { expanded: true } }; +export const tags = ['autodocs']; diff --git a/.vscode/settings.json b/.vscode/settings.json index 3ea51e00fca..0922378677b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,5 +31,6 @@ "postcss", "scss" ], - "editor.guides.indentation": true + "editor.guides.indentation": true, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/angular.json b/angular.json index d5a086559e8..2e443b84d74 100644 --- a/angular.json +++ b/angular.json @@ -20,7 +20,8 @@ "zen-observable", "subscriptions-transport-ws", "d", - "chart.js" + "chart.js", + "cropperjs" ], "outputPath": "dist/demo-shell", "index": "demo-shell/src/index.html", @@ -283,7 +284,7 @@ ] }, "test": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": ["TS_NODE_PROJECT=lib/js-api/test/tsconfig.json mocha --full-trace --config lib/js-api/.mocharc.json"] } @@ -297,7 +298,7 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], @@ -434,7 +435,7 @@ } }, "license": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -444,7 +445,7 @@ } }, "pretheme": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -454,9 +455,9 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ - "build" + "build", "pretheme" ], "options": { "cwd": "dist/libs/core", @@ -570,7 +571,7 @@ } }, "stylelint": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -641,7 +642,7 @@ } }, "stylelint": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -783,7 +784,7 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], @@ -844,7 +845,7 @@ } }, "stylelint": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -854,7 +855,7 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], @@ -944,12 +945,6 @@ "main": "lib/testing/index.ts", "generatePackageJson" : true, "tsConfig": "lib/testing/tsconfig.lib.prod.json", - "additionalEntryPoints": [ - { - "entryName": "shared", - "entryPath": "/lib/testing/src/lib/shared/index.ts" - } - ], "stylePreprocessorOptions": { "includePaths": [ "lib", "lib/core/src/lib" @@ -977,7 +972,7 @@ } }, "bundle": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -990,7 +985,7 @@ ] }, "copyToNodeModules": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -1006,7 +1001,7 @@ ] }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], @@ -1072,7 +1067,7 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], @@ -1113,7 +1108,7 @@ "defaultConfiguration": "production" }, "bundle": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -1126,7 +1121,7 @@ ] }, "copyToNodeModules": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "options": { "commands": [ { @@ -1151,7 +1146,7 @@ } }, "npm-publish": { - "executor": "nx:run-commands", + "builder": "nx:run-commands", "dependsOn": [ "build" ], diff --git a/demo-shell/project.json b/demo-shell/project.json new file mode 100644 index 00000000000..f3b5ad833c3 --- /dev/null +++ b/demo-shell/project.json @@ -0,0 +1,201 @@ +{ + "name": "demoshell", + "$schema": "../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "demo-shell/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "options": { + "allowedCommonJsDependencies": [ + "minimatch", + "minimatch-browser", + "superagent", + "event-emitter", + "brace-expansion", + "zen-observable", + "subscriptions-transport-ws", + "d", + "chart.js", + "cropperjs" + ], + "outputPath": "dist/demo-shell", + "index": "demo-shell/src/index.html", + "main": "demo-shell/src/main.ts", + "tsConfig": "tsconfig.dev.json", + "polyfills": "demo-shell/src/polyfills.ts", + "stylePreprocessorOptions": { + "includePaths": ["lib", "lib/core/src/lib"] + }, + "assets": [ + "demo-shell/src/assets", + "demo-shell/src/favicon-96x96.png", + "demo-shell/src/app.config.json", + { + "glob": "**/*", + "input": "demo-shell/src/assets", + "output": "/assets" + }, + { + "glob": "app.config.json", + "input": "demo-shell/src", + "output": "/" + }, + { + "glob": "**/*", + "input": "demo-shell/resources", + "output": "/resources" + }, + { + "glob": "**/*", + "input": "lib/core/src/lib/assets", + "output": "/assets" + }, + { + "glob": "**/*", + "input": "lib/process-services/src/lib/assets", + "output": "/assets" + }, + { + "glob": "**/*", + "input": "lib/process-services-cloud/src/lib/assets", + "output": "/assets" + }, + { + "glob": "**/*", + "input": "lib/content-services/src/lib/assets", + "output": "/assets" + }, + { + "glob": "**/*", + "input": "lib/core/src/lib/i18n", + "output": "/assets/adf-core/i18n" + }, + { + "glob": "**/*", + "input": "lib/content-services/src/lib/i18n", + "output": "/assets/adf-content-services/i18n" + }, + { + "glob": "**/*", + "input": "lib/process-services/src/lib/i18n", + "output": "/assets/adf-process-services/i18n" + }, + { + "glob": "**/*", + "input": "lib/process-services-cloud/src/lib/i18n", + "output": "/assets/adf-process-services-cloud/i18n" + }, + { + "glob": "**/*", + "input": "lib/insights/src/lib/i18n", + "output": "/assets/adf-insights/i18n" + }, + { + "glob": "pdf.worker.min.js", + "input": "node_modules/pdfjs-dist/build", + "output": "/" + }, + { + "glob": "**/*", + "input": "node_modules/monaco-editor", + "output": "/assets/monaco/" + } + ], + "styles": [ + "demo-shell/src/styles.scss", + "demo-shell/src/custom-style-dev.scss", + "node_modules/cropperjs/dist/cropper.min.css", + "node_modules/pdfjs-dist/web/pdf_viewer.css" + ], + "scripts": ["node_modules/pdfjs-dist/build/pdf.js", "node_modules/pdfjs-dist/web/pdf_viewer.js", "node_modules/raphael/raphael.min.js"], + "vendorChunk": true, + "extractLicenses": false, + "buildOptimizer": false, + "sourceMap": true, + "optimization": false, + "namedChunks": true + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "12kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "buildOptimizer": true, + "verbose": false, + "fileReplacements": [ + { + "replace": "demo-shell/src/environments/environment.ts", + "with": "demo-shell/src/environments/environment.prod.ts" + } + ] + }, + "canary": { + "fileReplacements": [ + { + "replace": "demo-shell/src/environments/environment.ts", + "with": "demo-shell/src/environments/environment.canary.ts" + } + ] + }, + "e2e": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "buildOptimizer": true, + "verbose": false, + "fileReplacements": [ + { + "replace": "demo-shell/src/environments/environment.ts", + "with": "demo-shell/src/environments/environment.e2e.ts" + } + ] + } + }, + "defaultConfiguration": "" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "demoshell:build", + "host": "0.0.0.0", + "port": 3000, + "proxyConfig": "demo-shell/proxy.conf.js", + "disableHostCheck": true + }, + "configurations": { + "production": { + "browserTarget": "demoshell:build:production" + }, + "canary": { + "browserTarget": "demoshell:build:canary" + }, + "e2e": { + "browserTarget": "demoshell:build:e2e" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["demo-shell/**/*.ts", "demo-shell/**/*.html"] + } + } + } +} diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index 991bc42a5f9..ddd98f00a68 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -622,7 +622,7 @@ "unit": "Byte", "field": "cm:content.size", "min": 0, - "max": 18, + "max": 4000, "step": 1, "thumbLabel": true } diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 94156dc574c..1b65cfa92fa 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -73,7 +73,7 @@ import { FolderDirectiveModule } from './folder-directive'; BrowserModule, environment.e2e ? NoopAnimationsModule : BrowserAnimationsModule, ReactiveFormsModule, - RouterModule.forRoot(appRoutes, { useHash: true, relativeLinkResolution: 'legacy' }), + RouterModule.forRoot(appRoutes, { useHash: true }), AuthModule.forRoot({ useHash: true }), FormsModule, HttpClientModule, diff --git a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.scss b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.scss index 25952ed76a7..729b370329e 100644 --- a/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.scss +++ b/demo-shell/src/app/components/app-layout/cloud/form-demo/cloud-form-demo.component.scss @@ -1,3 +1,5 @@ +@import 'styles/mat-selectors'; + .app-form-container { padding: 10px; } @@ -31,7 +33,7 @@ } .app-form-editor-buttons { - & > .mat-raised-button { + & > #{$mat-raised-button} { margin-right: 5px; } } diff --git a/demo-shell/src/app/components/cloud/cloud-layout.component.scss b/demo-shell/src/app/components/cloud/cloud-layout.component.scss index ffe293b04a5..433d0c57565 100644 --- a/demo-shell/src/app/components/cloud/cloud-layout.component.scss +++ b/demo-shell/src/app/components/cloud/cloud-layout.component.scss @@ -1,3 +1,5 @@ +@import 'styles/mat-selectors'; + .app-cloud-layout-overflow { overflow: auto; } diff --git a/demo-shell/src/app/components/cloud/shared/cloud-settings.component.html b/demo-shell/src/app/components/cloud/shared/cloud-settings.component.html index 62f74a56fcf..bdc8ab70bea 100644 --- a/demo-shell/src/app/components/cloud/shared/cloud-settings.component.html +++ b/demo-shell/src/app/components/cloud/shared/cloud-settings.component.html @@ -43,11 +43,11 @@

Add Action

- - + + {{action.title}} cancel - - + +
diff --git a/demo-shell/src/custom-style-dev.scss b/demo-shell/src/custom-style-dev.scss index 7249e1c8845..de41105603a 100644 --- a/demo-shell/src/custom-style-dev.scss +++ b/demo-shell/src/custom-style-dev.scss @@ -1,6 +1,7 @@ @use '@angular/material' as mat; @import '../../lib/core/src/lib/styles/index'; @import '../../lib/core/src/lib/styles/typography'; +@include mat.all-component-typographies; @include mat.core; $primary: mat.define-palette($alfresco-accent-orange); @@ -19,19 +20,3 @@ $theme: mat.define-light-theme( @include mat.all-component-themes($theme); @include alfresco-material-theme($theme); - -$typography: map-get($theme, typography); - -body, -html { - margin: 0; - height: 100%; - overflow: hidden; - font-size: mat.font-size($typography, body-1); - font-family: mat.font-family($typography); - line-height: mat.line-height($typography, body-1); -} - -body { - overflow: auto; -} diff --git a/demo-shell/src/custom-style.scss b/demo-shell/src/custom-style.scss index c7cc6f98fdf..efc8d276313 100644 --- a/demo-shell/src/custom-style.scss +++ b/demo-shell/src/custom-style.scss @@ -1,6 +1,7 @@ @use '@angular/material' as mat; @import '~@alfresco/adf-core/theming'; -@include mat.core($alfresco-typography); +@include mat.all-component-typographies($alfresco-typography); +@include mat.core; $primary: mat.define-palette($alfresco-accent-orange); $accent: mat.define-palette($alfresco-accent-purple); @@ -16,17 +17,3 @@ $theme: mat.define-light-theme( @include mat.all-component-themes($theme); @include alfresco-material-theme($theme); - -body, -html { - margin: 0; - height: 100%; - overflow: hidden; - font-size: mat.font-size($alfresco-typography, body-1); - font-family: mat.font-family($alfresco-typography); - line-height: mat.line-height($alfresco-typography, body-1); -} - -body { - overflow: auto; -} diff --git a/docs/README.md b/docs/README.md index 5c5650b9792..49cb631d8bd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -144,6 +144,7 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | +| [Confirm dialog component](core/dialogs/confirm.dialog.md) | Requests a yes/no choice from the user. | [Source](../lib/core/src/lib/dialogs/confirm-dialog/confirm.dialog.ts) | | [Edit JSON Dialog](core/dialogs/edit-json.dialog.md) | Allows a user to preview or edit a JSON content in a dialog. | [Source](../lib/testing/src/lib/core/dialog/edit-json-dialog.ts) | | [Unsaved Changes Dialog](core/dialogs/unsaved-changes-dialog.component.md) | Dialog which informs about unsaved changes. Allows discard them and proceed or close dialog and stop proceeding. | [Source](../lib/core/src/lib/dialogs/unsaved-changes-dialog/unsaved-changes-dialog.component.ts) | @@ -343,7 +344,6 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | | [Dialog component](content-services/dialogs/dialog.md) | Dialog styled wrapper. | [Source](../lib/content-services/src/lib/dialogs/dialog/dialog.component.ts) | -| [Confirm dialog component](content-services/dialogs/confirm.dialog.md) | Requests a yes/no choice from the user. | [Source](../lib/content-services/src/lib/dialogs/confirm.dialog.ts) | | [Library dialog component](content-services/dialogs/library.dialog.md) | Creates a new Content Services document library/site. | [Source](../lib/content-services/src/lib/dialogs/library/library.dialog.ts) | ### Interfaces diff --git a/docs/content-services/components/search.component.md b/docs/content-services/components/search.component.md index f6fa7cc0a41..2751d776cb4 100644 --- a/docs/content-services/components/search.component.md +++ b/docs/content-services/components/search.component.md @@ -96,7 +96,7 @@ However, you can use a more complex template if necessary: class="adf-search-autocomplete-item" (click)="elementClicked(item)" (keyup.enter)="elementClicked(item)"> - +

` | | Listener for results-list events (focus, blur and focusout). | -| hintLabel | `string` | "" | Hint label | -| inputType | `string` | "text" | Type of the input field to render, e.g. "search" or "text" (default). | -| liveSearchEnabled | `boolean` | true | Toggles "find-as-you-type" suggestions for possible matches. | -| placeholder | `string` | "" | Placeholder text to show in the input field | -| searchAutocomplete | `any` | false | Trigger autocomplete results on input change. | -| searchTerm | `string` | "" | Search term preselected | -| showClearButton | `boolean` | false | Toggles whether to show a clear button that closes the search | +| Name | Type | Default value | Description | +|--------------------| ---- | ------------- |--------------------------------------------------------------------------------------------| +| autocomplete | `boolean` | false | Toggles auto-completion of the search input field. | +| collapseOnBlur | `boolean` | true | Toggles whether to collapse the search on blur. | +| collapseOnSubmit | `boolean` | true | Collapse search bar on submit. | +| debounceTime | `number` | 0 | Debounce time in milliseconds. | +| defaultState | `SearchTextStateEnum` | | Default state expanded or Collapsed. | +| expandable | `boolean` | true | Toggles whether to use an expanding search control. If false then a regular input is used. | +| focusListener | [`Observable`](http://reactivex.io/documentation/observable.html)`` | | Listener for results-list events (focus, blur and focusout). | +| hintLabel | `string` | "" | Hint label | +| inputType | `string` | "text" | Type of the input field to render, e.g. "search" or "text" (default). | +| liveSearchEnabled | `boolean` | true | Toggles "find-as-you-type" suggestions for possible matches. | +| placeholder | `string` | "" | Placeholder text to show in the input field | +| label | `string` | "" | Label text to show over the input field | +| searchAutocomplete | `any` | false | Trigger autocomplete results on input change. | +| searchTerm | `string` | "" | Search term preselected | +| showClearButton | `boolean` | false | Toggles whether to show a clear button that closes the search | ### Events diff --git a/docs/content-services/dialogs/confirm.dialog.md b/docs/core/dialogs/confirm.dialog.md similarity index 96% rename from docs/content-services/dialogs/confirm.dialog.md rename to docs/core/dialogs/confirm.dialog.md index e67771f472a..47a1d98f510 100644 --- a/docs/content-services/dialogs/confirm.dialog.md +++ b/docs/core/dialogs/confirm.dialog.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-22 --- -# [Confirm dialog component](../../../lib/content-services/src/lib/dialogs/confirm.dialog.ts "Defined in confirm.dialog.ts") +# [Confirm dialog component](../../../lib/core/src/lib/dialogs/confirm-dialog/confirm.dialog.ts "Defined in confirm.dialog.ts") Requests a yes/no choice from the user. diff --git a/docs/release-notes/RelNote320.md b/docs/release-notes/RelNote320.md index 16f52774c5b..f364cdecfd5 100644 --- a/docs/release-notes/RelNote320.md +++ b/docs/release-notes/RelNote320.md @@ -175,7 +175,7 @@ Is now possible add an extra button in the Confirm Dialog For more details refer to the: -- [Confirm Dialog](../content-services/dialogs/confirm.dialog.md) +- [Confirm Dialog](../core/dialogs/confirm.dialog.md) ### Configuration option to change the default viewer zoom diff --git a/docs/versionIndex.md b/docs/versionIndex.md index 0728496a263..ac00bc7e776 100644 --- a/docs/versionIndex.md +++ b/docs/versionIndex.md @@ -442,7 +442,7 @@ backend services have been tested with each released version of ADF. - [Comment content service](core/services/comment-content.service.md) -- [Confirm dialog](content-services/dialogs/confirm.dialog.md) +- [Confirm dialog](core/dialogs/confirm.dialog.md) - [Content node share directive](content-services/directives/content-node-share.directive.md) - [Custom resources service](content-services/services/custom-resources.service.md) - [Inherited button directive](content-services/directives/inherited-button.directive.md) diff --git a/e2e-playwright/page-object/components/material/material-locators.ts b/e2e-playwright/page-object/components/material/material-locators.ts index fc68a6868f8..cb58d08da57 100644 --- a/e2e-playwright/page-object/components/material/material-locators.ts +++ b/e2e-playwright/page-object/components/material/material-locators.ts @@ -20,6 +20,7 @@ export const materialLocators = { root: 'mat-error' }, Tooltip: { - root: 'mat-tooltip-component' + root: 'mat-tooltip-component', + message: '.mdc-tooltip__surface' } }; diff --git a/e2e-playwright/page-object/components/material/validation.component.ts b/e2e-playwright/page-object/components/material/validation.component.ts index 347ddb93a85..d928e912acd 100644 --- a/e2e-playwright/page-object/components/material/validation.component.ts +++ b/e2e-playwright/page-object/components/material/validation.component.ts @@ -21,7 +21,7 @@ import { materialLocators } from './material-locators'; export class TooltipComponent extends BaseComponent { private static rootElement = materialLocators.Tooltip.root; - public content = this.getChild('div'); + public content = this.getChild(materialLocators.Tooltip.message); constructor(page: Page) { super(page, TooltipComponent.rootElement); diff --git a/e2e-playwright/page-object/index.ts b/e2e-playwright/page-object/index.ts index 2e1d1fa8ce2..05c76406000 100644 --- a/e2e-playwright/page-object/index.ts +++ b/e2e-playwright/page-object/index.ts @@ -16,4 +16,4 @@ */ export * from './components'; -export * from './stories/base.stories'; +export * from './stories/base-stories'; diff --git a/e2e-playwright/page-object/stories/base.stories.ts b/e2e-playwright/page-object/stories/base-stories.ts similarity index 87% rename from e2e-playwright/page-object/stories/base.stories.ts rename to e2e-playwright/page-object/stories/base-stories.ts index 29c8940f2b2..6cffd21bf3a 100644 --- a/e2e-playwright/page-object/stories/base.stories.ts +++ b/e2e-playwright/page-object/stories/base-stories.ts @@ -24,7 +24,7 @@ interface NavigationParameters { moduleNames: string[]; componentName: string; story: string; -}; +} export class BaseStories extends PlaywrightBase { private libraryName: string; @@ -34,15 +34,13 @@ export class BaseStories extends PlaywrightBase { this.libraryName = libraryName; } - private buildStoryId({ moduleNames, componentName, story }: NavigationParameters): string{ + private buildStoryId({ moduleNames, componentName, story }: NavigationParameters): string { const moduleNamesConcatenated = moduleNames.reduce((module, submodule) => module + '-' + submodule); return this.libraryName + '-' + moduleNamesConcatenated + '-' + componentName + '--' + story; } async navigateTo(navigationParameters: NavigationParameters): Promise { - await this.page.goto(`/iframe.html?args=&viewMode=story&id=${this.buildStoryId(navigationParameters)}`, { - waitUntil: 'networkidle', - timeout: timeouts.large - }); + await this.page.goto(`/iframe.html?viewMode=story&id=${this.buildStoryId(navigationParameters)}`); + await this.page.waitForSelector('storybook-root', { timeout: timeouts.large }); } } diff --git a/e2e/content-services/metadata/metadata-properties.e2e.ts b/e2e/content-services/metadata/metadata-properties.e2e.ts index 06df221f5fd..1296018aea7 100644 --- a/e2e/content-services/metadata/metadata-properties.e2e.ts +++ b/e2e/content-services/metadata/metadata-properties.e2e.ts @@ -15,7 +15,15 @@ * limitations under the License. */ -import { createApiService, CheckboxPage, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing'; +import { createApiService, + CheckboxPage, + LoginPage, + UploadActions, + UserModel, + UsersActions, + ViewerPage, + TogglePage +} from '@alfresco/adf-testing'; import { MetadataViewPage } from '../../core/pages/metadata-view.page'; import { FileModel } from '../../models/ACS/file.model'; import { browser } from 'protractor'; @@ -37,6 +45,7 @@ describe('CardView Component - properties', () => { const viewerPage = new ViewerPage(); const metadataViewPage = new MetadataViewPage(); const contentServicesPage = new ContentServicesPage(); + const togglePage = new TogglePage(); let acsUser: UserModel; @@ -127,13 +136,13 @@ describe('CardView Component - properties', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await CheckboxPage.uncheck(metadataViewPage.defaultPropertiesSwitch); + await togglePage.disableToggle(metadataViewPage.defaultPropertiesSwitch); await metadataViewPage.checkMetadataGroupIsNotPresent('properties'); await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); await metadataViewPage.checkMetadataGroupIsExpand('Versionable'); - await CheckboxPage.check(metadataViewPage.defaultPropertiesSwitch); + await togglePage.enableToggle(metadataViewPage.defaultPropertiesSwitch); await metadataViewPage.checkMetadataGroupIsPresent('properties'); await metadataViewPage.checkMetadataGroupIsExpand('properties'); @@ -145,7 +154,11 @@ describe('CardView Component - properties', () => { await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); - await CheckboxPage.uncheck(metadataViewPage.defaultPropertiesSwitch); + await metadataViewPage.checkMetadataGroupIsPresent('properties'); + + await togglePage.disableToggle(metadataViewPage.defaultPropertiesSwitch); + + await metadataViewPage.checkMetadataGroupIsNotPresent('properties'); }); it('[C307975] Should be able to choose which aspect to show expanded in the info-drawer', async () => { diff --git a/e2e/core/pages/metadata-view.page.ts b/e2e/core/pages/metadata-view.page.ts index 8dfeb27b918..ef2db6ccfd4 100644 --- a/e2e/core/pages/metadata-view.page.ts +++ b/e2e/core/pages/metadata-view.page.ts @@ -38,11 +38,12 @@ export class MetadataViewPage { multiSwitch = $(`#adf-metadata-multi`); defaultPropertiesSwitch = $('#adf-metadata-default-properties'); closeButton = element(by.cssContainingText(`button${materialLocators.Button.class} span`, 'Close')); - displayAspect = $(`input[data-placeholder='Display Aspect']`); - applyAspect = element(by.cssContainingText(`button span${materialLocators.Button.wrapper}`, 'Apply Aspect')); + displayAspect = $(`input[placeholder='Display Aspect']`); + applyAspect = element(by.cssContainingText(`button span${materialLocators.Button.label}`, 'Apply Aspect')); saveMetadataButton = $(`[data-automation-id='save-metadata']`); saveGeneralMetadataButton = $(`[data-automation-id='save-general-info-metadata']`); resetMetadataButton = $(`[data-automation-id='reset-metadata']`); + informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`); private getMetadataGroupLocator = async (groupName: string): Promise => $(`[data-automation-id="adf-metadata-group-${groupName}"]`); @@ -113,12 +114,7 @@ export class MetadataViewPage { } async clickOnPropertiesTab(): Promise { - const propertiesTab = element( - by.cssContainingText( - `.adf-info-drawer-layout-content div${materialLocators.Tab.labels.class} div ${materialLocators.Tab.label.content.class}`, - `Properties` - ) - ); + const propertiesTab = element(by.cssContainingText(`.adf-info-drawer-layout-content ${materialLocators.Tab.labels.class}`, `Properties`)); await BrowserActions.click(propertiesTab); } @@ -274,4 +270,12 @@ export class MetadataViewPage { async clickSaveGeneralMetadata(): Promise { await BrowserActions.click(this.saveGeneralMetadataButton); } + + async informationButtonIsDisplayed(): Promise { + await BrowserVisibility.waitUntilElementIsClickable(this.informationButton); + } + + async informationButtonIsNotDisplayed(): Promise { + await BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton); + } } diff --git a/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts b/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts index 836ef971ea9..df9db72e850 100644 --- a/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts +++ b/e2e/process-services-cloud/form-field/dropdown-widget.e2e.ts @@ -130,7 +130,7 @@ describe('Form Field Component - Dropdown Widget', () => { expect(optionsSelected.toString().replace(/\s+/g, '')).toEqual([optionsToSelect, optionsToSelect].toString()); }); - it('[C309878] Should be able to select a dropdown option, save and complete the task form', async () => { + fit('[C309878] Should be able to select a dropdown option, save and complete the task form', async () => { const { name: dropdownOptionTaskName } = runningTasks['dropdownOptionsProcess']; await taskFilter.clickTaskFilter('my-tasks'); await taskList.getDataTable().waitTillContentLoaded(); diff --git a/e2e/process-services-cloud/form-field/visibility-condition-tabs.e2e.ts b/e2e/process-services-cloud/form-field/visibility-condition-tabs.e2e.ts index 2898638ac6e..3026e40e1bf 100644 --- a/e2e/process-services-cloud/form-field/visibility-condition-tabs.e2e.ts +++ b/e2e/process-services-cloud/form-field/visibility-condition-tabs.e2e.ts @@ -18,12 +18,17 @@ import { FormCloudComponentPage, LoginPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; -import { tabFieldValueVisibilityJson, tabVarValueVisibilityJson, tabVarFieldVisibilityJson, - tabFieldFieldVisibilityJson, tabFieldVarVisibilityJson, tabVarVarVisibilityJson, - tabNextOperatorsVisibilityJson } from '../../resources/forms/tab-visibility-conditions'; +import { + tabFieldValueVisibilityJson, + tabVarValueVisibilityJson, + tabVarFieldVisibilityJson, + tabFieldFieldVisibilityJson, + tabFieldVarVisibilityJson, + tabVarVarVisibilityJson, + tabNextOperatorsVisibilityJson +} from '../../resources/forms/tab-visibility-conditions'; describe('Visibility conditions on tabs - cloud', () => { - const loginSSOPage = new LoginPage(); const navigationBarPage = new NavigationBarPage(); const formCloudDemoPage = new FormCloudComponentPage(); @@ -41,13 +46,13 @@ describe('Visibility conditions on tabs - cloud', () => { }; const tab = { - tabWithFields: 'tabWithFields', - tabFieldValue: 'tabBasicFieldValue', - tabVarValue: 'tabBasicVarValue', - tabVarField: 'tabBasicVarField', - tabFieldField: 'tabBasicFieldField', - tabVarVar: 'tabBasicVarVar', - tabNextOperators: 'tabNextOperators' + tabWithFields: 'TABWITHFIELDS', + tabFieldValue: 'TABBASICFIELDVALUE', + tabVarValue: 'TABBASICVARVALUE', + tabVarField: 'TABBASICVARFIELD', + tabFieldField: 'TABBASICFIELDFIELD', + tabVarVar: 'TABBASICVARVAR', + tabNextOperators: 'TABNEXTOPERATORS' }; beforeAll(async () => { diff --git a/e2e/process-services/form/checklist-component.e2e.ts b/e2e/process-services/form/checklist-component.e2e.ts index e21944cc4b5..41725d8115b 100644 --- a/e2e/process-services/form/checklist-component.e2e.ts +++ b/e2e/process-services/form/checklist-component.e2e.ts @@ -21,7 +21,7 @@ import { ProcessServicesPage } from '../pages/process-services.page'; import { ChecklistDialog } from '../pages/dialog/create-checklist-dialog.page'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { browser } from 'protractor'; -import CONSTANTS = require('../../util/constants'); +import * as CONSTANTS from '../../util/constants'; describe('Checklist component', () => { const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; @@ -75,7 +75,8 @@ describe('Checklist component', () => { await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]); await taskPage.tasksListPage().selectRow(tasks[0]); - await (await taskPage.clickOnAddChecklistButton()).clickCreateChecklistButton(); + await taskPage.clickOnAddChecklistButton(); + await checklistDialog.clickCreateChecklistButton(); await taskPage.checkChecklistDialogIsNotDisplayed(); await taskPage.checkNoChecklistIsDisplayed(); expect(await taskPage.getNumberOfChecklists()).toEqual('0'); diff --git a/e2e/process-services/form/people-component.e2e.ts b/e2e/process-services/form/people-component.e2e.ts index 222374731c2..3d3b8c0e72a 100644 --- a/e2e/process-services/form/people-component.e2e.ts +++ b/e2e/process-services/form/people-component.e2e.ts @@ -20,7 +20,7 @@ import { TasksPage } from './../pages/tasks.page'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { ProcessServicesPage } from './../pages/process-services.page'; import { browser } from 'protractor'; -import CONSTANTS = require('../../util/constants'); +import * as CONSTANTS from '../../util/constants'; describe('People component', () => { const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM; diff --git a/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts b/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts index 730135a263f..864a793fcf5 100644 --- a/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts +++ b/e2e/process-services/pages/dialog/create-checklist-dialog.page.ts @@ -21,8 +21,8 @@ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; export class ChecklistDialog { nameField = $('input[data-automation-id="checklist-name"]'); - addChecklistButton = $('button[id="add-check"] span'); - closeButton = $('button[id="close-check-dialog"] span'); + addChecklistButton = $('button[id="add-check"]'); + closeButton = $('button[id="close-check-dialog"]'); dialogTitle = $('#add-checklist-title'); async addName(name: string): Promise { @@ -42,7 +42,7 @@ export class ChecklistDialog { } async getNameFieldPlaceholder(): Promise { - return BrowserActions.getAttribute(this.nameField, 'data-placeholder'); + return BrowserActions.getAttribute(this.nameField, 'placeholder'); } async checkCancelButtonIsEnabled(): Promise { diff --git a/e2e/process-services/pages/dialog/start-task-dialog.page.ts b/e2e/process-services/pages/dialog/start-task-dialog.page.ts index c852aa6057a..da59e571251 100644 --- a/e2e/process-services/pages/dialog/start-task-dialog.page.ts +++ b/e2e/process-services/pages/dialog/start-task-dialog.page.ts @@ -58,7 +58,7 @@ export class StartTaskDialogPage { } async getAssignee(): Promise { - return BrowserActions.getAttribute(this.assignee, 'data-placeholder'); + return BrowserActions.getAttribute(this.assignee, 'placeholder'); } async selectForm(form): Promise { diff --git a/e2e/process-services/pages/process-service-tab-bar.page.ts b/e2e/process-services/pages/process-service-tab-bar.page.ts index 155ab9587cb..551af02b714 100644 --- a/e2e/process-services/pages/process-service-tab-bar.page.ts +++ b/e2e/process-services/pages/process-service-tab-bar.page.ts @@ -20,19 +20,19 @@ import { element, by, browser } from 'protractor'; export class ProcessServiceTabBarPage { - tasksButton = element.all(by.cssContainingText(`div[class*="${materialLocators.Tab.label.root}"] ${materialLocators.Tab.labels.class} div`, 'Tasks')).first(); - processButton = element.all(by.cssContainingText(`div[class*="${materialLocators.Tab.label.root}"] ${materialLocators.Tab.labels.class} div`, 'Process')).first(); - reportsButton = element.all(by.cssContainingText(`div[class*="${materialLocators.Tab.label.root}"] ${materialLocators.Tab.labels.class} div`, 'Reports')).first(); - reportsButtonSelected = element.all(by.cssContainingText(`div[class*="${materialLocators.Tab.label.root}"] ${materialLocators.Tab.labels.class} div[aria-selected="true"]`, 'Reports')).first(); + tasksButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Tasks')).first(); + processButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Process')).first(); + reportsButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Reports')).first(); + reportsButtonSelected = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class} div[aria-selected="true"]`, 'Reports')).first(); async clickTasksButton(): Promise { await BrowserActions.click(this.tasksButton); - await browser.sleep(500); + await browser.sleep(100); } async clickProcessButton(): Promise { await BrowserActions.click(this.processButton); - await browser.sleep(500); + await browser.sleep(100); } async clickReportsButton(): Promise { diff --git a/e2e/process-services/pages/task-details.page.ts b/e2e/process-services/pages/task-details.page.ts index eced879b395..07f8de2ace9 100644 --- a/e2e/process-services/pages/task-details.page.ts +++ b/e2e/process-services/pages/task-details.page.ts @@ -180,7 +180,7 @@ export class TaskDetailsPage { } async getDescriptionPlaceholder(): Promise { - return BrowserActions.getAttribute(this.descriptionField, 'data-placeholder'); + return BrowserActions.getAttribute(this.descriptionField, 'placeholder'); } getDueDate(): Promise { @@ -310,7 +310,7 @@ export class TaskDetailsPage { } async getInvolvePeoplePlaceholder(): Promise { - return BrowserActions.getAttribute(this.addPeopleField, 'data-placeholder'); + return BrowserActions.getAttribute(this.addPeopleField, 'placeholder'); } async checkCancelButtonIsEnabled(): Promise { diff --git a/e2e/process-services/pages/task-filters-demo.page.ts b/e2e/process-services/pages/task-filters-demo.page.ts index 357290ba827..35051082edb 100644 --- a/e2e/process-services/pages/task-filters-demo.page.ts +++ b/e2e/process-services/pages/task-filters-demo.page.ts @@ -43,7 +43,7 @@ export class TaskFiltersDemoPage { return new TaskFiltersPage(this.involvedTask); } - customTaskFilter(filterName: string): TaskFiltersPage { + customTaskFilter(filterName: string): TaskFiltersPage { return new TaskFiltersPage($(`button[data-automation-id="${filterName}_filter"]`)); } diff --git a/e2e/process-services/pages/tasks-list.page.ts b/e2e/process-services/pages/tasks-list.page.ts index f4b82769472..51052e932b6 100644 --- a/e2e/process-services/pages/tasks-list.page.ts +++ b/e2e/process-services/pages/tasks-list.page.ts @@ -21,6 +21,8 @@ import { browser, $, $$ } from 'protractor'; export class TasksListPage { taskList = $('adf-tasklist'); + selectedTab = $('[data-automation-id="navigation-bar"] .mdc-tab--active .mdc-tab__text-label'); + taskTab = $$('[data-automation-id="navigation-bar"] .mdc-tab__text-label').first(); noTasksFound = $$('.adf-empty-content__title').first(); dataTable = new DataTableComponentPage(this.taskList); @@ -61,4 +63,11 @@ export class TasksListPage { return BrowserActions.getText(this.noTasksFound); } + async selectTaskTab() { + const currentTab = await BrowserActions.getText(this.selectedTab); + if(currentTab && currentTab.toLowerCase().trim() !== 'tasks') { + await BrowserActions.click(this.taskTab); + } + } + } diff --git a/e2e/process-services/pages/tasks.page.ts b/e2e/process-services/pages/tasks.page.ts index 51e26baf4db..7f0e858d54f 100644 --- a/e2e/process-services/pages/tasks.page.ts +++ b/e2e/process-services/pages/tasks.page.ts @@ -27,13 +27,13 @@ import { BrowserActions, BrowserVisibility, FormFields, materialLocators } from export class TasksPage { createButton = $('button[data-automation-id="create-button"'); addChecklistButton = $('button[class*="adf-add-to-checklist-button"]'); - rowByRowName = by.xpath(`ancestor::${materialLocators.Chip.root}`); + rowByRowName = by.xpath(`ancestor::${materialLocators.Chip.list.option.class}`); checklistContainer = $('div[class*="checklist-menu"]'); taskTitle = '.adf-activiti-task-details__header span'; completeButtonNoForm = $('#adf-no-form-complete-button'); checklistDialog = $('#checklist-dialog'); checklistNoMessage = $('#checklist-none-message'); - numberOfChecklists = $(`[data-automation-id="checklist-label"] ${materialLocators.Chip.root}`); + numberOfChecklists = $(`[data-automation-id="checklist-label"] ${materialLocators.Chip.list.option.value}`); async createNewTask(): Promise { await this.clickOnCreateButton(); @@ -82,7 +82,7 @@ export class TasksPage { } getRowsName(name: string) { - return this.checklistContainer.element(by.cssContainingText('span', name)); + return this.checklistContainer.element(by.cssContainingText(`span${materialLocators.Chip.list.option.value}`, name)); } getChecklistByName(name: string) { diff --git a/e2e/process-services/tasks/task-filters-sorting.e2e.ts b/e2e/process-services/tasks/task-filters-sorting.e2e.ts index 690d0c319dc..140bcb56155 100644 --- a/e2e/process-services/tasks/task-filters-sorting.e2e.ts +++ b/e2e/process-services/tasks/task-filters-sorting.e2e.ts @@ -95,6 +95,7 @@ describe('Task Filters Sorting', () => { await userFiltersUtil.createUserTaskFilter(newFilter); await browser.refresh(); + await tasksListPage.selectTaskTab(); await taskFiltersDemoPage.customTaskFilter(newFilter.name).clickTaskFilter(); expect(await tasksListPage.getDataTable().contentInPosition(1)).toBe(tasks[2].name); diff --git a/e2e/process-services/widgets/checkbox-widget.e2e.ts b/e2e/process-services/widgets/checkbox-widget.e2e.ts index aeea1a8a2b8..3ba4edcd36b 100644 --- a/e2e/process-services/widgets/checkbox-widget.e2e.ts +++ b/e2e/process-services/widgets/checkbox-widget.e2e.ts @@ -18,7 +18,7 @@ import { createApiService, ApplicationsUtil, LoginPage, ProcessUtil, UsersActions, Widget, UserModel } from '@alfresco/adf-testing'; import { TasksPage } from '../pages/tasks.page'; import { browser } from 'protractor'; -import CONSTANTS = require('../../util/constants'); +import * as CONSTANTS from '../../util/constants'; import { ProcessServicesPage } from '../pages/process-services.page'; import { AppDefinitionRepresentation, ProcessInstanceRepresentation } from '@alfresco/js-api'; @@ -65,6 +65,12 @@ describe('Checkbox Widget', () => { await usersActions.deleteTenant(processUserModel.tenantId); }); + it('[C272812] Should be able to set visibility settings for Checkbox widget', async () => { + await widget.checkboxWidget().isCheckboxHidden(app.FIELD.checkbox_field_id); + await taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, '2'); + await widget.checkboxWidget().isCheckboxDisplayed(app.FIELD.checkbox_field_id); + }); + it('[C268554] Should be able to set general settings for Checkbox widget ', async () => { await taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, '2'); expect(await widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label); @@ -72,10 +78,4 @@ describe('Checkbox Widget', () => { await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_input_id); expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true); }); - - it('[C272812] Should be able to set visibility settings for Checkbox widget', async () => { - await widget.checkboxWidget().isCheckboxHidden(app.FIELD.checkbox_field_id); - await taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, '2'); - await widget.checkboxWidget().isCheckboxDisplayed(app.FIELD.checkbox_field_id); - }); }); diff --git a/e2e/resources/forms/tab-visibility-conditions.ts b/e2e/resources/forms/tab-visibility-conditions.ts index bc8173a0cfc..035ca697214 100644 --- a/e2e/resources/forms/tab-visibility-conditions.ts +++ b/e2e/resources/forms/tab-visibility-conditions.ts @@ -32,10 +32,14 @@ const createField = (id = 'TextTwo', name = 'TextTwo') => ({ } }); -const createFieldDefinition = (id = 'dcde7e13-2444-48bc-ab30-32902cea549e', tabName = '71da814d-5580-4f1f-972a-8089253aeded', fields = { - 1: [createField()], - 2: [] -}) => ({ +const createFieldDefinition = ( + id = 'dcde7e13-2444-48bc-ab30-32902cea549e', + tabName = '71da814d-5580-4f1f-972a-8089253aeded', + fields = { + 1: [createField()], + 2: [] + } +) => ({ id, name: 'Label', type: 'container', @@ -57,7 +61,14 @@ const fieldDefinition3 = createFieldDefinition('df452297-d0e8-4406-b9d3-10842033 const fieldsDefinitions1 = [fieldDefinition1, fieldDefinition2]; const fieldsDefinitions2 = [fieldDefinition1, fieldDefinition3]; -const createVisibilityCondition = (leftType = 'field', leftValue = 'TextOne', nextCondition?: any, rightValue = 'showTab', rightType = 'value', operator = '==') => ({ +const createVisibilityCondition = ( + leftType = 'field', + leftValue = 'TextOne', + nextCondition?: any, + rightValue = 'showTab', + rightType = 'value', + operator = '==' +) => ({ leftType, leftValue, operator, @@ -67,39 +78,44 @@ const createVisibilityCondition = (leftType = 'field', leftValue = 'TextOne', ne nextCondition }); -const createTab = (id = '71da814d-5580-4f1f-972a-8089253aeded', title = 'tabBasicFieldValue', visibilityCondition = createVisibilityCondition('field', 'TextOne', null)) => ({ +const createTab = ( + id = '71da814d-5580-4f1f-972a-8089253aeded', + title = 'TABBASICFIELDVALUE', + visibilityCondition = createVisibilityCondition('field', 'TextOne', null) +) => ({ id, title, visibilityCondition }); -const createTabVisibilityJson = (tabs = [ - createTab(), - createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'tabWithFields', null) -], fields = [ - createFieldDefinition(), - createFieldDefinition('df452297-d0e8-4406-b9d3-10842033549d', '442eea0b-65f9-484e-b37f-f5a91d5e1f21', { - 1: [ - { - id: 'TextOne', - name: 'TextOne', - type: 'text', - required: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 +const createTabVisibilityJson = ( + tabs = [createTab(), createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'TABWITHFIELDS', null)], + fields = [ + createFieldDefinition(), + createFieldDefinition('df452297-d0e8-4406-b9d3-10842033549d', '442eea0b-65f9-484e-b37f-f5a91d5e1f21', { + 1: [ + { + id: 'TextOne', + name: 'TextOne', + type: 'text', + required: false, + colspan: 1, + placeholder: null, + minLength: 0, + maxLength: 0, + regexPattern: null, + visibilityCondition: null, + params: { + existingColspan: 1, + maxColspan: 2 + } } - } - ], - 2: [] - }) -], variables = []) => ({ + ], + 2: [] + }) + ], + variables = [] +) => ({ formRepresentation: { id: 'form-3aff57d3-62af-4adf-9b14-1d8f44a28077', name: 'tabvisibility', @@ -118,89 +134,109 @@ const createTabVisibilityJson = (tabs = [ export const tabFieldValueVisibilityJson = createTabVisibilityJson(); -export const tabVarValueVisibilityJson = createTabVisibilityJson([ - createTab('71da814d-5580-4f1f-972a-8089253aeded', 'tabBasicVarValue', createVisibilityCondition('variable', 'stringVar')) -], [fieldDefinition1], [ - { - id: '803269e6-a568-40e2-aec3-75ad2f411688', - name: 'stringVar', - type: 'string', - value: 'showTab' - } -]); +export const tabVarValueVisibilityJson = createTabVisibilityJson( + [createTab('71da814d-5580-4f1f-972a-8089253aeded', 'TABBASICVARVALUE', createVisibilityCondition('variable', 'stringVar'))], + [fieldDefinition1], + [ + { + id: '803269e6-a568-40e2-aec3-75ad2f411688', + name: 'stringVar', + type: 'string', + value: 'showTab' + } + ] +); -export const tabVarFieldVisibilityJson = createTabVisibilityJson([ - createTab( - '71da814d-5580-4f1f-972a-8089253aeded', - 'tabBasicVarField', - createVisibilityCondition('variable', 'stringVar', undefined, 'TextOne', 'field') - ), - createTab('0e538a28-f8d6-4cb8-ae93-dbfb2efdf3b1', 'tabWithFields', null) -], fieldsDefinitions1, [ - { - id: '803269e6-a568-40e2-aec3-75ad2f411688', - name: 'stringVar', - type: 'string', - value: 'showTab' - } -]); +export const tabVarFieldVisibilityJson = createTabVisibilityJson( + [ + createTab( + '71da814d-5580-4f1f-972a-8089253aeded', + 'TABBASICVARFIELD', + createVisibilityCondition('variable', 'stringVar', undefined, 'TextOne', 'field') + ), + createTab('0e538a28-f8d6-4cb8-ae93-dbfb2efdf3b1', 'TABWITHFIELDS', null) + ], + fieldsDefinitions1, + [ + { + id: '803269e6-a568-40e2-aec3-75ad2f411688', + name: 'stringVar', + type: 'string', + value: 'showTab' + } + ] +); -export const tabFieldFieldVisibilityJson = createTabVisibilityJson([ - createTab( - '71da814d-5580-4f1f-972a-8089253aeded', - 'tabBasicFieldField', - createVisibilityCondition('field', 'TextThree', undefined, 'TextOne', 'field') - ), - createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'tabWithFields', null) -], fieldsDefinitions2); +export const tabFieldFieldVisibilityJson = createTabVisibilityJson( + [ + createTab( + '71da814d-5580-4f1f-972a-8089253aeded', + 'TABBASICFIELDFIELD', + createVisibilityCondition('field', 'TextThree', undefined, 'TextOne', 'field') + ), + createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'TABWITHFIELDS', null) + ], + fieldsDefinitions2 +); -export const tabFieldVarVisibilityJson = createTabVisibilityJson([ - createTab( - '71da814d-5580-4f1f-972a-8089253aeded', - 'tabBasicVarField', - createVisibilityCondition('field', 'TextOne', undefined, 'stringVar', 'variable') - ), - createTab('0e538a28-f8d6-4cb8-ae93-dbfb2efdf3b1', 'tabWithFields', null) -], fieldsDefinitions1, [ - { - id: '803269e6-a568-40e2-aec3-75ad2f411688', - name: 'stringVar', - type: 'string', - value: 'showTab' - } -]); +export const tabFieldVarVisibilityJson = createTabVisibilityJson( + [ + createTab( + '71da814d-5580-4f1f-972a-8089253aeded', + 'TABBASICVARFIELD', + createVisibilityCondition('field', 'TextOne', undefined, 'stringVar', 'variable') + ), + createTab('0e538a28-f8d6-4cb8-ae93-dbfb2efdf3b1', 'TABWITHFIELDS', null) + ], + fieldsDefinitions1, + [ + { + id: '803269e6-a568-40e2-aec3-75ad2f411688', + name: 'stringVar', + type: 'string', + value: 'showTab' + } + ] +); -export const tabVarVarVisibilityJson = createTabVisibilityJson([ - createTab( - 'ef512cb3-0c41-4d12-84ef-a7ef8f0b111a', - 'tabBasicVarVar', - createVisibilityCondition('variable', 'showTabOne', undefined, 'showTabTwo', 'variable') - ) -], [ - createFieldDefinition('6eeb9e54-e51d-44f3-9557-503308f07361', 'ef512cb3-0c41-4d12-84ef-a7ef8f0b111a', { - 1: [createField('TextOne', 'TextOne')], - 2: [] - }) -], [ - { - id: 'b116df99-f6b5-45f8-b48c-15b74f7f1c92', - name: 'showTabOne', - type: 'string', - value: 'showTab' - }, - { - id: '6e3e88ab-848c-4f48-8326-a404d1427f60', - name: 'showTabTwo', - type: 'string', - value: 'showTab' - } -]); +export const tabVarVarVisibilityJson = createTabVisibilityJson( + [ + createTab( + 'ef512cb3-0c41-4d12-84ef-a7ef8f0b111a', + 'TABBASICVARVAR', + createVisibilityCondition('variable', 'showTabOne', undefined, 'showTabTwo', 'variable') + ) + ], + [ + createFieldDefinition('6eeb9e54-e51d-44f3-9557-503308f07361', 'ef512cb3-0c41-4d12-84ef-a7ef8f0b111a', { + 1: [createField('TextOne', 'TextOne')], + 2: [] + }) + ], + [ + { + id: 'b116df99-f6b5-45f8-b48c-15b74f7f1c92', + name: 'showTabOne', + type: 'string', + value: 'showTab' + }, + { + id: '6e3e88ab-848c-4f48-8326-a404d1427f60', + name: 'showTabTwo', + type: 'string', + value: 'showTab' + } + ] +); -export const tabNextOperatorsVisibilityJson = createTabVisibilityJson([ - createTab( - '71da814d-5580-4f1f-972a-8089253aeded', - 'tabNextOperators', - createVisibilityCondition('field', 'TextOne', createVisibilityCondition('field', 'TextThree', null, 'showTab', 'value', '!=')) - ), - createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'tabWithFields', null) -], fieldsDefinitions2); +export const tabNextOperatorsVisibilityJson = createTabVisibilityJson( + [ + createTab( + '71da814d-5580-4f1f-972a-8089253aeded', + 'TABNEXTOPERATORS', + createVisibilityCondition('field', 'TextOne', createVisibilityCondition('field', 'TextThree', null, 'showTab', 'value', '!=')) + ), + createTab('442eea0b-65f9-484e-b37f-f5a91d5e1f21', 'TABWITHFIELDS', null) + ], + fieldsDefinitions2 +); diff --git a/e2e/search/components/search-number-range.e2e.ts b/e2e/search/components/search-number-range.e2e.ts index 36a9cf08fc0..ad28850acda 100644 --- a/e2e/search/components/search-number-range.e2e.ts +++ b/e2e/search/components/search-number-range.e2e.ts @@ -318,6 +318,7 @@ describe('Search Number Range Filter', () => { expect(await sizeRangeFilter.getFromNumber()).toEqual(''); expect(await sizeRangeFilter.getToNumber()).toEqual(''); + await dataTable.waitTillContentLoaded(); const resultsSize = (await dataTable.geCellElementDetail('Size')) as ElementFinder[]; for (const currentResult of resultsSize) { const currentSize = await BrowserActions.getAttribute(currentResult, 'title'); diff --git a/e2e/search/components/search-slider.e2e.ts b/e2e/search/components/search-slider.e2e.ts index 60d77dfc343..1ddc8c2da9d 100644 --- a/e2e/search/components/search-slider.e2e.ts +++ b/e2e/search/components/search-slider.e2e.ts @@ -99,7 +99,7 @@ describe('Search Slider Filter', () => { }); it('[C276972] Should be keep value when Search Size Slider is collapsed', async () => { - const size = 5; + const size = 10; await searchFilters.checkSizeSliderFilterIsDisplayed(); await searchFilters.clickSizeSliderFilterHeader(); @@ -107,9 +107,9 @@ describe('Search Slider Filter', () => { await sizeSliderFilter.setValue(size); await searchFilters.clickSizeSliderFilterHeader(); await searchFilters.checkSizeSliderFilterIsCollapsed(); + await searchFilters.checkSizeSliderFilterIsDisplayed(); await searchFilters.clickSizeSliderFilterHeader(); await searchFilters.checkSizeSliderFilterIsExpanded(); - await searchFilters.checkSizeSliderFilterIsDisplayed(); expect(await sizeSliderFilter.getValue()).toEqual(`${size}`); }); diff --git a/e2e/search/pages/search-bar.page.ts b/e2e/search/pages/search-bar.page.ts index 6baa1833314..01c7b78553c 100644 --- a/e2e/search/pages/search-bar.page.ts +++ b/e2e/search/pages/search-bar.page.ts @@ -23,7 +23,7 @@ export class SearchBarPage { searchBar = $(`adf-search-control input`); searchBarExpanded = TestElement.byCss(`adf-search-control ${materialLocators.Form.field.root}[class*="${materialLocators.Focused.root}"] input`); noResultMessage = $(`p[class*='adf-search-fixed-text']`); - rowsAuthor = `${materialLocators.List.text.class} p[class*='adf-search-fixed-text']`; + rowsAuthor = `${materialLocators.List.content.class} p[class*='adf-search-fixed-text']`; completeName = `h4[class*='adf-search-fixed-text']`; highlightName = `.adf-highlight`; searchBarPage = $(`${materialLocators.List.root}[id='autocomplete-search-result-list']`); diff --git a/e2e/search/search-filters.e2e.ts b/e2e/search/search-filters.e2e.ts index 91cbd57b2a3..51b261ff629 100644 --- a/e2e/search/search-filters.e2e.ts +++ b/e2e/search/search-filters.e2e.ts @@ -199,7 +199,7 @@ describe('Search Filters', () => { it('[C287796] Should be able to display the correct bucket number after selecting a filter', async () => { await BrowserActions.getUrl(`${browser.baseUrl}/search;q=*`); - await searchFiltersPage.fileTypeCheckListFiltersPage().clickCheckListOption('PNG Image'); + await searchFiltersPage.fileTypeCheckListFiltersPage().clickCheckListOption('PNG'); const bucketNumberForFilter = await searchFiltersPage.fileTypeCheckListFiltersPage().getBucketNumberOfFilterType(filter.type); const resultFileNames: any = await contentList.getAllRowsColumnValues('Display name'); diff --git a/lib/cli/package.json b/lib/cli/package.json index 18a42506761..1a8ef5c35f4 100644 --- a/lib/cli/package.json +++ b/lib/cli/package.json @@ -4,12 +4,12 @@ "version": "6.9.0", "author": "Hyland Software, Inc. and its affiliates", "bin": { - "adf-cli": "./bin/adf-cli", - "adf": "./bin/adf-cli" + "adf-cli": "bin/adf-cli", + "adf": "bin/adf-cli" }, "repository": { "type": "git", - "url": "https://github.com/Alfresco/alfresco-ng2-components.git" + "url": "git+https://github.com/Alfresco/alfresco-ng2-components.git" }, "bugs": { "url": "https://github.com/Alfresco/alfresco-ng2-components/issues" @@ -20,7 +20,7 @@ "dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli" }, "dependencies": { - "@alfresco/js-api": ">=7.8.0", + "@alfresco/js-api": ">=7.9.0", "commander": "^6.2.1", "ejs": "^3.1.9", "license-checker": "^25.0.1", diff --git a/lib/cli/project.json b/lib/cli/project.json new file mode 100644 index 00000000000..2ed7642cc1b --- /dev/null +++ b/lib/cli/project.json @@ -0,0 +1,70 @@ +{ + "name": "cli", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "lib/cli", + "projectType": "library", + "prefix": "adf", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "cd lib/cli && npm i && npm run dist", + "stylePreprocessorOptions": { + "includePaths": ["lib", "lib/core/src/lib"] + } + }, + "configurations": { + "production": { + "tsConfig": "lib/cli/tsconfig.json" + } + }, + "defaultConfiguration": "production" + }, + "bundle": { + "executor": "nx:run-commands", + "options": { + "commands": [ + { + "command": "echo cli bundle created" + } + ] + }, + "dependsOn": ["copyToNodeModules"] + }, + "copyToNodeModules": { + "executor": "nx:run-commands", + "options": { + "commands": [ + { + "command": "rm -rf ./node_modules/@alfresco/adf-cli/ && mkdir -p ./node_modules/@alfresco/adf-cli/ && cp -R ./dist/libs/cli/* ./node_modules/@alfresco/adf-cli/" + } + ] + }, + "dependsOn": [ + { + "projects": "self", + "target": "build" + } + ] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["lib/cli/**/*.ts", "lib/cli/**/*.html"] + } + }, + "npm-publish": { + "executor": "nx:run-commands", + "dependsOn": ["build"], + "options": { + "cwd": "dist/libs/cli", + "commands": [ + { + "command": "npm publish --tag {args.tag}", + "forwardAllArgs": true + } + ] + } + } + } +} diff --git a/lib/content-services/.storybook/main.js b/lib/content-services/.storybook/main.js index dfbcb477ba6..ac895e99e1b 100644 --- a/lib/content-services/.storybook/main.js +++ b/lib/content-services/.storybook/main.js @@ -1,9 +1,27 @@ -const rootMain = require('../../../.storybook/main'); +var rootPath = require('../../../.storybook/main'); module.exports = { - ...rootMain, - core: { ...rootMain.core, builder: 'webpack5' }, - stories: [...rootMain.stories, '../**/*.stories.@(js|jsx|ts|tsx)'], - staticDirs: [...rootMain.staticDirs, { from: __dirname + '/../src/lib/i18n', to: 'assets/adf-content-services/i18n' }], - addons: [...rootMain.addons] + rootMain: rootPath, + stories: [...rootPath.stories, '../**/*.stories.@(js|jsx|ts|tsx)'], + + staticDirs: [ + ...rootPath.staticDirs, + { from: __dirname + '/../src/lib/i18n', to: 'assets/adf-core/i18n' }, + { from: __dirname + '/../src/lib/assets/images', to: 'assets/images' } + ], + + addons: ['@storybook/addon-essentials', ...rootPath.addons], + + framework: { + name: '@storybook/angular', + options: {} + }, + + docs: { + autodocs: true + }, + + core: { + builder: '@storybook/builder-webpack5' + } }; diff --git a/lib/content-services/.storybook/manager.js b/lib/content-services/.storybook/manager.js index b5a1a8fa6ff..f18f9b0a06d 100644 --- a/lib/content-services/.storybook/manager.js +++ b/lib/content-services/.storybook/manager.js @@ -1,6 +1,6 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/manager-api'; import alfrescoTheme from '../../../.storybook/alfrescoTheme'; addons.setConfig({ - theme: alfrescoTheme, + theme: alfrescoTheme }); diff --git a/lib/content-services/package.json b/lib/content-services/package.json index 7d57ab1083d..e9963ec4a04 100644 --- a/lib/content-services/package.json +++ b/lib/content-services/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": ">=14.1.3", "@angular/platform-browser-dynamic": ">=14.1.3", "@angular/router": ">=14.1.3", - "@alfresco/js-api": ">=7.8.0", + "@alfresco/js-api": ">=7.9.0", "@ngx-translate/core": ">=14.0.0", "@alfresco/adf-core": ">=6.9.0" }, diff --git a/lib/content-services/project.json b/lib/content-services/project.json new file mode 100644 index 00000000000..f76d12a311d --- /dev/null +++ b/lib/content-services/project.json @@ -0,0 +1,111 @@ +{ + "name": "content-services", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "lib/content-services/src", + "projectType": "library", + "prefix": "adf", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:ng-packagr", + "options": { + "tsConfig": "lib/content-services/tsconfig.lib.json", + "project": "lib/content-services/ng-package.json" + }, + "configurations": { + "production": { + "project": "lib/content-services/ng-package.json", + "tsConfig": "lib/content-services/tsconfig.lib.prod.json" + } + }, + "defaultConfiguration": "production" + }, + "test": { + "executor": "@angular-devkit/build-angular:karma", + "options": { + "main": "lib/content-services/src/test.ts", + "tsConfig": "lib/content-services/tsconfig.spec.json", + "karmaConfig": "lib/content-services/karma.conf.js", + "sourceMap": true, + "codeCoverage": true, + "stylePreprocessorOptions": { + "includePaths": ["lib", "lib/core/src/lib"] + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["lib/content-services/**/*.ts", "lib/content-services/**/*.html"] + } + }, + "storybook": { + "executor": "@storybook/angular:start-storybook", + "options": { + "port": 4400, + "browserTarget": "content-services:storybook", + "configDir": "lib/content-services/.storybook", + "compodoc": false, + "styles": [ + "demo-shell/src/styles.scss", + "demo-shell/src/custom-style-dev.scss", + "node_modules/cropperjs/dist/cropper.min.css", + "node_modules/pdfjs-dist/web/pdf_viewer.css" + ], + "stylePreprocessorOptions": { + "includePaths": ["lib", "lib/core/src/lib"] + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "executor": "@storybook/angular:build-storybook", + "options": { + "browserTarget": "content-services:build-storybook", + "configDir": "lib/content-services/.storybook", + "outputDir": "dist/storybook/content-services", + "compodoc": false, + "styles": [ + "demo-shell/src/styles.scss", + "demo-shell/src/custom-style-dev.scss", + "node_modules/cropperjs/dist/cropper.min.css", + "node_modules/pdfjs-dist/web/pdf_viewer.css" + ], + "stylePreprocessorOptions": { + "includePaths": ["lib", "lib/core/src/lib"] + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "stylelint": { + "executor": "nx:run-commands", + "options": { + "commands": [ + { + "command": "npx stylelint lib/content-services/**/*.scss --config stylelint-config.json" + } + ] + } + }, + "npm-publish": { + "executor": "nx:run-commands", + "dependsOn": ["build"], + "options": { + "cwd": "dist/libs/content-services", + "commands": [ + { + "command": "npm publish --tag {args.tag}", + "forwardAllArgs": true + } + ] + } + } + } +} diff --git a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.scss b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.scss index a606f7c1796..d5c4fe65c28 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.scss +++ b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.scss @@ -1,3 +1,13 @@ +@import 'styles/mat-selectors'; + +adf-aspect-list-dialog { + display: block; + + #{$mat-expansion-panel-body} { + margin-top: -2px; + } +} + .adf { &-aspect-list-dialog-title { font-size: large; @@ -13,21 +23,34 @@ &-aspect-list-dialog-information { display: flex; justify-content: space-between; - padding-left: 5px; - padding-right: 5px; + padding-bottom: 4px; + padding-left: 4px; + padding-right: 4px; font-size: small; } &-aspect-list-dialog { justify-content: space-between; + padding-left: 4px; + padding-right: 4px; + padding-top: 0; + + #{$mat-dialog-content} { + padding: 0; + } + + &::before { + display: none; + } } &-aspect-dialog-content { - padding-top: 3px; + margin-bottom: 8px; .adf-aspect-property-table { .adf-aspect-property-table-cell { font-size: smaller; + color: var(--adf-theme-foreground-text-color-087); } .adf-aspect-property-table-column { diff --git a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts index 88254e3c391..e7e6c2ba473 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts @@ -27,6 +27,7 @@ import { AspectEntry, Node } from '@alfresco/js-api'; import { NodesApiService } from '../common/services/nodes-api.service'; import { By } from '@angular/platform-browser'; import { AspectListComponent } from './aspect-list.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; const aspectListMock: AspectEntry[] = [ { @@ -113,7 +114,7 @@ describe('AspectListDialogComponent', () => { excludedAspects: [] }; await TestBed.configureTestingModule({ - imports: [ContentTestingModule, MatDialogModule], + imports: [HttpClientTestingModule, ContentTestingModule, MatDialogModule], providers: [ { provide: MAT_DIALOG_DATA, useValue: data }, { diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.scss b/lib/content-services/src/lib/aspect-list/aspect-list.component.scss index bfdf00eec1a..6779ef85e98 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.scss +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.scss @@ -1,3 +1,4 @@ +@import 'styles/mat-selectors'; $dialog-title-height: 100px; $dialog-information-height: 44px; $dialog-buttons-height: 68px; @@ -30,6 +31,7 @@ $dialog-list-height: calc(65vh - ($dialog-title-height + $dialog-information-hei } .adf-aspect-list-element-title { + font-size: smaller; display: flex; align-items: center; } @@ -37,8 +39,14 @@ $dialog-list-height: calc(65vh - ($dialog-title-height + $dialog-information-hei .adf-accordion-aspect-list-expansion-panel { margin: 0; + #{$mat-checkbox-background} { + height: 16px; + width: 16px; + } + &-header { font-size: smaller; + padding-left: 12px; } &-header-title { @@ -59,17 +67,28 @@ $dialog-list-height: calc(65vh - ($dialog-title-height + $dialog-information-hei &-aspect-property-table { width: 100%; + .adf-aspect-property-table-column-name, + .adf-aspect-property-table-column-title, + .adf-aspect-property-table-column-data-type { + font-size: 12px; + color: var(--adf-theme-foreground-text-color-054); + } + .adf-aspect-property-table-column { &-name { width: 15%; + padding-left: 24px; + padding-right: 0; } &-title { width: 65%; + padding: 0; } &-data-type { width: 20%; + padding-right: 24px; padding-left: 10px; } } diff --git a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts index 89ec6a7b041..6f4023c654d 100644 --- a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts +++ b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts @@ -16,31 +16,29 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-core'; import { AspectListService } from './aspect-list.service'; import { AspectPaging, AspectsApi, AspectEntry } from '@alfresco/js-api'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; const stdAspect1: AspectEntry = { entry: { id: 'std:standardAspectOne', description: 'Standard Aspect One', title: 'StandardAspectOne' } }; const stdAspect2: AspectEntry = { entry: { id: 'std:standardAspectTwo', description: 'Standard Aspect Two', title: 'StandardAspectTwo' } }; const stdAspect3: AspectEntry = { entry: { id: 'std:standardAspectThree', description: 'Standard Aspect Three', title: 'StandardAspectThree' } }; -const standardAspectPagingMock: AspectPaging = { list: { entries: [ stdAspect1, stdAspect2, stdAspect3 ] } }; +const standardAspectPagingMock: AspectPaging = { list: { entries: [stdAspect1, stdAspect2, stdAspect3] } }; const cstAspect1: AspectEntry = { entry: { id: 'cst:customAspectOne', description: 'Custom Aspect One', title: 'CustomAspectOne' } }; const cstAspect2: AspectEntry = { entry: { id: 'cst:customAspectTwo', description: 'Custom Aspect Two', title: 'CustomAspectTwo' } }; const cstAspect3: AspectEntry = { entry: { id: 'cst:customAspectThree', description: 'Custom Aspect Three', title: 'CustomAspectThree' } }; -const customAspectPagingMock: AspectPaging = { list: { entries: [ cstAspect1, cstAspect2, cstAspect3 ] } }; +const customAspectPagingMock: AspectPaging = { list: { entries: [cstAspect1, cstAspect2, cstAspect3] } }; describe('AspectListService', () => { - let aspectListService: AspectListService; let apiService: AlfrescoApiService; let aspectsApi: AspectsApi; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - CoreTestingModule - ] + imports: [HttpClientTestingModule] }); aspectListService = TestBed.inject(AspectListService); diff --git a/lib/content-services/src/lib/breadcrumb/dropdown-breadcrumb.component.html b/lib/content-services/src/lib/breadcrumb/dropdown-breadcrumb.component.html index f0ef44288b2..0a646d11433 100644 --- a/lib/content-services/src/lib/breadcrumb/dropdown-breadcrumb.component.html +++ b/lib/content-services/src/lib/breadcrumb/dropdown-breadcrumb.component.html @@ -18,6 +18,7 @@ .adf-breadcrumb-dropdown-panel){ + min-width: fit-content; +} diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.html b/lib/content-services/src/lib/category/categories-management/categories-management.component.html index 1f67b7bccc8..5dae3295617 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.html +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.html @@ -1,8 +1,6 @@
{{ categoryNameErrorMessageKey | translate }}
-
+
- {{ category.name }} + {{ category.name }}

diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.scss b/lib/content-services/src/lib/category/categories-management/categories-management.component.scss index 32288cdf3a6..072bd026bf3 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.scss +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.scss @@ -1,17 +1,27 @@ -.adf-categories-management { - padding-top: 12px; +@import 'styles/mat-selectors'; +.adf-categories-management { .adf-category-name-field { - justify-content: space-between; - width: 100%; - color: var(--adf-metadata-property-panel-text-color); - background: var(--adf-metadata-buttons-background-color); - height: 32px; - border-radius: 12px; - align-items: center; + display: flex; + flex-direction: column; + margin-right: 12px; input { + background: var(--adf-metadata-buttons-background-color); + border-radius: 12px; padding: 7px 8px; + border: none; + outline: none; + font: inherit; + color: currentcolor; + margin: 0; + vertical-align: bottom; + text-align: inherit; + box-sizing: content-box; + } + + #{$mat-form-field-error} { + padding-top: 5px; } } @@ -46,7 +56,7 @@ background-color: inherit; color: inherit; - &:hover { + &:not(#{$mat-list-item-disabled}):hover { cursor: pointer; background: var(--adf-theme-mat-grey-color-a200); } @@ -68,9 +78,15 @@ } .adf-existing-categories-panel { + min-height: 22vh; + .adf-create-category-label { color: var(--theme-primary-color); cursor: pointer; overflow-wrap: anywhere; } + + #{$mat-list-item-disabled} #{$mat-list-item-primary-text} { + opacity: 1; + } } diff --git a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts index 4b5cd191e8e..2300f308ef4 100644 --- a/lib/content-services/src/lib/category/categories-management/categories-management.component.ts +++ b/lib/content-services/src/lib/category/categories-management/categories-management.component.ts @@ -31,10 +31,10 @@ interface CategoryNameControlErrors { } @Component({ - selector: 'adf-categories-management', - templateUrl: './categories-management.component.html', - styleUrls: ['./categories-management.component.scss'], - encapsulation: ViewEncapsulation.None + selector: 'adf-categories-management', + templateUrl: './categories-management.component.html', + styleUrls: ['./categories-management.component.scss'], + encapsulation: ViewEncapsulation.None }) export class CategoriesManagementComponent implements OnInit, OnDestroy { readonly nameErrorMessagesByErrors = new Map([ @@ -49,11 +49,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { private onDestroy$ = new Subject(); private _categoryNameControl = new FormControl( '', - [ - this.validateIfNotAlreadyAdded.bind(this), - this.validateEmptyCategory, - Validators.required - ], + [this.validateIfNotAlreadyAdded.bind(this), this.validateEmptyCategory, Validators.required], this.validateIfNotAlreadyCreated.bind(this) ); private _existingCategories: Category[]; @@ -78,23 +74,23 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { * * @param categoryNameControlVisible control visibility. */ - @Input() - set categoryNameControlVisible(categoryNameControlVisible: boolean) { - this._categoryNameControlVisible = categoryNameControlVisible; - if (categoryNameControlVisible) { - setTimeout(() => { - this.categoryNameInputElement.nativeElement.scrollIntoView(); - }); - this._existingCategoriesPanelVisible = true; - } else { + @Input() + set categoryNameControlVisible(categoryNameControlVisible: boolean) { + this._categoryNameControlVisible = categoryNameControlVisible; + if (categoryNameControlVisible) { + setTimeout(() => { + this.categoryNameInputElement.nativeElement.scrollIntoView(); + }); + this._existingCategoriesPanelVisible = true; + } else { this._existingCategoriesPanelVisible = false; this.clearCategoryNameInput(); - } - } + } + } - get categoryNameControlVisible(): boolean { - return this._categoryNameControlVisible; - } + get categoryNameControlVisible(): boolean { + return this._categoryNameControlVisible; + } /** Emits when classifiable aspect changes */ @Input() @@ -150,9 +146,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { ) .subscribe((name: string) => this.onNameControlValueChange(name)); - this.categoryNameControl.statusChanges - .pipe(takeUntil(this.onDestroy$)) - .subscribe(() => this.setCategoryNameControlErrorMessageKey()); + this.categoryNameControl.statusChanges.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.setCategoryNameControlErrorMessageKey()); this.setCategoryNameControlErrorMessageKey(); @@ -164,13 +158,11 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { this._categoryNameControl.removeValidators(Validators.required); this.categories.forEach((category) => this.initialCategories.push(category)); if (this.classifiableChanged) { - this.classifiableChanged - .pipe(takeUntil(this.onDestroy$)) - .subscribe(() => { - this.categories = []; - this.categoryNameControlVisible = false; - this.categoryNameControlVisibleChange.emit(false); - }); + this.classifiableChanged.pipe(takeUntil(this.onDestroy$)).subscribe(() => { + this.categories = []; + this.categoryNameControlVisible = false; + this.categoryNameControlVisibleChange.emit(false); + }); } } } @@ -188,7 +180,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { /* * Returns `true` if categories empty and category panel non editable state, otherwise `false` - */ + */ get showEmptyCategoryMessage(): boolean { return this.categories.length === 0 && !this.categoryNameControlVisible; } @@ -237,11 +229,13 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { * @param category - selection list change containing selected category */ addCategoryToAssign(category: Category) { - const selectedCategory: Category = category; - this.categories.push(selectedCategory); - this._existingCategories.splice(this._existingCategories.indexOf(selectedCategory), 1); - this.categoryNameControl.updateValueAndValidity(); - this.categoriesChange.emit(this.categories); + if (!(this.isCRUDMode || (!this.multiSelect && this.categories.length > 0))) { + const selectedCategory: Category = category; + this.categories.push(selectedCategory); + this._existingCategories.splice(this._existingCategories.indexOf(selectedCategory), 1); + this.categoryNameControl.updateValueAndValidity(); + this.categoriesChange.emit(this.categories); + } } /** @@ -275,7 +269,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { } private searchForExistingCategories(searchTerm: string) { - this.categoryService.searchCategories(searchTerm, 0 , this.existingCategoriesListLimit).subscribe((existingCategoriesResult) => { + this.categoryService.searchCategories(searchTerm, 0, this.existingCategoriesListLimit).subscribe((existingCategoriesResult) => { this._existingCategories = existingCategoriesResult.list.entries.map((rowEntry) => { const existingCat = new Category(); existingCat.id = rowEntry.entry.id; @@ -283,7 +277,9 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { existingCat.name = path ? `${path}/${rowEntry.entry.name}` : rowEntry.entry.name; return existingCat; }); - this._existingCategories = this._existingCategories.filter((existingCat) => this.categories.find((category) => existingCat.id === category.id) === undefined); + this._existingCategories = this._existingCategories.filter( + (existingCat) => this.categories.find((category) => existingCat.id === category.id) === undefined + ); this.sortCategoriesList(this._existingCategories); this._existingCategoriesLoading = false; this._typing = false; @@ -294,7 +290,9 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { private getChildrenCategories(searchTerm: string) { this.categoryService.getSubcategories(this.parentId).subscribe((childrenCategories) => { this._existingCategories = childrenCategories.list.entries.map((categoryEntry) => categoryEntry.entry); - this._existingCategories = this._existingCategories.filter((existingCat) => existingCat.name.toLowerCase().includes(searchTerm.toLowerCase())); + this._existingCategories = this._existingCategories.filter((existingCat) => + existingCat.name.toLowerCase().includes(searchTerm.toLowerCase()) + ); this.sortCategoriesList(this._existingCategories); this._existingCategoriesLoading = false; this._typing = false; @@ -308,11 +306,13 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { : null; } - private validateIfNotAlreadyCreated(nameControl: FormControl): Observable { + private validateIfNotAlreadyCreated(nameControl: FormControl): Observable { return this.existingCategoryLoaded$.pipe( - map(() => this.existingCategories.some((category) => this.compareCategories(category, nameControl.value)) && this.isCRUDMode + map(() => + this.existingCategories.some((category) => this.compareCategories(category, nameControl.value)) && this.isCRUDMode ? { duplicatedExistingCategory: true } - : null), + : null + ), first() ); } @@ -322,9 +322,7 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy { } private validateEmptyCategory(categoryNameControl: FormControl): CategoryNameControlErrors | null { - return categoryNameControl.value.length && !categoryNameControl.value.trim() - ? { emptyCategory: true } - : null; + return categoryNameControl.value.length && !categoryNameControl.value.trim() ? { emptyCategory: true } : null; } private setCategoryNameControlErrorMessageKey() { diff --git a/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts b/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts index 4ea2ece05e0..b318d337cc1 100644 --- a/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts +++ b/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { CoreTestingModule } from '@alfresco/adf-core'; import { fakeAsync, TestBed } from '@angular/core/testing'; import { CategoryService } from '../services/category.service'; import { CategoryNode, CategoryTreeDatasourceService } from '@alfresco/adf-content-services'; @@ -25,17 +24,12 @@ import { EMPTY, of } from 'rxjs'; import { Pagination } from '@alfresco/js-api'; describe('CategoryTreeDatasourceService', () => { - let categoryTreeDatasourceService: CategoryTreeDatasourceService; - let categoryService: CategoryService; + let categoryTreeDatasourceService: CategoryTreeDatasourceService; + let categoryService: CategoryService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - CoreTestingModule - ], - providers: [ - { provide: CategoryService, useClass: CategoryServiceMock } - ] + providers: [CategoryTreeDatasourceService, { provide: CategoryService, useClass: CategoryServiceMock }] }); categoryTreeDatasourceService = TestBed.inject(CategoryTreeDatasourceService); @@ -44,7 +38,7 @@ describe('CategoryTreeDatasourceService', () => { it('should get root level categories', fakeAsync(() => { spyOn(categoryTreeDatasourceService, 'getParentNode').and.returnValue(undefined); - categoryTreeDatasourceService.getSubNodes(null, 0 , 100).subscribe((treeResponse: TreeResponse) => { + categoryTreeDatasourceService.getSubNodes(null, 0, 100).subscribe((treeResponse: TreeResponse) => { expect(treeResponse.entries.length).toBe(1); expect(treeResponse.entries[0].level).toBe(0); expect(treeResponse.entries[0].nodeType).toBe(TreeNodeType.RegularNode); @@ -62,7 +56,7 @@ describe('CategoryTreeDatasourceService', () => { nodeType: TreeNodeType.RegularNode }; spyOn(categoryTreeDatasourceService, 'getParentNode').and.returnValue(parentNode); - categoryTreeDatasourceService.getSubNodes(parentNode.id, 0 , 100).subscribe((treeResponse: TreeResponse) => { + categoryTreeDatasourceService.getSubNodes(parentNode.id, 0, 100).subscribe((treeResponse: TreeResponse) => { expect(treeResponse.entries.length).toBe(2); expect(treeResponse.entries[0].parentId).toBe(parentNode.id); expect(treeResponse.entries[0].level).toBe(1); @@ -84,7 +78,8 @@ describe('CategoryTreeDatasourceService', () => { }); it('should call getCategory for every instance if value of name parameter is defined', (done) => { - spyOn(categoryService, 'getCategory').and.returnValues(of({ + spyOn(categoryService, 'getCategory').and.returnValues( + of({ entry: { name: 'name', id: 'some id 1', @@ -97,18 +92,18 @@ describe('CategoryTreeDatasourceService', () => { id: 'some id 2', hasChildren: false } - })); - categoryTreeDatasourceService.getSubNodes('id', undefined, undefined, 'name') - .subscribe(() => { - - expect(categoryService.getCategory).toHaveBeenCalledWith('some id 1'); - expect(categoryService.getCategory).toHaveBeenCalledWith('some id 2'); - done(); - }); + }) + ); + categoryTreeDatasourceService.getSubNodes('id', undefined, undefined, 'name').subscribe(() => { + expect(categoryService.getCategory).toHaveBeenCalledWith('some id 1'); + expect(categoryService.getCategory).toHaveBeenCalledWith('some id 2'); + done(); + }); }); it('should return observable which emits correct categories', (done) => { - spyOn(categoryService, 'getCategory').and.returnValues(of({ + spyOn(categoryService, 'getCategory').and.returnValues( + of({ entry: { name: 'some name', id: 'some id 1', @@ -121,14 +116,15 @@ describe('CategoryTreeDatasourceService', () => { id: 'some id 2', hasChildren: false } - })); - categoryTreeDatasourceService.getSubNodes('id', undefined, undefined, 'name') - .subscribe((response) => { - const pagination = new Pagination(); - pagination.count = 2; - expect(response).toEqual({ - pagination, - entries: [{ + }) + ); + categoryTreeDatasourceService.getSubNodes('id', undefined, undefined, 'name').subscribe((response) => { + const pagination = new Pagination(); + pagination.count = 2; + expect(response).toEqual({ + pagination, + entries: [ + { id: 'some id 1', nodeName: 'some name', parentId: 'parent id 1', @@ -136,7 +132,8 @@ describe('CategoryTreeDatasourceService', () => { nodeType: TreeNodeType.RegularNode, hasChildren: true, isLoading: false - }, { + }, + { id: 'some id 2', nodeName: 'Language/some other name', parentId: 'parent id 2', @@ -144,9 +141,10 @@ describe('CategoryTreeDatasourceService', () => { nodeType: TreeNodeType.RegularNode, hasChildren: false, isLoading: false - }] - }); - done(); + } + ] }); + done(); + }); }); }); diff --git a/lib/content-services/src/lib/category/services/category.service.spec.ts b/lib/content-services/src/lib/category/services/category.service.spec.ts index 16890ad5e12..21bce87407b 100644 --- a/lib/content-services/src/lib/category/services/category.service.spec.ts +++ b/lib/content-services/src/lib/category/services/category.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AppConfigService, CoreTestingModule, UserPreferencesService } from '@alfresco/adf-core'; +import { AppConfigService, TranslationMock, TranslationService, UserPreferencesService } from '@alfresco/adf-core'; import { CategoryBody, CategoryEntry, @@ -29,6 +29,8 @@ import { } from '@alfresco/js-api'; import { fakeAsync, TestBed } from '@angular/core/testing'; import { CategoryService } from './category.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { TranslateModule } from '@ngx-translate/core'; describe('CategoryService', () => { let categoryService: CategoryService; @@ -44,7 +46,8 @@ describe('CategoryService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [HttpClientTestingModule, TranslateModule.forRoot()], + providers: [CategoryService, UserPreferencesService, { provide: TranslationService, useClass: TranslationMock }] }); categoryService = TestBed.inject(CategoryService); diff --git a/lib/content-services/src/lib/common/services/content.service.spec.ts b/lib/content-services/src/lib/common/services/content.service.spec.ts index edbd2f860d6..71bdd1017c4 100644 --- a/lib/content-services/src/lib/common/services/content.service.spec.ts +++ b/lib/content-services/src/lib/common/services/content.service.spec.ts @@ -17,8 +17,10 @@ import { TestBed } from '@angular/core/testing'; import { ContentService } from './content.service'; -import { AppConfigService, AuthenticationService, StorageService, CoreTestingModule } from '@alfresco/adf-core'; +import { AppConfigService, AuthenticationService, RedirectAuthService, StorageService } from '@alfresco/adf-core'; import { Node, PermissionsInfo } from '@alfresco/js-api'; +import { EMPTY, of } from 'rxjs'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('ContentService', () => { let contentService: ContentService; @@ -27,7 +29,8 @@ describe('ContentService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [HttpClientTestingModule], + providers: [ContentService, AuthenticationService, { provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }] }); authService = TestBed.inject(AuthenticationService); contentService = TestBed.inject(ContentService); diff --git a/lib/content-services/src/lib/common/services/people-content.service.spec.ts b/lib/content-services/src/lib/common/services/people-content.service.spec.ts index 9dc0acac959..eff52f8f770 100644 --- a/lib/content-services/src/lib/common/services/people-content.service.spec.ts +++ b/lib/content-services/src/lib/common/services/people-content.service.spec.ts @@ -16,17 +16,23 @@ */ import { createNewPersonMock, fakeEcmAdminUser, fakeEcmUser, fakeEcmUser2, fakeEcmUserList } from '../mocks/ecm-user.service.mock'; -import { AlfrescoApiService, AlfrescoApiServiceMock, CoreTestingModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock, RedirectAuthService } from '@alfresco/adf-core'; import { PeopleContentQueryRequestModel, PeopleContentService } from './people-content.service'; import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { EMPTY, of } from 'rxjs'; describe('PeopleContentService', () => { let peopleContentService: PeopleContentService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], - providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] + imports: [HttpClientTestingModule], + providers: [ + PeopleContentService, + { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, + { provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } } + ] }); peopleContentService = TestBed.inject(PeopleContentService); diff --git a/lib/content-services/src/lib/common/services/rendition.service.ts b/lib/content-services/src/lib/common/services/rendition.service.ts index 002bfe6453a..e0fc85e1333 100644 --- a/lib/content-services/src/lib/common/services/rendition.service.ts +++ b/lib/content-services/src/lib/common/services/rendition.service.ts @@ -257,17 +257,14 @@ export class RenditionService { printFile(url: string, type: string): void { const pwa = window.open(url, RenditionService.TARGET); if (pwa) { - // Because of the way chrome focus and close image window vs. pdf preview window - if (type === RenditionService.ContentGroup.IMAGE) { - pwa.onfocus = () => { + pwa.onload = () => { + pwa.print(); + if (type === RenditionService.ContentGroup.IMAGE) { + // Because of the way chrome focus and close image window vs. pdf preview window setTimeout(() => { pwa.close(); }, 500); - }; - } - - pwa.onload = () => { - pwa.print(); + } }; } } diff --git a/lib/content-services/src/lib/common/services/upload.service.spec.ts b/lib/content-services/src/lib/common/services/upload.service.spec.ts index 3a0be5ca6f2..4dddb0d1e9b 100644 --- a/lib/content-services/src/lib/common/services/upload.service.spec.ts +++ b/lib/content-services/src/lib/common/services/upload.service.spec.ts @@ -17,12 +17,13 @@ import { EventEmitter } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { AppConfigService, CoreTestingModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { UploadService } from './upload.service'; import { RepositoryInfo } from '@alfresco/js-api'; import { BehaviorSubject } from 'rxjs'; import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { FileModel, FileUploadStatus } from '../../common/models/file.model'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; declare let jasmine: any; @@ -35,8 +36,11 @@ describe('UploadService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [AppConfigModule, HttpClientTestingModule], providers: [ + UploadService, + { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, + { provide: AppConfigService, useClass: AppConfigServiceMock }, { provide: DiscoveryApiService, useValue: { @@ -281,9 +285,7 @@ describe('UploadService', () => { service.cancelUpload(...file); const request = jasmine.Ajax.requests.mostRecent(); - expect(request.url).toBe( - 'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fakeId/content?include=allowableOperations' - ); + expect(request.url).toContain('ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fakeId/content?include=allowableOperations'); expect(request.method).toBe('PUT'); jasmine.Ajax.requests.mostRecent().respondWith({ @@ -338,8 +340,8 @@ describe('UploadService', () => { service.uploadFilesInTheQueue(emitter); const request = jasmine.Ajax.requests.mostRecent(); - expect(request.url).toBe( - 'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true&include=allowableOperations' + expect(request.url).toContain( + '/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true&include=allowableOperations' ); expect(request.method).toBe('POST'); diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html index b45511e8cb7..756751988b2 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.html @@ -1,4 +1,4 @@ -