Restructure click shield (#1611)

* Rename one-click-embedding to click shield
* Removes the static fallback image from the vimeo frame. The set URL is broken.
* Adds the ability to define background colors for the click shield background


Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-11-14 18:44:55 +01:00 committed by GitHub
parent c731c0e9f1
commit e9defd60dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 209 additions and 155 deletions

View file

@ -14,7 +14,8 @@ describe('Link gets replaced with embedding: ', () => {
it('GitHub Gist', () => {
cy.setCodemirrorContent('https://gist.github.com/schacon/1')
cy.getMarkdownBody()
.find('.one-click-embedding.gist-frame')
.find('[data-cypress-id="click-shield-gist"] .preview-background')
.parent()
.click()
cy.getMarkdownBody()
.find('iframe[data-cypress-id=gh-gist]')
@ -24,7 +25,7 @@ describe('Link gets replaced with embedding: ', () => {
it('YouTube', () => {
cy.setCodemirrorContent('https://www.youtube.com/watch?v=YE7VzlLtp-4')
cy.getMarkdownBody()
.find('.one-click-embedding-preview')
.find('[data-cypress-id="click-shield-youtube"] .preview-background')
.should('have.attr', 'src', 'https://i.ytimg.com/vi/YE7VzlLtp-4/maxresdefault.jpg')
.parent()
.click()
@ -46,7 +47,7 @@ describe('Link gets replaced with embedding: ', () => {
})
cy.setCodemirrorContent('https://vimeo.com/23237102')
cy.getMarkdownBody()
.find('.one-click-embedding-preview')
.find('[data-cypress-id="click-shield-vimeo"] .preview-background')
.should('have.attr', 'src', 'https://i.vimeocdn.com/video/503631401_640.jpg')
.parent()
.click()
@ -58,7 +59,7 @@ describe('Link gets replaced with embedding: ', () => {
it('Asciinema', () => {
cy.setCodemirrorContent('https://asciinema.org/a/117928')
cy.getMarkdownBody()
.find('.one-click-embedding-preview')
.find('[data-cypress-id="click-shield-asciinema"] .preview-background')
.should('have.attr', 'src', 'https://asciinema.org/a/117928.png')
.parent()
.click()

View file

@ -37,10 +37,10 @@ describe('Short code gets replaced or rendered: ', () => {
})
describe('youtube', () => {
it('renders one-click-embedding', () => {
it('renders click-shield', () => {
cy.setCodemirrorContent(`{%youtube YE7VzlLtp-4 %}`)
cy.getMarkdownBody()
.find('.one-click-embedding.embed-responsive-item')
.find('[data-cypress-id="click-shield-youtube"]')
})
})
})