Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR gets the
create_attributes()
function working correctly in both Twig.js and Twing. Specifically, it:create_attribute()
doesn't have working methods #51;{{ attributes.style }}
).Here are the main changes:
lib/Attribute.js
file now uses a new "in-between"class
that makes thedrupal-attribute
npm package compatible with both Twing and Twig.js.lib/functions/create_attribute/definition.js
file has been greatly simplified accordingly.lib/Attribute.js
default-exported theclass
from thedrupal-attribute
package have been removed (since that file now default-exports the "in-between"class
instead).test.failing()
tests intests/Twig.js/functions/create_attribute.js
andtests/Twing/functions/create_attribute.js
have been changed totest()
and now pass.Some notes:
.addClass("class1", "class2")
syntax in the attribute-method tests has been fixed (should be.addClass(["class1", "class2"])
, with the array).id
attribute but also forclass
, since the latter is a special case that's handled differently in the code.tests/Twig.js/functions/create_attribute.js
, the attributes print in the opposite order than expected (i.e.,id
comes beforeclass
in the constructor argument, butclass
prints beforeid
in the rendered string). That makes no difference to a browser, but I did make a comment about it in the file.test.failing()
test at the end of bothtests/Twig.js/functions/create_attribute.js
andtests/Twing/functions/create_attribute.js
to acknowledge that thewithout
filter isn't working withattributes
right now but is supposed to.