Sha256: 5cac887a4b1ec7e02f92b3768b09997379ab1e6e1c1453dd0b8ac67aa34f24d3

Contents?: true

Size: 1.96 KB

Versions: 40

Compression:

Stored size: 1.96 KB

Contents

import React from 'react';
import { render, screen } from '../../test-utils';
import Body from '../../../pb_body/_body';

const testSubject = 'body';

test('Hover Props: returns proper class name', () => {
  const testIdColor = `${testSubject}-hover-color-red`;
  render(
    <Body
        data={{ testid: testIdColor }}
        hover={{ color: 'red' }}
        text="Hi"
    />
  );

  let kit = screen.getByTestId(testIdColor);
  let expectedClassName = `hover_color-red`;
  expect(kit).toHaveClass(expectedClassName);

  const testIdBackground = `${testSubject}-hover-background-blue`;
  render(
    <Body
        data={{ testid: testIdBackground }}
        hover={{ background: 'blue' }}
        text="Hi"
    />
  );

  kit = screen.getByTestId(testIdBackground);
  expectedClassName = `hover_background-blue`;
  expect(kit).toHaveClass(expectedClassName);

  const testIdShadow = `${testSubject}-hover-shadow-deep`;
  render(
    <Body
        data={{ testid: testIdShadow }}
        hover={{ shadow: 'deep' }}
        text="Hi"
    />
  );

  kit = screen.getByTestId(testIdShadow);
  expectedClassName = `hover_shadow_deep`;
  expect(kit).toHaveClass(expectedClassName);

  const testIdScale = `${testSubject}-hover-scale`;
  render(
    <Body
        data={{ testid: testIdScale }}
        hover={{ scale: 'xl' }}
        text="Test"
    />
  );

  kit = screen.getByTestId(testIdScale);
  expectedClassName = `hover_scale_xl`;
  expect(kit).toHaveClass(expectedClassName);

  const testIdMultiple = `${testSubject}-hover-multiple`;
  render(
    <Body
        data={{ testid: testIdMultiple }}
        hover={{
        color: 'green',
        background: 'error',
        shadow: 'deeper',
        scale: 'xl',
      }}
        text="Hi"
    />
  );

  kit = screen.getByTestId(testIdMultiple);
  expect(kit).toHaveClass('hover_color-green');
  expect(kit).toHaveClass('hover_background-error');
  expect(kit).toHaveClass('hover_shadow_deeper');
  expect(kit).toHaveClass('hover_scale_xl');
});

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
playbook_ui-14.9.0 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.18 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.17 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.16 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.15 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.14 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.13 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.12 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.11 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.10 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PBNTR713dropdowncustomtriggerbug4696 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.9 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1680newwidthprop4661 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1658tanstackbump4657 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.6 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.5 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js