@madie/madie-design-system 1.2.94 → 1.2.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madie/madie-design-system",
3
- "version": "1.2.94",
3
+ "version": "1.2.95",
4
4
  "description": "Shared style guide across the Madie program.",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://github.com/MeasureAuthoringTool/madie-design-system",
@@ -1,7 +1,6 @@
1
1
  import "@testing-library/jest-dom";
2
2
  import React from "react";
3
3
  import { fireEvent, render, screen } from "@testing-library/react";
4
- import userEvent from "@testing-library/user-event";
5
4
  import Toggle from "../../components/Toggle/Toggle";
6
5
 
7
6
  describe("Toggle", () => {
@@ -61,6 +60,21 @@ describe("Toggle", () => {
61
60
  expect(onChange).toHaveBeenCalledWith(expect.any(Object), true);
62
61
  });
63
62
 
63
+ test("forwards input attributes to the switch", () => {
64
+ render(
65
+ <Toggle
66
+ data-testid="toggle-input"
67
+ id="hide-invalid"
68
+ label="Hide Invalid Test Cases"
69
+ />
70
+ );
71
+
72
+ expect(screen.getByTestId("toggle-input")).toHaveAttribute(
73
+ "role",
74
+ "switch"
75
+ );
76
+ });
77
+
64
78
  test("does not change when disabled", () => {
65
79
  const onChange = jest.fn();
66
80
 
@@ -76,7 +90,6 @@ describe("Toggle", () => {
76
90
  const toggle = screen.getByRole("switch", {
77
91
  name: "Hide Invalid Test Cases",
78
92
  });
79
- userEvent.click(toggle);
80
93
 
81
94
  expect(toggle).toBeDisabled();
82
95
  expect(toggle).not.toBeChecked();