donal
2018-04-16 326ccf25c225f56a64873c47b1fadd9d3cc24ae8
tdd lab ready to go
4 files modified
24 ■■■■■ changed files
src/components/TodoItem.vue 10 ●●●● patch | view | raw | blame | history
src/store/mutations.js 2 ●●● patch | view | raw | blame | history
tests/unit/javascript/actions.spec.js 11 ●●●● patch | view | raw | blame | history
tests/unit/vue-components/TodoItem.spec.js 1 ●●●● patch | view | raw | blame | history
src/components/TodoItem.vue
@@ -1,15 +1,15 @@
<template>
  <div>
    <div class="itemCardAndFlag">
      <md-list-item
        @click="markCompleted()"
        >
        <checkbox v-model="todoItem.completed" class="checkbox-completed"/>
    <md-list-item
      @click="markCompleted()"
      >
      <checkbox v-model="todoItem.completed" class="checkbox-completed"/>
        <span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span>
      </md-list-item>
      <!-- TODO - SVG for use in Lab3 -->
      <!-- <svg :class="{'red-flag': todoItem.important}"  height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" ><path d="M0 0h24v24H0z" fill="none"/><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/></svg> -->
        <!-- <svg  height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" ><path d="M0 0h24v24H0z" fill="none"/><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/></svg> -->
    </div>
  </div>
</template>
src/store/mutations.js
@@ -30,5 +30,5 @@
  MARK_TODO_COMPLETED(state, index) {
    console.log("INFO - MARK_TODO_COMPLETED");
    state.todos[index].completed = !state.todos[index].completed;
  }
  },
};
tests/unit/javascript/actions.spec.js
@@ -123,6 +123,13 @@
      done();
    });
  });
  // TODO - test goes here!
  it("should call MARK_TODO_IMPORTANT", done => {
    const commit = sinon.spy();
    state.todos = todos;
    actions.updateTodo({ commit, state }, { id: 1 , important: true }).then(() => {
      // TODO - test goes here!
      done();
    });
  });
});
tests/unit/vue-components/TodoItem.spec.js
@@ -69,7 +69,6 @@
    });
    // TODO - test goes here!
  });
  it("call makImportant when clicked", () => {
    const wrapper = mount(TodoItem, {
      methods,