@tamagui/react-native-web-lite
Version:
React Native for Web
153 lines (152 loc) • 6.95 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_jsx_runtime = require("react/jsx-runtime"), 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(".."));
describe("components/ActivityIndicator", function() {
describe('prop "accessibilityLabel"', function() {
test("value is set", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
accessibilityLabel: "accessibility label"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "accessibilityLiveRegion"', function() {
test("value is set", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
accessibilityLiveRegion: "polite"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "animating"', function() {
test('is "true"', function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
animating: !0
}));
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
animating: !1
}));
expect(container.firstChild).toMatchSnapshot();
});
}), test('prop "color"', function() {
var { 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"', function() {
test("value is set", function() {
var { 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"', function() {
test('is "true"', function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
animating: !1,
hidesWhenStopped: !0
}));
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
animating: !1,
hidesWhenStopped: !1
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "nativeID"', function() {
test("value is set", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
nativeID: "123"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "onBlur"', function() {
test("is called", function() {
var onBlur = jest.fn(), ref = /* @__PURE__ */ import_react2.default.createRef();
(0, import_test_utils.act)(function() {
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
onBlur,
ref
}));
});
var 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)(function() {
target.focus(), body.focus({
relatedTarget: target.node
});
}), expect(onBlur).toBeCalled();
});
}), describe('prop "onFocus"', function() {
test("is called", function() {
var onFocus = jest.fn(), ref = /* @__PURE__ */ import_react2.default.createRef();
(0, import_test_utils.act)(function() {
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
onFocus,
ref
}));
});
var target = (0, import_dom_event_testing_library.createEventTarget)(ref.current);
(0, import_test_utils.act)(function() {
target.focus();
}), expect(onFocus).toBeCalled();
});
}), describe('prop "ref"', function() {
test("value is set", function() {
var ref = jest.fn();
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
ref
})), expect(ref).toBeCalled();
});
}), describe('prop "size"', function() {
test('is "large"', function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
size: "large"
}));
expect(container.firstChild).toMatchSnapshot();
}), test("is a number", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
size: 30
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "style"', function() {
test("value is set", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
style: {
borderWidth: 5
}
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "testID"', function() {
test("value is set", function() {
var { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {
testID: "123"
}));
expect(container.firstChild).toMatchSnapshot();
});
});
});
//# sourceMappingURL=index-test.js.map