marlucz / warsawjs-workshop-43-online-store

πŸ’Ύ Workshop project β€” Test JavaScript app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

warsawjs-workshop-43-online-store

πŸ’Ύ Workshop project β€” Test JavaScript app

Demo πŸŽ‰

https://marlucz.github.io/warsawjs-workshop-43-online-store/

Motivation

Project based on:

Features

  • βœ… Tooling: Prettier + Jest + http-server
  • βœ… Modules (4: IIFE, AMD, CommonJS, ESM)
  • βœ… Classes
  • βœ… Tooling: Webpack + webpack-dev-server
  • βœ… Promise API
  • βœ… Fetch API
  • βœ… RegExp

Step by step πŸ‘£

00-Setup

01-Modules

  • IIFE, 1999
  • CommonJS, 2009
  • AMD, 2010
  • ECMAScript Module, 2015

00-Tooling

02-Classes

  • [Functions] Create function which will be a component constructor
  • [Class] Convert previous function to a class
    • File: src/components/component.js
    • Requirements:
      • Component could be render
      • Component should have a template
  • [Class][getter]
    • Requirements:
      • Template should be a field which can be only "get"
  • [Class][static]
    • Requirements:
      • Product should have image inside
  • [Class][extends] Create component: Product
    • File: src/components/product.js
    • Requirements:
      • It should have class "product" on top of the DOM
  • [Class][super] Create component: Cart
    • File: src/components/cart.js
    • Requirements:
      • This module should have a list of products (initial empty)
  • [Loop] Iteration through list of products

03-Promise API

  • [Promise.resolve]
    • Adding product should based on Promise
  • [Promise.reject]
    • Adding non-product should finish failure
  • [Async/await]
  • Error handling: try...catch

04-Fetch API

05-RegExp

  • Tasks
    • When Product name has "er" string, do not add it to Cart and display Toast with error message
  • [RegExp#test]
  • Parts:
    • [Quantifiers]: *, +, ?, {n}
    • [Matchers]: ., \w, \d, \n
  • https://regex101.com/

Development

npm run build # generate dist/
npm run watch # generate dist/ & listen for changes
npm run dev   # do not generate anything & listen for changes

Unit tests

npm test
npm test -- test/specs/XX # XX => 01...05

Code coverage

npm run coverage

🀝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Related

License

The MIT License @ 2020

About

πŸ’Ύ Workshop project β€” Test JavaScript app

License:MIT License


Languages

Language:JavaScript 93.6%Language:HTML 6.4%