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.8.0.pre.alpha.pbntr661createstickyleftprop4612 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.4 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.3 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.9.0.pre.rc.0 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.rc.8 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.rc.7 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js
playbook_ui-14.8.0.pre.rc.6 app/pb_kits/playbook/utilities/test/globalProps/hover.test.js