diff --git a/e2e/content-services/components/comment-component.e2e.ts b/e2e/content-services/components/comment-component.e2e.ts index bea4c42ff4..f6542aa69e 100644 --- a/e2e/content-services/components/comment-component.e2e.ts +++ b/e2e/content-services/components/comment-component.e2e.ts @@ -32,17 +32,17 @@ import CONSTANTS = require('../../util/constants'); import { SitesApi, SiteEntry, CommentsApi } from '@alfresco/js-api'; describe('Comment', () => { - - const loginPage: LoginPage = new LoginPage(); - const contentServicesPage: ContentServicesPage = new ContentServicesPage(); - const viewerPage: ViewerPage = new ViewerPage(); - const commentsPage: CommentsPage = new CommentsPage(); + const loginPage = new LoginPage(); + const contentServicesPage = new ContentServicesPage(); + const viewerPage = new ViewerPage(); + const commentsPage = new CommentsPage(); const navigationBarPage = new NavigationBarPage(); const apiService = createApiService(); const commentsApi = new CommentsApi(apiService.getInstance()); - let userFullName; let nodeId; + let userFullName: string; + let nodeId: string; let acsUser: UserModel; const pngFileModel = new FileModel({ @@ -57,11 +57,6 @@ describe('Comment', () => { first: 'This is a comment', multiline: 'This is a comment\n' + 'with a new line', second: 'This is another comment', - codeType: `
`, test: 'Test' }; @@ -149,22 +144,6 @@ describe('Comment', () => { await expect(await commentsPage.getUserName(0)).toEqual(userFullName); await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/); }); - - it('[C280022] Should treat HTML code as a regular string', async () => { - const resultStr = comments.codeType.replace(/\s\s+/g, ' '); - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await viewerPage.clickOnCommentsTab(); - - await commentsPage.addComment(comments.codeType); - await commentsPage.checkUserIconIsDisplayed(); - - await commentsPage.getTotalNumberOfComments('Comments (1)'); - await expect(await commentsPage.getMessage(0)).toEqual(resultStr); - await expect(await commentsPage.getUserName(0)).toEqual(userFullName); - await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/); - }); }); describe('Consumer Permissions', () => { diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index 3a2383ff6c..20308007c7 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -13,5 +13,13 @@ "C280063": "https://alfresco.atlassian.net/browse/ACS-4595", "C280064": "https://alfresco.atlassian.net/browse/ACS-4595", "C280407": "https://alfresco.atlassian.net/browse/ACS-4595", - "C277288": "https://alfresco.atlassian.net/browse/AAE-15475" + "C277288": "https://alfresco.atlassian.net/browse/AAE-15475", + "C280054": "https://alfresco.atlassian.net/browse/ACS-5742", + "C280058": "https://alfresco.atlassian.net/browse/ACS-5742", + "C286298": "https://alfresco.atlassian.net/browse/ACS-5742", + "C277146": "https://alfresco.atlassian.net/browse/ACS-5742", + "C286556": "https://alfresco.atlassian.net/browse/ACS-5742", + "C291802": "https://alfresco.atlassian.net/browse/ACS-5742", + "C277280": "https://alfresco.atlassian.net/browse/ACS-5742", + "C277281": "https://alfresco.atlassian.net/browse/ACS-5742" } diff --git a/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts b/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts index 96978db881..c608dee260 100644 --- a/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts +++ b/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts @@ -149,63 +149,63 @@ export const testUser: EcmUserModel = { export const getDateXMinutesAgo = (minutes: number) => new Date(new Date().getTime() - minutes * 60000); export const commentsNodeData: CommentModel[] = [ - { + new CommentModel({ id: 1, message: `I've done this component, is it cool?`, created: getDateXMinutesAgo(30), createdBy: johnDoe, isSelected: false - }, - { + }), + new CommentModel({ id: 2, message: 'Yeah', created: getDateXMinutesAgo(15), createdBy: janeEod, isSelected: false - }, - { + }), + new CommentModel({ id: 3, message: '+1', created: getDateXMinutesAgo(12), createdBy: robertSmith, isSelected: false - }, - { + }), + new CommentModel({ id: 4, message: 'ty', created: new Date(), createdBy: johnDoe, isSelected: false - } + }) ]; export const commentsTaskData: CommentModel[] = [ - { + new CommentModel({ id: 1, message: `I've done this task, what's next?`, created: getDateXMinutesAgo(30), createdBy: johnDoe, isSelected: false - }, - { + }), + new CommentModel({ id: 2, message: `I've assigned you another one 🤠`, created: getDateXMinutesAgo(15), createdBy: janeEod, isSelected: false - }, - { + }), + new CommentModel({ id: 3, message: '+1', created: getDateXMinutesAgo(12), createdBy: robertSmith, isSelected: false - }, - { + }), + new CommentModel({ id: 4, message: 'Cheers', created: new Date(), createdBy: johnDoe, isSelected: false - } + }) ]; diff --git a/lib/core/karma.conf.js b/lib/core/karma.conf.js index 4c1aab8ba4..14258dd8af 100644 --- a/lib/core/karma.conf.js +++ b/lib/core/karma.conf.js @@ -89,7 +89,7 @@ module.exports = function (config) { global: { statements: 75, branches: 67, - functions: 73, + functions: 72, lines: 75 } } diff --git a/lib/core/src/lib/comments/comment-list/comment-list.component.html b/lib/core/src/lib/comments/comment-list/comment-list.component.html index 89b2f566e0..0577eb0d04 100644 --- a/lib/core/src/lib/comments/comment-list/comment-list.component.html +++ b/lib/core/src/lib/comments/comment-list/comment-list.component.html @@ -1,30 +1,17 @@
are
paragraphs'); + expect(addCommentSpy).toHaveBeenCalledWith('123', commentText); + + const messageElement = fixture.nativeElement.querySelector('.adf-comment-message'); + expect(messageElement.innerText).toBe(commentText); }); it('should call service to add a comment when add button is pressed', async () => { diff --git a/lib/core/src/lib/comments/comments.component.ts b/lib/core/src/lib/comments/comments.component.ts index a0192abae3..9a1a6c9487 100644 --- a/lib/core/src/lib/comments/comments.component.ts +++ b/lib/core/src/lib/comments/comments.component.ts @@ -19,15 +19,13 @@ import { CommentModel } from '../models/comment.model'; import { Component, EventEmitter, - Inject, + inject, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { Observable, Observer } from 'rxjs'; -import { share } from 'rxjs/operators'; import { ADF_COMMENTS_SERVICE } from './interfaces/comments.token'; import { CommentsService } from './interfaces/comments-service.interface'; @@ -49,27 +47,13 @@ export class CommentsComponent implements OnChanges { /** Emitted when an error occurs while displaying/adding a comment. */ @Output() - error: EventEmitter
'); - } } diff --git a/lib/core/src/lib/comments/interfaces/index.ts b/lib/core/src/lib/comments/interfaces/index.ts deleted file mode 100644 index e58e5c1c41..0000000000 --- a/lib/core/src/lib/comments/interfaces/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export * from './public-api'; diff --git a/lib/core/src/lib/comments/interfaces/public-api.ts b/lib/core/src/lib/comments/interfaces/public-api.ts deleted file mode 100644 index cd194a149c..0000000000 --- a/lib/core/src/lib/comments/interfaces/public-api.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export * from './comments-service.interface'; -export * from './comments.token'; diff --git a/lib/core/src/lib/comments/mocks/comments.service.mock.ts b/lib/core/src/lib/comments/mocks/comments.service.mock.ts index d647d364ca..4775c0d5ee 100644 --- a/lib/core/src/lib/comments/mocks/comments.service.mock.ts +++ b/lib/core/src/lib/comments/mocks/comments.service.mock.ts @@ -17,7 +17,7 @@ import { CommentModel, User } from '../../models'; import { Observable, of } from 'rxjs'; -import { CommentsService } from '../interfaces'; +import { CommentsService } from '../interfaces/comments-service.interface'; export class CommentsServiceMock implements Partial