Skip to content

Commit

Permalink
Content Edit: Allow Drag&Drop and select file (#26618)
Browse files Browse the repository at this point in the history
* dev: fix choose file button

* dev: add test
  • Loading branch information
rjvelazco authored Nov 13, 2023
1 parent d856431 commit 307d112
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<button
class="binary-field__drop-zone-btn"
(click)="openFilePicker()"
type="button"
data-testId="choose-file-btn">
{{ 'dot.binary.field.action.choose.file' | dm }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ describe('DotBinaryFieldComponent', () => {
const spyInputFile = jest.spyOn(spectator.component.inputFile.nativeElement, 'click');
const chooseFile = spectator.query(byTestId('choose-file-btn')) as HTMLButtonElement;
chooseFile.click();
expect(chooseFile.getAttribute('type')).toBe('button');
expect(spyOpenFilePicker).toHaveBeenCalled();
expect(spyInputFile).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export class DotBinaryFieldComponent
const variable = this.field.variable;
const metaDataKey = variable + 'MetaData';
const { titleImage, inode, [metaDataKey]: metadata } = this.contentlet;
const { contentType: mimeType } = metadata;
const { contentType: mimeType } = metadata || {};

this.dotBinaryFieldStore.setFileAndContent({
inode,
Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/webapp/html/binary-field.js

Large diffs are not rendered by default.

0 comments on commit 307d112

Please sign in to comment.