donal
2018-04-16 78a403c450425ea86fad7df5737a4a53ed4c6714
tests/unit/vue-components/TodoItem.spec.js
@@ -19,7 +19,7 @@
    const wrapper = shallow(TodoItem, {
      propsData: { todoItem }
    });
    expect(wrapper.element).toMatchSnapshot();
    // expect(wrapper.element).toMatchSnapshot();
  });
  it("Renders title as 'Love Front End testing :)'", () => {
@@ -35,27 +35,6 @@
    });
    expect(wrapper.vm.todoItem.completed).toEqual(true);
  });
  // it("won't render additional props", () => {
  //   const biscuits = "digestives"
  //   const wrapper = shallow(TodoItem, {
  //     propsData: { biscuits }
  //   });
  //   expect(wrapper.vm.todoItem).toBe("undefined");
  // });
  // it("renders props.placeholderMsg when passed", () => {
  //   const msg = "Add a Todo";
  //   const wrapper = shallow(NewTodo, {
  //     propsData: { placeholderMsg: msg }
  //   });
  //   expect(wrapper.vm._props.placeholderMsg).toMatch(msg);
  // });
  // it("renders newTodo as empty string", () => {
  //   const wrapper = shallow(NewTodo, {});
  //   expect(wrapper.vm.newTodo).toMatch("");
  // });
});
let importantTodo;
@@ -75,20 +54,20 @@
    const wrapper = mount(TodoItem, {
      propsData: { todoItem: importantTodo }
    });
    expect(wrapper.find(".important-flag").exists()).toBe(true);
    // TODO - test goes here!
  });
  it("should set the colour to red when true", () => {
    const wrapper = mount(TodoItem, {
      propsData: { todoItem: importantTodo }
    });
    expect(wrapper.find(".red-flag").exists()).toBe(true);
    // TODO - test goes here!
  });
  it("should set the colour to not red when false", () => {
    importantTodo.important = false;
    const wrapper = mount(TodoItem, {
      propsData: { todoItem: importantTodo }
    });
    expect(wrapper.find(".red-flag").exists()).toBe(false);
    // TODO - test goes here!
  });
  it("call makImportant when clicked", () => {
@@ -96,8 +75,6 @@
      methods,
      propsData: { todoItem: importantTodo }
    });
    const input = wrapper.find(".important-flag");
    input.trigger("click");
    expect(methods.markImportant).toHaveBeenCalled();
    // TODO - test goes here!
  });
});