Skip to content

Conversation

@layershifter
Copy link
Member

@layershifter layershifter commented Oct 4, 2022

Fixes #239. Follow up on #232.

  • Updates makeResetStyles to handle animationName in the same way as makeStyles. Implementation is close to makeStyles
  • Updates tests for resolveResetStyleRules to make snapshots readable

@github-actions
Copy link

github-actions bot commented Oct 4, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
core
makeStyles + mergeClasses (build time)
1.834 kB
872 B
core
makeStyles + mergeClasses (runtime)
20.781 kB
7.72 kB
react
__css + mergeClasses (build time)
1.871 kB
869 B
react
__styles + mergeClasses (build time)
3.573 kB
1.609 kB
react
makeStaticStyles (runtime)
9.443 kB
4.068 kB
react
makeStyles + mergeClasses (runtime)
22.546 kB
8.432 kB
🤖 This report was generated against 67109b0dea4d3e41481784b6cac7c940f5e40def

Comment on lines 37 to 53
it('handles RTL', () => {
const computeClassName = makeResetStyles({
padding: '40px 20px 10px 5px',
});

expect(computeClassName({ dir: 'ltr', renderer })).toEqual('rfgb6zd6');
expect(computeClassName({ dir: 'rtl', renderer })).toEqual('rfjhindo');

expect(renderer).toMatchInlineSnapshot(`
.rfgb6zd6 {
padding: 40px 20px 10px 5px;
}
.rfjhindo {
padding: 40px 5px 10px 20px;
}
`);
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new test to check classes.

Comment on lines +4 to +16
expect.addSnapshotSerializer({
test(value) {
return Array.isArray(value);
},
print(value) {
/**
* test function makes sure that value is the guarded type
*/
const _value = value as ReturnType<typeof resolveResetStyleRules>;

return prettier.format(_value[2].join(''), { parser: 'css' }).trim();
},
});
Copy link
Member Author

@layershifter layershifter Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a serializer to make CSS output nicer (and readable actually).

@layershifter layershifter force-pushed the feat/mkrt-animations branch 2 times, most recently from 1dafe5d to 5b60b14 Compare October 4, 2022 11:13
@layershifter layershifter marked this pull request as ready for review October 4, 2022 11:29
@layershifter layershifter requested a review from a team as a code owner October 4, 2022 11:29
@layershifter layershifter merged commit 28641c5 into microsoft:main Oct 12, 2022
@layershifter layershifter deleted the feat/mkrt-animations branch October 13, 2022 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: support animations in makeResetStyles

2 participants