npm package diff

Package: @forge/react

Versions: 10.6.0-next.4 - 10.6.0-next.5

File: package/out/__test__/components/jira/custom-field-edit.test.js

Index: package/out/__test__/components/jira/custom-field-edit.test.js
===================================================================
--- package/out/__test__/components/jira/custom-field-edit.test.js
+++ package/out/__test__/components/jira/custom-field-edit.test.js
@@ -0,0 +1,28 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const tslib_1 = require("tslib");
+const jsx_runtime_1 = require("react/jsx-runtime");
+const components_1 = require("../../../components");
+const jira_1 = require("../../../components/jira");
+const reconcilerTestRenderer_1 = tslib_1.__importDefault(require("../../reconcilerTestRenderer"));
+const testUtils_1 = require("../../testUtils");
+const get_1 = tslib_1.__importDefault(require("lodash/get"));
+describe('CustomFieldEdit', () => {
+    let bridgeCalls = [];
+    const onSubmitMock = jest.fn();
+    beforeEach(async () => {
+        bridgeCalls = (0, testUtils_1.setupBridge)();
+        await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(jira_1.CustomFieldEdit, { onSubmit: onSubmitMock, children: (0, jsx_runtime_1.jsx)(components_1.Textfield, { value: "test" }) }));
+    });
+    it('children are present in the forgeDoc', () => {
+        const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
+        const childComponent = (0, get_1.default)(forgeDoc, 'children[0].children[0].type');
+        expect(childComponent).toBe('Textfield');
+    });
+    it('onSubmit is passed in the forgeDoc', () => {
+        const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
+        const onSubmit = (0, get_1.default)(forgeDoc, 'children[0].props.onSubmit');
+        onSubmit();
+        expect(onSubmitMock).toHaveBeenCalled();
+    });
+});