mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5645] added test cases for tags component
This commit is contained in:
+3
-3
@@ -240,16 +240,16 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isEmpty', () => {
|
describe('isCategoryEmpty', () => {
|
||||||
it('should return true when categories is not empty', () => {
|
it('should return true when categories is not empty', () => {
|
||||||
component.categories = [category3, category4];
|
component.categories = [category3, category4];
|
||||||
const result = component.isEmpty;
|
const result = component.isCategoryEmpty;
|
||||||
expect(result).toBeTrue();
|
expect(result).toBeTrue();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false when categories is empty', () => {
|
it('should return false when categories is empty', () => {
|
||||||
component.categories = [];
|
component.categories = [];
|
||||||
const result = component.isEmpty;
|
const result = component.isCategoryEmpty;
|
||||||
expect(result).toBeFalse();
|
expect(result).toBeFalse();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -322,6 +322,34 @@ describe('TagsCreatorComponent', () => {
|
|||||||
expect(getNameInput()).toBe(document.activeElement as HTMLInputElement);
|
expect(getNameInput()).toBe(document.activeElement as HTMLInputElement);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('isNameTagsVisible', () => {
|
||||||
|
it('should return true when tagNameControlVisible is true', () => {
|
||||||
|
component.tagNameControlVisible = true;
|
||||||
|
const result = component.isNameTagsVisible;
|
||||||
|
expect(result).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when tagNameControlVisible is false and tags length is 0', () => {
|
||||||
|
component.tagNameControlVisible = false;
|
||||||
|
component.tags = [];
|
||||||
|
const result = component.isNameTagsVisible;
|
||||||
|
expect(result).toBeFalse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('isTagsEmpty', () => {
|
||||||
|
it('should return true when tags is not empty', () => {
|
||||||
|
component.tags = ['new tag 1', 'new tag 2'];
|
||||||
|
const result = component.isTagsEmpty;
|
||||||
|
expect(result).toBeTrue();
|
||||||
|
});
|
||||||
|
it('should return false when tags is empty', () => {
|
||||||
|
component.tags = [];
|
||||||
|
const result = component.isTagsEmpty;
|
||||||
|
expect(result).toBeFalse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Errors', () => {
|
describe('Errors', () => {
|
||||||
/**
|
/**
|
||||||
* Get first error
|
* Get first error
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
if (tagNameControlVisible) {
|
if (tagNameControlVisible) {
|
||||||
this._existingTagsPanelVisible = true;
|
this._existingTagsPanelVisible = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.tagNameInputElement.nativeElement.scrollIntoView();
|
this.tagNameInputElement?.nativeElement?.scrollIntoView();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._existingTagsPanelVisible = false;
|
this._existingTagsPanelVisible = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user