Registry
D

jest-add-root-and-assertions-to-test

No description available

dfordp0 executions

  • Legacy
  • radix
  • vue
  • jest
  • v1.9.4
  • bug fix
  • add root and assertions to test
Connect a repo
npx codemod jest-add-root-and-assertions-to-test

Added Input Root Test Cases to which handle the data disabled case

Example

Before

ts
it('should not be changed when disabled', async () => {
  const { input, increment, decrement } = setup({
    defaultValue: 0,
    disabled: true,
  });

  await fireEvent.keyDown(input, { key: kbd.ARROW_UP });
  expect(input.value).toBe('0');
  await fireEvent.keyDown(input, { key: kbd.ARROW_DOWN });
  expect(input.value).toBe('0');
  await userEvent.click(increment);
  expect(input.value).toBe('0');
  await userEvent.click(decrement);
  expect(input.value).toBe('0');
});

After

ts
it('should not be changed when disabled', async () => {
  const { root, input, increment, decrement } = setup({
    defaultValue: 0,
    disabled: true,
  });

  expect(root.getAttribute('data-disabled')).toBe('');
  expect(input.getAttribute('data-disabled')).toBe('');

  await fireEvent.keyDown(input, { key: kbd.ARROW_UP });
  expect(input.value).toBe('0');
  await fireEvent.keyDown(input, { key: kbd.ARROW_DOWN });
  expect(input.value).toBe('0');
  await userEvent.click(increment);
  expect(input.value).toBe('0');
  await userEvent.click(decrement);
  expect(input.value).toBe('0');
});

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.