@teselagen/ui 0.9.5 → 0.9.6
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/README.md +6 -2
- package/package.json +1 -1
- package/src/AdvancedOptions.spec.js +8 -23
package/README.md
CHANGED
|
@@ -4,12 +4,16 @@ This library was generated with [Nx](https://nx.dev).
|
|
|
4
4
|
|
|
5
5
|
## Running unit tests
|
|
6
6
|
|
|
7
|
-
Run `
|
|
7
|
+
Run `bun test` from the root of the repo to execute all unit tests.
|
|
8
|
+
|
|
9
|
+
## Running end-to-end tests locally
|
|
10
|
+
|
|
11
|
+
Run `nx run ui:launch-e2e` to launch the Cypress test runner locally
|
|
8
12
|
|
|
9
13
|
## Installation (react)
|
|
10
14
|
|
|
11
15
|
```
|
|
12
|
-
yarn add @teselagen/
|
|
16
|
+
yarn add @teselagen/ui react react-dom
|
|
13
17
|
```
|
|
14
18
|
|
|
15
19
|
## Running locally
|
package/package.json
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { render, fireEvent, cleanup } from "@testing-library/react";
|
|
4
|
-
import { expect, describe, test, afterEach } from "bun:test";
|
|
2
|
+
import { render, fireEvent } from "@testing-library/react";
|
|
5
3
|
|
|
6
4
|
import AdvancedOptions from "./AdvancedOptions";
|
|
7
5
|
|
|
8
|
-
// Set up DOM environment once for this test file
|
|
9
|
-
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>', {
|
|
10
|
-
url: 'http://localhost',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
global.window = dom.window;
|
|
14
|
-
global.document = dom.window.document;
|
|
15
|
-
global.navigator = dom.window.navigator;
|
|
16
|
-
global.HTMLElement = dom.window.HTMLElement;
|
|
17
|
-
global.DocumentFragment = dom.window.DocumentFragment;
|
|
18
|
-
global.KeyboardEvent = dom.window.KeyboardEvent;
|
|
19
|
-
global.MouseEvent = dom.window.MouseEvent;
|
|
20
|
-
|
|
21
6
|
describe("AdvancedOptions", () => {
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
7
|
+
// afterEach(() => {
|
|
8
|
+
// cleanup();
|
|
9
|
+
// });
|
|
10
|
+
|
|
26
11
|
test("renders correctly with given props and default state", () => {
|
|
27
12
|
const { queryByText, container } = render(
|
|
28
13
|
<AdvancedOptions label="Test Label" content="Test Content" />
|
|
@@ -40,13 +25,13 @@ describe("AdvancedOptions", () => {
|
|
|
40
25
|
const { container, queryByText } = render(
|
|
41
26
|
<AdvancedOptions label="Test Label 2" content="Test Content 2" />
|
|
42
27
|
);
|
|
43
|
-
|
|
28
|
+
|
|
44
29
|
// Find and click the toggle button
|
|
45
30
|
const toggleButton = container.querySelector(".tg-toggle-advanced-options");
|
|
46
31
|
expect(toggleButton).not.toBeNull();
|
|
47
|
-
|
|
32
|
+
|
|
48
33
|
fireEvent.click(toggleButton);
|
|
49
|
-
|
|
34
|
+
|
|
50
35
|
// After click, content should be visible
|
|
51
36
|
expect(queryByText("Test Content 2")).not.toBeNull();
|
|
52
37
|
// After click, down caret icon should be present (expanded state)
|