donal
2018-04-12 9d6970d15ace1d033858f40e1e1459eeca6c6690
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { shallow } from "@vue/test-utils";
import TodoItem from "@/components/TodoItem.vue";
// import { expect } from 'chai'
 
import * as all from "../setup.js";
 
describe("TodoItem.vue", () => {
  
  it("has the expected html structure", () => {
    const todoItem = {};
    const wrapper = shallow(TodoItem, { 
      propsData: { todoItem } 
    });
    expect(wrapper.element).toMatchSnapshot();
  });
  
  it("Renders title as 'TestTitle'", () => {
    const todoItem = {
      title: "TestTitle"
    };
    const wrapper = shallow(TodoItem, { 
      propsData: { todoItem } 
    });
    expect(wrapper.vm.todoItem.title).toMatch("TestTitle");
  });
  
  it("Renders completed as true", () => {
    const todoItem = {
      completed : true
    };
    const wrapper = shallow(TodoItem, { 
      propsData: { todoItem } 
    });
    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 important as false", () => {
    const todoItem = {
      important : false
    };
    const wrapper = shallow(TodoItem, { 
      propsData: { todoItem } 
    });
    expect(wrapper.vm.todoItem.important).toEqual(false);
  });
  
  // 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("");
  // });
 
  
 
});