@tamagui/react-native-web-lite
Version:
React Native for Web
117 lines (116 loc) • 6.51 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function")
for (let key of __getOwnPropNames(from))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
mod
));
var import_react = require("@testing-library/react"), import_dom_event_testing_library = require("dom-event-testing-library"), import_react2 = __toESM(require("react")), import_test_utils = require("react-dom/test-utils"), import__ = __toESM(require("..")), import_jsx_runtime = require("react/jsx-runtime");
describe("components/ActivityIndicator", () => {
describe('prop "accessibilityLabel"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { accessibilityLabel: "accessibility label" })
);
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "accessibilityLiveRegion"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { accessibilityLiveRegion: "polite" }));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "animating"', () => {
test('is "true"', () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { animating: !0 }));
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { animating: !1 }));
expect(container.firstChild).toMatchSnapshot();
});
}), test('prop "color"', () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { color: "red" })), svg = container.firstChild.querySelector("svg");
expect(svg).toMatchSnapshot();
}), describe('prop "dataSet"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { dataSet: { one: "one", two: "two" } })
);
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "hidesWhenStopped"', () => {
test('is "true"', () => {
const { container } = (0, import_react.render)(
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { animating: !1, hidesWhenStopped: !0 })
);
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', () => {
const { container } = (0, import_react.render)(
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { animating: !1, hidesWhenStopped: !1 })
);
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "nativeID"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { nativeID: "123" }));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "onBlur"', () => {
test("is called", () => {
const onBlur = jest.fn(), ref = import_react2.default.createRef();
(0, import_test_utils.act)(() => {
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onBlur, ref }));
});
const target = (0, import_dom_event_testing_library.createEventTarget)(ref.current), body = (0, import_dom_event_testing_library.createEventTarget)(document.body);
(0, import_test_utils.act)(() => {
target.focus(), body.focus({ relatedTarget: target.node });
}), expect(onBlur).toBeCalled();
});
}), describe('prop "onFocus"', () => {
test("is called", () => {
const onFocus = jest.fn(), ref = import_react2.default.createRef();
(0, import_test_utils.act)(() => {
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onFocus, ref }));
});
const target = (0, import_dom_event_testing_library.createEventTarget)(ref.current);
(0, import_test_utils.act)(() => {
target.focus();
}), expect(onFocus).toBeCalled();
});
}), describe('prop "ref"', () => {
test("value is set", () => {
const ref = jest.fn();
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { ref })), expect(ref).toBeCalled();
});
}), describe('prop "size"', () => {
test('is "large"', () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { size: "large" }));
expect(container.firstChild).toMatchSnapshot();
}), test("is a number", () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { size: 30 }));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "style"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { style: { borderWidth: 5 } }));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "testID"', () => {
test("value is set", () => {
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { testID: "123" }));
expect(container.firstChild).toMatchSnapshot();
});
});
});
//# sourceMappingURL=index-test.js.map