@tamagui/react-native-web-lite
Version:
React Native for Web
168 lines (167 loc) • 5.12 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { render } from "@testing-library/react";
import { createEventTarget } from "dom-event-testing-library";
import React from "react";
import { act } from "react-dom/test-utils";
import ActivityIndicator from "..";
describe("components/ActivityIndicator", function () {
describe('prop "accessibilityLabel"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
accessibilityLabel: "accessibility label"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "accessibilityLiveRegion"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
accessibilityLiveRegion: "polite"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "animating"', function () {
test('is "true"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
animating: !0
}));
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
animating: !1
}));
expect(container.firstChild).toMatchSnapshot();
});
}), test('prop "color"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
color: "red"
})),
svg = container.firstChild.querySelector("svg");
expect(svg).toMatchSnapshot();
}), describe('prop "dataSet"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
dataSet: {
one: "one",
two: "two"
}
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "hidesWhenStopped"', function () {
test('is "true"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
animating: !1,
hidesWhenStopped: !0
}));
expect(container.firstChild).toMatchSnapshot();
}), test('is "false"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
animating: !1,
hidesWhenStopped: !1
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "nativeID"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
nativeID: "123"
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "onBlur"', function () {
test("is called", function () {
var onBlur = jest.fn(),
ref = /* @__PURE__ */React.createRef();
act(function () {
render(/* @__PURE__ */_jsx(ActivityIndicator, {
onBlur,
ref
}));
});
var target = createEventTarget(ref.current),
body = createEventTarget(document.body);
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__ */React.createRef();
act(function () {
render(/* @__PURE__ */_jsx(ActivityIndicator, {
onFocus,
ref
}));
});
var target = createEventTarget(ref.current);
act(function () {
target.focus();
}), expect(onFocus).toBeCalled();
});
}), describe('prop "ref"', function () {
test("value is set", function () {
var ref = jest.fn();
render(/* @__PURE__ */_jsx(ActivityIndicator, {
ref
})), expect(ref).toBeCalled();
});
}), describe('prop "size"', function () {
test('is "large"', function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
size: "large"
}));
expect(container.firstChild).toMatchSnapshot();
}), test("is a number", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
size: 30
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "style"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
style: {
borderWidth: 5
}
}));
expect(container.firstChild).toMatchSnapshot();
});
}), describe('prop "testID"', function () {
test("value is set", function () {
var {
container
} = render(/* @__PURE__ */_jsx(ActivityIndicator, {
testID: "123"
}));
expect(container.firstChild).toMatchSnapshot();
});
});
});
//# sourceMappingURL=index-test.native.js.map