Skip to content

Commit

Permalink
[mui-styled-engine-sc] Add tagged template keys to styled
Browse files Browse the repository at this point in the history
  • Loading branch information
htunnicliff committed Mar 3, 2023
1 parent f01deb3 commit f1f7fa1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/mui-styled-engine-sc/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default function styled(tag, options) {
return stylesFactory;
}

Object.keys(scStyled).forEach((tag) => {
styled[tag] = scStyled[tag];
});

// eslint-disable-next-line @typescript-eslint/naming-convention
export const internal_processStyles = (tag, processor) => {
// Styled-components attaches an instance to `componentStyle`.
Expand Down
5 changes: 5 additions & 0 deletions packages/mui-styled-engine-sc/src/styled.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { expect } from 'chai';
import scStyled from 'styled-components';
import { createRenderer } from 'test/utils';
import styled from '@mui/styled-engine-sc';

Expand Down Expand Up @@ -39,6 +40,10 @@ describe('styled', () => {
expect(typeof styled('span').attrs).to.equal('undefined');
});

it('has primitive', () => {
expect(styled.div).to.equal(scStyled.div);
});

// The babel-plugin-styled-components depends on the withConfig option to be defined
it("should allow styled-components's APIs: .withConfig", () => {
expect(typeof styled('span').withConfig).to.equal('function');
Expand Down

0 comments on commit f1f7fa1

Please sign in to comment.