forked from decaporg/decap-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(media-library): add copy to clipboard, allow avif (decaporg#4914)
- Loading branch information
Showing
8 changed files
with
162 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/netlify-cms-core/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { CopyToClipBoardButton } from '../MediaLibraryButtons'; | ||
import { render } from '@testing-library/react'; | ||
|
||
describe('CopyToClipBoardButton', () => { | ||
const props = { | ||
disabled: false, | ||
t: jest.fn(key => key), | ||
}; | ||
|
||
it('should use copy text when no path is defined', () => { | ||
const { container } = render(<CopyToClipBoardButton {...props} />); | ||
|
||
expect(container).toHaveTextContent('mediaLibrary.mediaLibraryCard.copy'); | ||
}); | ||
|
||
it('should use copyUrl text when path is absolute and is draft', () => { | ||
const { container } = render( | ||
<CopyToClipBoardButton {...props} path="https://www.images.com/image.png" draft />, | ||
); | ||
|
||
expect(container).toHaveTextContent('mediaLibrary.mediaLibraryCard.copyUrl'); | ||
}); | ||
|
||
it('should use copyUrl text when path is absolute and is not draft', () => { | ||
const { container } = render( | ||
<CopyToClipBoardButton {...props} path="https://www.images.com/image.png" />, | ||
); | ||
|
||
expect(container).toHaveTextContent('mediaLibrary.mediaLibraryCard.copyUrl'); | ||
}); | ||
|
||
it('should use copyName when path is not absolute and is draft', () => { | ||
const { container } = render(<CopyToClipBoardButton {...props} path="image.png" draft />); | ||
|
||
expect(container).toHaveTextContent('mediaLibrary.mediaLibraryCard.copyName'); | ||
}); | ||
|
||
it('should use copyPath when path is not absolute and is not draft', () => { | ||
const { container } = render(<CopyToClipBoardButton {...props} path="image.png" />); | ||
|
||
expect(container).toHaveTextContent('mediaLibrary.mediaLibraryCard.copyPath'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters