Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 9f99796

Browse files
committed
Add tests.
1 parent fbfc4f8 commit 9f99796

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Tags/__tests__/Tags_enzyme-tests.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,37 @@ import Tags from "../../";
77
enzyme.configure({ adapter: new Adapter() });
88

99
describe("Tags", () => {
10+
describe("tags", () => {
11+
it("removes a tag when you press them", () => {
12+
const wrapper = shallow(
13+
<Tags initialTags={["this", "is", "a", "test"]} />
14+
);
15+
16+
wrapper
17+
.find("Tag")
18+
.at(1)
19+
.simulate("press");
20+
21+
expect(wrapper.find("Tag").length).toEqual(3);
22+
});
23+
24+
it("doesn't remove tags when they're readonly", () => {
25+
const wrapper = shallow(
26+
<Tags
27+
deleteTagOnPress={false}
28+
initialTags={["this", "is", "a", "test"]}
29+
/>
30+
);
31+
32+
wrapper
33+
.find("Tag")
34+
.at(0)
35+
.simulate("press");
36+
37+
expect(wrapper.find("Tag").length).toEqual(4);
38+
});
39+
});
40+
1041
describe("TextInput", () => {
1142
describe("onChangeText", () => {
1243
it("should add a new tag when a space, or comma is detected", () => {

0 commit comments

Comments
 (0)