-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from jonsmithers/write-tests-and-clean-up-inde…
…ntation Write tests and clean up indentation code
- Loading branch information
Showing
8 changed files
with
398 additions
and
293 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,149 @@ | ||
Before: | ||
set tabstop=2 | ||
set shiftwidth=2 | ||
set expandtab | ||
|
||
" (IT SHOULD CORRECTLY INDENT...) | ||
Given javascript (LITERAL WITH SINGLE NEWLINE); | ||
{ | ||
html` | ||
`; | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
`; | ||
} | ||
|
||
Given javascript (LITERAL WITH SINGLE HTML TAG); | ||
{ | ||
html` | ||
<div></div> | ||
`; | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
<div></div> | ||
`; | ||
} | ||
|
||
|
||
Given javascript (LITERAL WITH SINGLE SELF CLOSING TAG); | ||
{ | ||
html` | ||
<img /> | ||
`; | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
<img /> | ||
`; | ||
} | ||
|
||
Given javascript (LITERAL AT END OF LINE, NO SEMICOLON); | ||
{ | ||
html` | ||
<div> | ||
</div>` | ||
more() | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
<div> | ||
</div>` | ||
more() | ||
} | ||
|
||
Given javascript (LITERAL AT END OF LINE, WITH SEMICOLON); | ||
{ | ||
html` | ||
<div> | ||
</div>`; | ||
more() | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
<div> | ||
</div>`; | ||
more() | ||
} | ||
|
||
Given javascript (LITERAL AT END OF ONLY LINE); | ||
{ | ||
html` | ||
<div></div>` | ||
more() | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
<div></div>` | ||
more() | ||
} | ||
|
||
Given javascript (NEXT LINE AFTER LITERAL); | ||
{ | ||
html` | ||
${ | ||
html` | ||
<div></div>` } `; | ||
more() | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
${ | ||
html` | ||
<div></div>` } `; | ||
more() | ||
} | ||
|
||
After: | ||
# Given javascript (IGNORED: LITERAL AFTER SELF-CLOSING TAG) | ||
# { | ||
# html` | ||
# <div/> | ||
# `; | ||
# } | ||
# | ||
# Do: | ||
# =G | ||
# | ||
# Expect javascript; | ||
# { | ||
# html` | ||
# <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,12 @@ | ||
|
||
" (IT SHOULD CORRECTLY INDENT...) | ||
Given javascript (COMMENTED TEMPLATES): | ||
// html` | ||
// <div></div>`; | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript: | ||
// html` | ||
// <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,30 @@ | ||
Before: | ||
set tabstop=2 | ||
set shiftwidth=2 | ||
set expandtab | ||
|
||
" (IT SHOULD CORRECTLY INDENT...) | ||
Given javascript (NEXT LINE OF HTML); | ||
{ | ||
html` | ||
${ | ||
html`${ | ||
2 + 2}`} | ||
<div> | ||
</div> | ||
`; | ||
} | ||
|
||
Do: | ||
=G | ||
|
||
Expect javascript; | ||
{ | ||
html` | ||
${ | ||
html`${ | ||
2 + 2}`} | ||
<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
This file was deleted.
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