Giter Site home page Giter Site logo

react-test-driven-increment-counter's Introduction

Click Counter

A very basic app to demonstrate React TDD

Branches

  • master

    This branch represents the project at the end of the instructional videos, without any of the challenges completed.

  • click-counter-challenges

    This branch contains solutions to the challenges.

Challenges

1. Decrement button

  • Create a new button that subtracts 1 from the counter
  • Add functionality that decrements the counter when the new button is clicked.

2. No count below 0

  • Don't let the counter go below zero.
    • if the counter is at 0 and the decrement button is clicked:
      • don't decrement the counter
      • display an error message saying the counter can't go below zero

3. Remove error when increment button is clicked

  • If error is showing and increment button is clicked, clear the error.

Accomplishments

  1. Setup a (very) simple React app with Jest and Enzyme
  2. Used Enzyme's shallow() function to render a component
  3. Tested that required DOM elements were rendered using find()
  4. Tested state using Enzyme's setState() and state() methods
  5. Used simulate to interact with rendered elements (clicked button)
  6. Tested component for updates after interaction.
  7. Created re-usable setup() and findByAttr() functions.

Credits

This project was bootstrapped with Create React App.

react-test-driven-increment-counter's People

Watchers

 avatar

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.