ClusterTab.styled.spec.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from 'react';
  2. import { render } from 'lib/testHelpers';
  3. import theme from 'theme/theme';
  4. import { screen } from '@testing-library/react';
  5. import * as S from 'components/Nav/ClusterTab/ClusterTab.styled';
  6. import { ServerStatus } from 'generated-sources';
  7. describe('Cluster Styled Components', () => {
  8. describe('Wrapper Component', () => {
  9. it('should check the rendering and correct Styling when it is open', () => {
  10. render(<S.Wrapper isOpen />);
  11. expect(screen.getByRole('menuitem')).toHaveStyle(
  12. `color:${theme.menu.color.isOpen}`
  13. );
  14. });
  15. it('should check the rendering and correct Styling when it is Not open', () => {
  16. render(<S.Wrapper isOpen={false} />);
  17. expect(screen.getByRole('menuitem')).toHaveStyle(
  18. `color:${theme.menu.color.normal}`
  19. );
  20. });
  21. });
  22. describe('StatusIcon Component', () => {
  23. it('should check the rendering and correct Styling when it is online', () => {
  24. render(<S.StatusIcon status={ServerStatus.ONLINE} />);
  25. expect(screen.getByRole('status-circle')).toHaveStyle(
  26. `fill:${theme.menu.statusIconColor.online}`
  27. );
  28. });
  29. it('should check the rendering and correct Styling when it is offline', () => {
  30. render(<S.StatusIcon status={ServerStatus.OFFLINE} />);
  31. expect(screen.getByRole('status-circle')).toHaveStyle(
  32. `fill:${theme.menu.statusIconColor.offline}`
  33. );
  34. });
  35. it('should check the rendering and correct Styling when it is Initializing', () => {
  36. render(<S.StatusIcon status={ServerStatus.INITIALIZING} />);
  37. expect(screen.getByRole('status-circle')).toHaveStyle(
  38. `fill:${theme.menu.statusIconColor.initializing}`
  39. );
  40. });
  41. });
  42. });