-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preliminary support for
bool:
[needs help] (#347)
* preliminary support for ``bool:` * make code smaller * value of attribute should be empty when adding it to the dom * inline bool: attribute into the template when possible * fix prop name * undo space test
- Loading branch information
1 parent
f9a00f7
commit a21a043
Showing
11 changed files
with
404 additions
and
49 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
80 changes: 54 additions & 26 deletions
80
packages/babel-plugin-jsx-dom-expressions/test/__dom_fixtures__/customElements/code.js
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 |
---|---|---|
@@ -1,26 +1,54 @@ | ||
const template = ( | ||
<my-element some-attr={name} notProp={data} attr:my-attr={data} prop:someProp={data} /> | ||
); | ||
|
||
const template2 = ( | ||
<my-element | ||
some-attr={state.name} | ||
notProp={state.data} | ||
attr:my-attr={state.data} | ||
prop:someProp={state.data} | ||
/> | ||
); | ||
|
||
const template3 = ( | ||
<my-element> | ||
<header slot="head">Title</header> | ||
</my-element> | ||
); | ||
|
||
const template4 = ( | ||
<> | ||
<slot name="head"></slot> | ||
</> | ||
); | ||
|
||
const template5 = <a is="my-element" />; | ||
const template = ( | ||
<my-element some-attr={name} notProp={data} attr:my-attr={data} prop:someProp={data} /> | ||
); | ||
|
||
const template2 = ( | ||
<my-element | ||
some-attr={state.name} | ||
notProp={state.data} | ||
attr:my-attr={state.data} | ||
prop:someProp={state.data} | ||
/> | ||
); | ||
|
||
const template3 = ( | ||
<my-element> | ||
<header slot="head">Title</header> | ||
</my-element> | ||
); | ||
|
||
const template4 = ( | ||
<> | ||
<slot name="head"></slot> | ||
</> | ||
); | ||
|
||
const template5 = <a is="my-element" />; | ||
|
||
// bool: | ||
function boolTest(){return true} | ||
const boolTestBinding = false | ||
const boolTestObjBinding = {value:false} | ||
|
||
const template42 = <my-el bool:quack="">empty string</my-el>; | ||
const template43 = <my-el bool:quack={""}>js empty</my-el>; | ||
const template44 = <my-el bool:quack="hola">hola</my-el>; | ||
const template45 = <my-el bool:quack={"hola js"}>"hola js"</my-el>; | ||
const template46 = <my-el bool:quack={true}>true</my-el>; | ||
const template47 = <my-el bool:quack={false}>false</my-el>; | ||
const template48 = <my-el bool:quack={1}>1</my-el>; | ||
const template49 = <my-el bool:quack={0}>0</my-el>; | ||
const template50 = <my-el bool:quack={"1"}>"1"</my-el>; | ||
const template51 = <my-el bool:quack={"0"}>"0"</my-el>; | ||
const template52 = <my-el bool:quack={undefined}>undefined</my-el>; | ||
const template53 = <my-el bool:quack={null}>null</my-el>; | ||
const template54 = <my-el bool:quack={boolTest()}>boolTest()</my-el>; | ||
const template55 = <my-el bool:quack={boolTest}>boolTest</my-el>; | ||
const template56 = <my-el bool:quack={boolTestBinding}>boolTestBinding</my-el>; | ||
const template57 = <my-el bool:quack={boolTestObjBinding.value}>boolTestObjBinding.value</my-el>; | ||
const template58 = <my-el bool:quack={()=>false}>fn</my-el>; | ||
|
||
const template59 = <my-el before bool:quack="true">should have space before</my-el>; | ||
const template60 = <my-el before bool:quack="true" after>should have space before/after</my-el>; | ||
const template61 = <my-el bool:quack="true" after>should have space before/after</my-el>; | ||
// this crash it for some reason- */ const template62 = <div bool:quack>really empty</div>; |
Oops, something went wrong.