Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle shorthands in attributes correctly (#33)
* Updates after pulling * Add tests for handling unescaped attributes * Add tests for attributes shorthands * Add the possibility to handle attributes correctly * Expect mustEscape set to `false` for boolean attributes * Consider that boolean attributes does not nead to be escaped * Allow throwing context-related errors for inline code * Upgrade flow-bin * Show errors with referencing to context * Get rid of extra types * Make code more clear: Get rid of .includes method for array of 2 items * Update react dependencies and remove temporary workaround * Add tests for numbers as a value of attribute * Small refactoring: rename variables and simplify the logic * Update dependencies to get new API of pug-parser
- Loading branch information
1 parent
83d3350
commit 3fb864e
Showing
9 changed files
with
247 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
[include] | ||
|
||
[libs] | ||
|
||
|
||
./scripts/babel-nodes.js | ||
|
||
[lints] | ||
|
||
[options] | ||
|
||
[strict] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
25 changes: 25 additions & 0 deletions
25
src/__tests__/__snapshots__/attributes-shorthand.test.js.snap
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,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`JavaScript output: transformed source code 1`] = ` | ||
"// To prevent warnings in console from react | ||
const test = 10; | ||
module.exports = <div data-first={true} data-second={true} data-positive={true} data-negative={false} data-check={true}><div data-one={true} data-two={true} /></div>;" | ||
`; | ||
|
||
exports[`html output: generated html 1`] = ` | ||
<div | ||
data-check={true} | ||
data-first={true} | ||
data-negative={false} | ||
data-positive={true} | ||
data-second={true} | ||
> | ||
<div | ||
data-one={true} | ||
data-two={true} | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`static html output: static html 1`] = `"<div data-first=\\"true\\" data-second=\\"true\\" data-positive=\\"true\\" data-negative=\\"false\\" data-check=\\"true\\"><div data-one=\\"true\\" data-two=\\"true\\"></div></div>"`; |
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,13 @@ | ||
// To prevent warnings in console from react | ||
const test = 10; | ||
|
||
module.exports = pug` | ||
div( | ||
data-first | ||
data-second | ||
data-positive=true | ||
data-negative=false | ||
data-check | ||
) | ||
div(data-one data-two) | ||
`; |
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,3 @@ | ||
import testHelper from './test-helper'; | ||
|
||
testHelper(__dirname + '/attributes-shorthand.input.js'); |
Oops, something went wrong.