v0.0.11: Added unit-tests, solved the key={...} problem, updated the build/watch configuration of CSX to be able to build minified and non-minified bundle outputs, as well as a CJS version of lib/ (for consuming in Node-environment, like Jest). The previous tests were renamed to examples, and should still need to be updated.

This commit is contained in:
2020-04-14 11:54:30 +02:00
parent 05f0e66a42
commit b95e5506d2
121 changed files with 3406 additions and 4929 deletions

32
examples/basic/index.jsx Normal file
View File

@@ -0,0 +1,32 @@
import {render} from "../../packages/csx";
import style from "./index.scss";
import {ExamplePage} from "./page";
document.body.appendChild(render(<style>{style}</style>));
document.body.appendChild(render(<div class="center-me" iCanDoUpperCaseAttrs={ "yes" }>
<h1>I am a title!</h1>
</div>));
//document.body.appendChild(render(<example-page />));
document.body.appendChild(render(<ExamplePage pageWidth={200} />));
/**
* Continuation suggestionss:
* - style-attribute untested
* - Want a way to toggle classes: <Host class={{'bq-checkbox': true, 'checked': this.isChecked}}> could do
* - Supporting fragments <>...</>?
*/
// Private vars are visible, because of loose mode, not desirable...
class PrivTest{
#privatevar = 1;
get someVar(){
console.log(Object.getOwnPropertyDescriptors(this));
return this.#privatevar;
}
}
let a = new PrivTest();
console.log(a);
console.log(a.someVar);
let preRenderedText = render("I can prerender text-nodes");
document.body.appendChild(render(preRenderedText));