Coder Social home page Coder Social logo

todo's People

Contributors

wata-haru avatar

Watchers

 avatar

todo's Issues

repo間違えました

縦にスライドした際に、コンテンツが中途半端な位置になる。
そうなったときに自動で次のコンテンツに移動する処理

Jestで単体テストをする

isDone関数でStatusEnum.DONEStatusEnum.Doneと書いていて、予想と違う挙動になった。(580ff33)

防止するために、unit-testリポジトリを作成してテストを書く。

createTodo関数へのJSDoc追加とデフォルト引数の追加

やること

JSDocをすべての変数に書く

TODO

引数でnullとか渡すのが面倒だったりするので
デフォルト引数にしちゃえば明示的に渡さなくて済みます ( innerText = null )。
(直さないで大丈夫、知っておいてもらえれば)

    if (!tag) {
        return ;
    }
    const element = document.createElement(tag);
    if (className) {
        element.className = className;
    }
    if (innerText) {
        element.textContent = innerText;
    }
    return element;
    } 
  • createTodo()createElementWrapperの変数にjsdocを追加

    • [] オブジェクトの型指定が適当なところがあったので、オブジェクトの型名を明示する。
    • /** @type {HTMLDivElement | null} */
  • todosの型注釈(はんぞーさんに聞く)

/**
 * todos has todo's content and status value
 * @typedef {Object} Todo - todo object
 * @property {string} id - Todo id (uuid). It is used when change indivisual todo item.
 * @property {string} content - The description of the todo item.
 * @property {StatusEnum} status - todo status that defines statusEnum.
**/
  • nullを返す可能性がある関数にオプショナルチェーンをつける
  • submitButtonで、querySelectorはnullを返す可能性もあるので、オプショナルチェーンをつける
document.querySelector(".submitButton").addEventListener("click", createTodo);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.