闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
663 B

  1. import { expect } from 'chai';
  2. import { render } from 'enzyme';
  3. import React from 'react';
  4. import Avatar from '../../../app/javascript/mastodon/components/avatar';
  5. describe('<Avatar />', () => {
  6. const src = '/path/to/image.jpg';
  7. const size = 100;
  8. const wrapper = render(<Avatar src={src} animate size={size} />);
  9. it('renders a div element with the given src as background', () => {
  10. expect(wrapper.find('div')).to.have.style('background-image', `url(${src})`);
  11. });
  12. it('renders a div element of the given size', () => {
  13. ['width', 'height'].map((attr) => {
  14. expect(wrapper.find('div')).to.have.style(attr, `${size}px`);
  15. });
  16. });
  17. });