-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't break liquid tags inside attributes when sorting classes (#143)
* Revert "Revert "Fix Liquid `capture` sorting (#135)" (#140)" This reverts commit 2aabc3c. * Fix off-by-1 error when String nodes don’t have quotes * Refactor * Add tests * Simplify test cases * Update changelog
- Loading branch information
1 parent
70ea7aa
commit af16880
Showing
5 changed files
with
102 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
let testClassName = 'sm:p-0 p-0' | ||
let testClassNameSorted = 'p-0 sm:p-0' | ||
let yes = '__YES__' | ||
let no = '__NO__' | ||
|
||
module.exports.yes = yes | ||
module.exports.no = no | ||
|
||
module.exports.t = function t(strings, ...values) { | ||
let input = '' | ||
strings.forEach((string, i) => { | ||
input += string + (values[i] ? testClassName : '') | ||
}) | ||
|
||
let output = '' | ||
strings.forEach((string, i) => { | ||
let value = values[i] || '' | ||
if (value === yes) value = testClassNameSorted | ||
else if (value === no) value = testClassName | ||
output += string + value | ||
}) | ||
|
||
return [input, output] | ||
} |