Skip to content

Commit

Permalink
Inlining locators
Browse files Browse the repository at this point in the history
Dismissing Styles Welcome Guide :D
  • Loading branch information
ramonjd committed Jun 17, 2022
1 parent ac04ff0 commit d151bd1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 75 deletions.
54 changes: 0 additions & 54 deletions packages/style-engine/src/styles/elements/index.ts

This file was deleted.

8 changes: 1 addition & 7 deletions packages/style-engine/src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
* Internal dependencies
*/
import color from './color';
import elements from './elements';
import spacing from './spacing';
import typography from './typography';

export const styleDefinitions = [
...color,
...elements,
...spacing,
...typography,
];
export const styleDefinitions = [ ...color, ...spacing, ...typography ];
35 changes: 21 additions & 14 deletions packages/style-engine/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,29 @@ describe( 'generate', () => {
it( 'should parse preset values', () => {
expect(
generate( {
color: {
text: 'var:preset|color|ham-sandwich',
},
spacing: { margin: '3px' },
} )
).toEqual(
'color: var(--wp--preset--color--ham-sandwich); margin: 3px;'
);
} );

it( 'should use top-level styles and ignore elements object when specifying a selector', () => {
expect(
generate( {
spacing: { padding: '10px', margin: '12px' },
elements: {
link: {
color: {
text: 'var:preset|color|ham-sandwich',
text: 'peachpuff',
},
spacing: { margin: '3px' },
},
},
} )
).toEqual(
'color: var(--wp--preset--color--ham-sandwich); margin: 3px;'
);
).toEqual( 'margin: 12px; padding: 10px;' );
} );
} );

Expand Down Expand Up @@ -235,21 +246,17 @@ describe( 'getCSSRules', () => {
] );
} );

it( 'should handle styles for elements with CSS vars', () => {
it( 'should handle styles with CSS vars', () => {
expect(
getCSSRules(
{
elements: {
link: {
color: {
text: 'var:preset|color|bomba-picante',
},
spacing: { padding: '11px' },
},
color: {
text: 'var:preset|color|bomba-picante',
},
spacing: { padding: '11px' },
},
{
selector: '.some-selector',
selector: '.some-selector a',
}
)
).toEqual( [
Expand Down

0 comments on commit d151bd1

Please sign in to comment.