Fix create_attribute function#54
Open
MichaelAllenWarner wants to merge 3 commits intoJohnAlbin:mainfrom
Open
Conversation
This was referenced Apr 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.jsfile now uses a new "in-between"classthat makes thedrupal-attributenpm package compatible with both Twing and Twig.js.lib/functions/create_attribute/definition.jsfile has been greatly simplified accordingly.lib/Attribute.jsdefault-exported theclassfrom thedrupal-attributepackage have been removed (since that file now default-exports the "in-between"classinstead).test.failing()tests intests/Twig.js/functions/create_attribute.jsandtests/Twing/functions/create_attribute.jshave 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).idattribute 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.,idcomes beforeclassin the constructor argument, butclassprints beforeidin 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.jsandtests/Twing/functions/create_attribute.jsto acknowledge that thewithoutfilter isn't working withattributesright now but is supposed to.