Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(textInput): add emoji filtering by default for text inputs #89

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

diglesias17
Copy link
Contributor

No description provided.

src/util/handleChangeText.js Outdated Show resolved Hide resolved
src/util/handleChangeText.js Outdated Show resolved Hide resolved
src/util/handleChangeText.js Outdated Show resolved Hide resolved
@mdumrauf
Copy link
Contributor

Agregar unit test, de todos los casos

@diglesias17
Copy link
Contributor Author

Agregar unit test, de todos los casos

@diglesias17 diglesias17 closed this Mar 1, 2019
@diglesias17 diglesias17 reopened this Mar 1, 2019
@@ -43,6 +43,34 @@ describe('handleChangeText', () => {
should(result.answer).be.undefined();
});
});

context('with an answer including emojis', () => {
it('should sanitize it by default', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excelente!

* @param {String} value The new answer to be handled.
* @param {Function} onChange Handle when the answer has changed.
*/
const handleChangeText = ({name, regex}, value, onChange) => onChange({
[name]: !isEmpty(value) ? formatValue(value, regex) : undefined
const handleChangeText = ({name, regex, allowEmojis = false}, value, onChange) => onChange({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahora que lo veo mejor, hace lo mismo que el formatValue() 👀.

Se puede simplificar más si concantenás las regex en una sola: https://stackoverflow.com/a/185529. Lo interesante ahora va a ser que el test siga dando verde cuando modifiques la implementación, prescindiendo del sanitize().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants