- Webpack as dev server
- Babel to support ES6 features in IE11
- Jest as framework to run Unit testing
- Husky to execute git hooks
- Eslint + Prettier
- LESS to add extra functionalities to CSS
- Github actions as CI/CD to deploy (build, lint, test, deploy) to Github Pages
All the bussiness requirements described in the test assignment are validated with Automation test, it is integrate in the CI workflow E2E
- Can be use as module in any form or app independently ✅
- Add email typing
COMMA
,ENTER
or lossing the input focus ✅ - Pasted emails are converted to formatted blocks inmediatly ✅
- Input dimensions depends on parent dimensions ✅
- Scrollable ✅
- It is possible to create multiple elements in the same page without conflicts ✅
- Detect repeated email, preventing to add the same email twice ✅
- Block elements can be deleted ✅
import EmailInput from '.src/lib'
const $container = document.querySelector('#my-email-input-container')
const emailInput = EmailInput($container)
or
<head>
<script src="./app.bundle.js"></script>
</head>
<script>
const $container = document.querySelector('#my-email-input-container')
var emailsInput = new EmailsInput($container)
</script>
Options:
import EmailInput from '.src/lib'
const $container = document.querySelector('#my-email-input-container')
const options = {
placeholder: 'my new placeholder', //default: add more people
}
const emailInput = EmailInput($container)
const emailInput = EmailInput($container)
// Add email method
emailInput.addEmail('myemail@email.com')
// Count valid emails
const number = emailInput.countValidEmails()
// Get full Object element
const $el = emailInput.getElement()
yarn dev #or npm run dev
yarn build
yarn test
yarn test:coverage
yarn test:e2e
yarn test:watch
yarn lint
/build
static web build/coverage
Test coverage report/cypress
Cypress automation tests/src
code/app/
App to DEMO, it includes the mainindex.html
,index.js
,app.test.js
, andstyle.less
/src/lib/
Email input as exportable libraryindex.js
Initial app, factory to encapsulate data and expose just the needed methods fromEmailInput
/utils/
application utils/constants/
application constants/components/
"components", those are factories for DOM Element who respect the same pattern (exept mainemail-input
)/block-email
,/close-icon
,/input
,/wrapper
. Element factories that follow the same pattern. All of them receive the paramsprops
andevents
in order to create the respective HTML element and attach the events./email-input
Constructor function forEmailInput
, it includes all the data state logic, operations and event delegation to the other Elements.
It check the linter until commit
It run the unit testing until push