视频播放器仓库

Speed.test.js 922B

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import Speed from './Speed';
  4. import styles from './Captions.css';
  5. describe('Speed', () => {
  6. let component;
  7. beforeAll(() => {
  8. component = shallow(
  9. <Speed ariaLabel="Speed" />
  10. );
  11. });
  12. it('should accept a className prop and append it to the components class', () => {
  13. const newClassNameString = 'a new className';
  14. expect(component.prop('className'))
  15. .toContain(styles.component);
  16. component.setProps({
  17. className: newClassNameString
  18. });
  19. expect(component.prop('className'))
  20. .toContain(styles.component);
  21. expect(component.prop('className'))
  22. .toContain(newClassNameString);
  23. });
  24. it('has correct aria-label', () => {
  25. expect(component.find('button').prop('aria-label'))
  26. .toEqual('Speed');
  27. });
  28. });