| | |
| | | const wrapper = shallow(TodoItem, { |
| | | propsData: { todoItem } |
| | | }); |
| | | expect(wrapper.element).toMatchSnapshot(); |
| | | // expect(wrapper.element).toMatchSnapshot(); |
| | | }); |
| | | |
| | | it("Renders title as 'Love Front End testing :)'", () => { |
| | |
| | | propsData: { todoItem: importantTodo } |
| | | }); |
| | | // TODO - test goes here! |
| | | expect(wrapper.find(".important-flag").exists()).toBe(true); |
| | | }); |
| | | it("should set the colour to red when true", () => { |
| | | const wrapper = mount(TodoItem, { |
| | | propsData: { todoItem: importantTodo } |
| | | }); |
| | | // TODO - test goes here! |
| | | expect(wrapper.find(".red-flag").exists()).toBe(true); |
| | | }); |
| | | it("should set the colour to not red when false", () => { |
| | | importantTodo.important = false; |
| | |
| | | propsData: { todoItem: importantTodo } |
| | | }); |
| | | // TODO - test goes here! |
| | | expect(wrapper.find(".red-flag").exists()).toBe(false); |
| | | }); |
| | | |
| | | it("call makImportant when clicked", () => { |
| | |
| | | propsData: { todoItem: importantTodo } |
| | | }); |
| | | // TODO - test goes here! |
| | | const input = wrapper.find(".important-flag"); |
| | | input.trigger("click"); |
| | | expect(methods.markImportant).toHaveBeenCalled(); |
| | | }); |
| | | }); |