Skip to content

Commit

Permalink
Issue #SB-24073 fix: User does not have option to Provide name,langua…
Browse files Browse the repository at this point in the history
…ge,creator name and tag while uploading image
  • Loading branch information
santoshilimi committed May 11, 2021
1 parent 1babbfe commit c8cea39
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# compiled output
/dist
/projects/collection-editor-library/coverage
/tmp
/out-tsc
# Only exists if Bazel was run
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
export const mockData = {
assetBrowserEvent : {
type: 'image',
url: 'apple.png'
}
assetBrowserEvent: {
type: 'image',
url: 'apple.png'
},
event: {
target: {
files: [{
lastModified: 1602826982711,
lastModifiedDate: 'Fri Oct 16 2020 11:13:02 GMT+0530 (India Standard Time)',
name: "logo.png",
size: 63344,
type: "image/png",
webkitRelativePath: ""
}]
}
},
formData: {
channel: "01307938306521497658",
createdBy: "5a587cc1-e018-4859-a0a8-e842650b9d64",
creator: "Vaibahv Bhuva",
mediaType: "image",
mimeType: "image/png",
keywords: undefined,
name: "logo"
},
uploadIconFormConfig:
[{
'code': 'name',
'dataType': 'text',
'editable': true,
'inputType': 'text',
'label': 'Asset Caption',
'name': 'Asset Caption',
'placeholder': 'Enter asset caption',
'renderingHints': {
'class': 'sb-g-col-lg-2 required'
},
'required': true,
'visible': true,
'validations': [
{
'type': 'required',
'message': 'Please enter asset caption'
}
]
},
{
'code': 'keywords',
'visible': true,
'editable': true,
'dataType': 'list',
'name': 'Tags',
'placeholder': 'Add tag',
'renderingHints': {
'class': 'sb-g-col-lg-2'
},
'description': '',
'inputType': 'keywords',
'label': 'Tags',
'required': true,
'validations': []
},
{
'code': 'creator',
'dataType': 'text',
'editable': true,
'inputType': 'text',
'label': 'Creator',
'name': 'Creator',
'placeholder': 'Enter name',
'renderingHints': {
'class': 'sb-g-col-lg-2'
},
'required': true,
'visible': true
}]
};
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,51 @@ describe('AssetBrowserComponent', () => {
expect(component.searchAllInput).toEqual('');
expect(component.getAllImages).toHaveBeenCalledWith(0, '', true );
});
it('#ngOnInit() should call ngOnInit and define formConfig', () => {
component.ngOnInit();
expect(component.formConfig).toBeDefined();
});
it('#uploadImageTab() should call uploadImageTab and define isUploadTab ', () => {
component.uploadImageTab();
expect(component.isUploadTab).toBeTruthy();
});
it('#onStatusChanges() should call onStatusChanges and imageUploadLoader is false', () => {
component.imageUploadLoader = false;
const data = {controls: [],
isDirty: true,
isInvalid: false,
isPristine: false,
isValid: true};
component.onStatusChanges(data);
expect(component.imageFormValid).toBeFalsy();
});
it('#onStatusChanges() should call onStatusChanges and imageUploadLoader is true and is form valid false', () => {
component.imageUploadLoader = true;
const data = {controls: [],
isDirty: true,
isInvalid: false,
isPristine: false,
isValid: false};
component.onStatusChanges(data);
expect(component.imageFormValid).toBeFalsy();
});
it('#onStatusChanges() should call onStatusChanges and imageUploadLoader is true and is form valid true', () => {
component.imageUploadLoader = true;
const data = {controls: [],
isDirty: true,
isInvalid: false,
isPristine: false,
isValid: true};
component.onStatusChanges(data);
expect(component.imageFormValid).toBeTruthy();
});
it('#valueChanges() should define assestRequestBody ', () => {
component.imageUploadLoader = true;
component.assestRequestBody = mockData.formData;
const data = { creator: "Vaibahv Bhuva",
keywords: undefined,
name: "logo"};
component.valueChanges(data);
expect(component.assestRequestBody).toBeDefined();
});
});

0 comments on commit c8cea39

Please sign in to comment.