shouldForwardProp.js 589 B

12345678910111213141516171819202122232425
  1. import { css } from 'goober';
  2. import { shouldForwardProp } from '../index';
  3. describe('shouldForwardProp', () => {
  4. it('type', () => {
  5. expect(typeof shouldForwardProp).toEqual('function');
  6. });
  7. it('shouldForwardProp', () => {
  8. const fn = shouldForwardProp((prop) => {
  9. // Filter out props prefixed with '$'
  10. return prop[0] !== '$';
  11. });
  12. const props = {
  13. color: 'red',
  14. $shouldAnimate: true
  15. };
  16. // 'render'
  17. fn(props);
  18. expect(props).toEqual({ color: 'red' });
  19. });
  20. });