diff --git a/packages/components/psammead-social-embed/src/__snapshots__/index.test.jsx.snap b/packages/components/psammead-social-embed/src/__snapshots__/index.test.jsx.snap index b04db189a3..b966a86bd2 100644 --- a/packages/components/psammead-social-embed/src/__snapshots__/index.test.jsx.snap +++ b/packages/components/psammead-social-embed/src/__snapshots__/index.test.jsx.snap @@ -838,7 +838,7 @@ exports[`CanonicalSocialEmbed Twitter should render correctly for Twitter 1`] = `; -exports[`CanonicalSocialEmbed should render a notice when the provider is unsupported 1`] = ` +exports[`CanonicalSocialEmbed YouTube should render correctly for YouTube 1`] = ` .emotion-0 { position: relative; } @@ -887,60 +887,67 @@ exports[`CanonicalSocialEmbed should render a notice when the provider is unsupp } .emotion-4 { - font-family: ReithSans,Helvetica,Arial,sans-serif; - font-weight: 400; - font-style: normal; - font-size: 0.9375rem; - line-height: 1.25rem; - border: 0.0625rem solid #AEAEB5; - border-radius: 0.5rem; - color: #3F3F42; - padding: 1rem; -} - -@media (min-width: 20rem) { - .emotion-4 { - font-size: 1rem; - line-height: 1.375rem; - } + background-color: #000000; + margin: 0; } -.emotion-4 p { - margin-top: 0; - margin-bottom: 0.5rem; +.emotion-6 { + padding-top: 56.25%; + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; } -.emotion-4 a, -.emotion-4 small { - display: block; +.emotion-6>iframe { + border: none; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; } -.emotion-4 a { +.emotion-8 { font-family: ReithSans,Helvetica,Arial,sans-serif; - font-weight: 700; + font-weight: 400; font-style: normal; - color: #222222; - -webkit-text-decoration: none; - text-decoration: none; + font-size: 0.875rem; + line-height: 1rem; + color: #FFFFFF; + padding: 0.5rem; } -.emotion-4 a:visited { - color: #6E6E73; +@media (min-width: 20rem) and (max-width: 37.4375rem) { + .emotion-8 { + line-height: 1.125rem; + } } -.emotion-4 a:hover, -.emotion-4 a:focus { - -webkit-text-decoration: underline; - text-decoration: underline; +@media (min-width: 37.5rem) { + .emotion-8 { + font-size: 0.8125rem; + } } -.emotion-4 small { - margin-top: 0.5rem; - font-size: 0.75rem; - line-height: 1rem; +.emotion-8>span { + -webkit-clip-path: inset(100%); + clip-path: inset(100%); + clip: rect(1px, 1px, 1px, 1px); + height: 1px; + overflow: hidden; + position: absolute; + width: 1px; + margin: 0; } -.emotion-6 { +.emotion-10 { -webkit-clip-path: inset(100%); clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); @@ -951,44 +958,50 @@ exports[`CanonicalSocialEmbed should render a notice when the provider is unsupp margin: 0; } -
+ End of YouTube content +
- End of Twitter content + End of unknown content
`; -exports[`CanonicalSocialEmbed should render correctly for YouTube 1`] = ` +exports[`CanonicalSocialEmbed should render a notice when there is no oEmbed response 1`] = ` .emotion-0 { position: relative; } @@ -1187,67 +1200,60 @@ exports[`CanonicalSocialEmbed should render correctly for YouTube 1`] = ` } .emotion-4 { - background-color: #000000; - margin: 0; + font-family: ReithSans,Helvetica,Arial,sans-serif; + font-weight: 400; + font-style: normal; + font-size: 0.9375rem; + line-height: 1.25rem; + border: 0.0625rem solid #AEAEB5; + border-radius: 0.5rem; + color: #3F3F42; + padding: 1rem; } -.emotion-6 { - padding-top: 56.25%; - position: relative; - overflow: hidden; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; +@media (min-width: 20rem) { + .emotion-4 { + font-size: 1rem; + line-height: 1.375rem; + } } -.emotion-6>iframe { - border: none; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; +.emotion-4 p { + margin-top: 0; + margin-bottom: 0.5rem; } -.emotion-8 { +.emotion-4 a, +.emotion-4 small { + display: block; +} + +.emotion-4 a { font-family: ReithSans,Helvetica,Arial,sans-serif; - font-weight: 400; + font-weight: 700; font-style: normal; - font-size: 0.875rem; - line-height: 1rem; - color: #FFFFFF; - padding: 0.5rem; + color: #222222; + -webkit-text-decoration: none; + text-decoration: none; } -@media (min-width: 20rem) and (max-width: 37.4375rem) { - .emotion-8 { - line-height: 1.125rem; - } +.emotion-4 a:visited { + color: #6E6E73; } -@media (min-width: 37.5rem) { - .emotion-8 { - font-size: 0.8125rem; - } +.emotion-4 a:hover, +.emotion-4 a:focus { + -webkit-text-decoration: underline; + text-decoration: underline; } -.emotion-8>span { - -webkit-clip-path: inset(100%); - clip-path: inset(100%); - clip: rect(1px, 1px, 1px, 1px); - height: 1px; - overflow: hidden; - position: absolute; - width: 1px; - margin: 0; +.emotion-4 small { + margin-top: 0.5rem; + font-size: 0.75rem; + line-height: 1rem; } -.emotion-10 { +.emotion-6 { -webkit-clip-path: inset(100%); clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); @@ -1258,45 +1264,39 @@ exports[`CanonicalSocialEmbed should render correctly for YouTube 1`] = ` margin: 0; } - `; diff --git a/packages/components/psammead-social-embed/src/index.test.jsx b/packages/components/psammead-social-embed/src/index.test.jsx index 108690e3c9..b096a179ba 100644 --- a/packages/components/psammead-social-embed/src/index.test.jsx +++ b/packages/components/psammead-social-embed/src/index.test.jsx @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import React from 'react'; import { render, waitFor } from '@testing-library/react'; import { shouldMatchSnapshot } from '@bbc/psammead-test-helpers'; @@ -6,10 +7,19 @@ import fixtures from './fixtures'; import * as useScript from './Canonical/useScript'; const useScriptSpy = jest.spyOn(useScript, 'default'); +const mockOnRender = jest.fn(); describe('CanonicalSocialEmbed', () => { + const { error } = global.console; + + beforeEach(() => { + global.console.error = jest.fn(); + }); + + afterEach(() => { + global.console.error = error; + }); describe('Twitter', () => { - const mockOnRender = jest.fn(); const twitterSocialEmbed = (