Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed Block: Fix Aspect Ratio Classes #29641 #41141

Merged
merged 4 commits into from
Mar 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add unit test for hasAspectRatioClass
  • Loading branch information
TylerB24890 committed Feb 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 80fac253e0e8af7c18d53e96a57a4c9b03abd8d3
12 changes: 12 additions & 0 deletions packages/block-library/src/embed/test/index.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ import {
createUpgradedEmbedBlock,
getEmbedInfoByProvider,
removeAspectRatioClasses,
hasAspectRatioClass,
} from '../util';
import { embedInstagramIcon } from '../icons';
import variations from '../variations';
@@ -101,6 +102,17 @@ describe( 'utils', () => {
).toEqual( expected );
} );
} );
describe( 'hasAspectRatioClass', () => {
it( 'should return false if an aspect ratio class does not exist', () => {
const existingClassNames = 'wp-block-embed is-type-video';
expect( hasAspectRatioClass( existingClassNames ) ).toBe( false );
} );
it( 'should return true if an aspect ratio class exists', () => {
const existingClassNames =
'wp-block-embed is-type-video wp-embed-aspect-16-9 wp-has-aspect-ratio';
expect( hasAspectRatioClass( existingClassNames ) ).toBe( true );
} );
} );
describe( 'removeAspectRatioClasses', () => {
it( 'should return the same falsy value as received', () => {
const existingClassNames = undefined;