emulsify-ds / emulsify-twig-extensions

Twig.js BEM and Add Attributes Extensions
2 stars 1 forks source link

fix: convert value to string before inspecting what it contains #6

Closed callinmullaney closed 1 year ago

callinmullaney commented 3 years ago

Summary

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve?

Documentation Update (required)

How to review this PR

{% set test_attributes = test_attributes|merge({ 'data-test-integer': [123, 243523], }) %}


- [ ] Call the `add_attributes` function on an element within the component

<div {{ add_attributes(test_attributes) }}>



- [ ] Compile storybook and Verify the storybook doesn't throw an error. In particular  `TypeError: value.includes is not a function`
- [ ] Inspect the markup and verify the above attributes are being properly rendered 
![Screenshot from 2021-11-19 10-04-10](https://user-images.githubusercontent.com/369018/142654111-2709feca-9145-4aaa-a612-1c7410989c2c.png)

**Closing issues**
https://github.com/emulsify-ds/emulsify-twig-extensions/issues/4
amazingrando commented 2 years ago

@callinmullaney What would you like to do about the comment from @WidgetsBurritos ?

ryanhagerty commented 2 years ago

@callinmullaney Opened a PR here to fix a problem I encountered.

Anytime I included a single number I would get an error that prevented the component from rendering. The error was value.includes is not a function. This is because includes can't run on a number, so I did a check for string there.

Let me know what you think.

callinmullaney commented 1 year ago

@ryanhagerty I tested/merged you values.includes. I think this PR is ready for you to confirm.