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

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erm500 committed Mar 30, 2020
1 parent 1b4969d commit d973dc0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Tags/__tests__/Tags_enzyme-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Tags", () => {
wrapper
.find("Tag")
.at(1)
.simulate("press");
.simulate("press", { persist: jest.fn()});

expect(wrapper.find("Tag").length).toEqual(3);
});
Expand All @@ -32,18 +32,18 @@ describe("Tags", () => {
wrapper
.find("Tag")
.at(0)
.simulate("press");
.simulate("press", { persist: jest.fn()});

expect(wrapper.find("Tag").length).toEqual(4);
});
});

describe("TextInput", () => {
describe("Input", () => {
describe("onChangeText", () => {
it("should add a new tag when a space, or comma is detected", () => {
const onChangeTags = jest.fn();
const wrapper = shallow(<Tags onChangeTags={onChangeTags} />).find(
"TextInput"
"Input"
);
wrapper.simulate("ChangeText", "dog ");
expect(onChangeTags.mock.calls).toEqual([[["dog"]]]);
Expand All @@ -55,7 +55,7 @@ describe("Tags", () => {
const onChangeTags = jest.fn();
const wrapper = shallow(
<Tags createTagOnReturn onChangeTags={onChangeTags} />
).find("TextInput");
).find("Input");
wrapper.simulate("ChangeText", "dog");
wrapper.simulate("SubmitEditing");
expect(onChangeTags.mock.calls).toEqual([[["dog"]]]);
Expand All @@ -64,7 +64,7 @@ describe("Tags", () => {
it("should remove a tag when the text is empty", () => {
const onChangeTags = jest.fn();
const wrapper = shallow(<Tags onChangeTags={onChangeTags} />).find(
"TextInput"
"Input"
);
wrapper.simulate("ChangeText", "dog ");
expect(onChangeTags.mock.calls).toEqual([[["dog"]]]);
Expand All @@ -73,16 +73,16 @@ describe("Tags", () => {
});

it("text input should not be available if it's readyonly", () => {
const wrapper = shallow(<Tags readonly />).find("TextInput");
const wrapper = shallow(<Tags readonly />).find("Input");
expect(wrapper.length).toEqual(0);
});

it("textinput should dissapear after maxNumberOfTags is reached", () => {
it("input should dissapear after maxNumberOfTags is reached", () => {
const wrapper = shallow(
<Tags initialTags={["love"]} maxNumberOfTags={2} />
);
wrapper.find("TextInput").simulate("ChangeText", "dog ");
expect(wrapper.find("TextInput").length).toEqual(0);
wrapper.find("Input").simulate("ChangeText", "dog ");
expect(wrapper.find("Input").length).toEqual(0);
});
});
});
Expand Down

0 comments on commit d973dc0

Please sign in to comment.