dothtml 5.2.1 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/lib/dothtml.js +1 -1
  2. package/package.json +2 -1
  3. package/.vscode/launch.json +0 -34
  4. package/.vscode/settings.json +0 -6
  5. package/azure-pipelines.yml +0 -14
  6. package/babel.config.js +0 -1
  7. package/jest.config.ts +0 -207
  8. package/lib/arg-callback-obj.d.ts +0 -29
  9. package/lib/built-in-components/nav-link.d.ts +0 -8
  10. package/lib/built-in-components/router.d.ts +0 -57
  11. package/lib/component.d.ts +0 -82
  12. package/lib/dot-util.d.ts +0 -26
  13. package/lib/dot.d.ts +0 -5
  14. package/lib/dothtml.d.ts +0 -25
  15. package/lib/dothtml.js.LICENSE.txt +0 -1
  16. package/lib/err.d.ts +0 -2
  17. package/lib/event-bus.d.ts +0 -10
  18. package/lib/i-dot.d.ts +0 -674
  19. package/lib/node-polyfill.d.ts +0 -2
  20. package/lib/observable-array.d.ts +0 -49
  21. package/lib/styling/css-types.ts/css-angle.d.ts +0 -7
  22. package/lib/styling/css-types.ts/css-color.d.ts +0 -9
  23. package/lib/styling/css-types.ts/css-complex.d.ts +0 -7
  24. package/lib/styling/css-types.ts/css-data-type.d.ts +0 -5
  25. package/lib/styling/css-types.ts/css-filter.d.ts +0 -22
  26. package/lib/styling/css-types.ts/css-length.d.ts +0 -7
  27. package/lib/styling/css-types.ts/css-number.d.ts +0 -6
  28. package/lib/styling/css-types.ts/css-percentage.d.ts +0 -5
  29. package/lib/styling/css-types.ts/css-transform.d.ts +0 -38
  30. package/lib/styling/css-types.ts/css-unknown.d.ts +0 -6
  31. package/lib/styling/css-types.ts/css-url.d.ts +0 -6
  32. package/lib/styling/i-dotcss.d.ts +0 -1069
  33. package/lib/styling/style-builder.d.ts +0 -24
  34. package/lib/styling/unit-function-tables.d.ts +0 -10
  35. package/out.md +0 -1340
  36. package/src/arg-callback-obj.ts +0 -76
  37. package/src/built-in-components/nav-link.ts +0 -21
  38. package/src/built-in-components/router.ts +0 -315
  39. package/src/component.ts +0 -415
  40. package/src/dot-util.ts +0 -69
  41. package/src/dot.ts +0 -1147
  42. package/src/dothtml.ts +0 -37
  43. package/src/err.ts +0 -22
  44. package/src/event-bus.ts +0 -39
  45. package/src/i-dot.ts +0 -787
  46. package/src/node-polyfill.ts +0 -11
  47. package/src/observable-array.ts +0 -289
  48. package/src/styling/css-types.ts/css-angle.ts +0 -18
  49. package/src/styling/css-types.ts/css-color.ts +0 -233
  50. package/src/styling/css-types.ts/css-complex.ts +0 -20
  51. package/src/styling/css-types.ts/css-data-type.ts +0 -9
  52. package/src/styling/css-types.ts/css-filter.ts +0 -134
  53. package/src/styling/css-types.ts/css-length.ts +0 -20
  54. package/src/styling/css-types.ts/css-number.ts +0 -12
  55. package/src/styling/css-types.ts/css-percentage.ts +0 -10
  56. package/src/styling/css-types.ts/css-transform.ts +0 -220
  57. package/src/styling/css-types.ts/css-unknown.ts +0 -13
  58. package/src/styling/css-types.ts/css-url.ts +0 -41
  59. package/src/styling/i-dotcss.ts +0 -1181
  60. package/src/styling/style-builder.ts +0 -966
  61. package/src/styling/unit-function-tables.ts +0 -24
  62. package/tsconfig.json +0 -99
  63. package/unittests/advanced-bindings.test.ts +0 -421
  64. package/unittests/array-evaluation.test.ts +0 -7
  65. package/unittests/basic-functionality.test.ts +0 -88
  66. package/unittests/calc.test.ts +0 -6
  67. package/unittests/class-binding.test.ts +0 -227
  68. package/unittests/components/component-decorator.-.ts +0 -14
  69. package/unittests/components/components-data.test.ts +0 -153
  70. package/unittests/components/components.test.ts +0 -258
  71. package/unittests/computed.test.ts +0 -35
  72. package/unittests/core.ts +0 -66
  73. package/unittests/element-and-attribute-coverage.test.ts +0 -472
  74. package/unittests/hooks.test.ts +0 -67
  75. package/unittests/immutable-if.test.ts +0 -19
  76. package/unittests/input-bindings.test.ts +0 -166
  77. package/unittests/integration.test.ts +0 -5
  78. package/unittests/iterations.test.ts +0 -18
  79. package/unittests/logic.test.ts +0 -18
  80. package/unittests/non-function-props-rerender.test.ts +0 -86
  81. package/unittests/refs.test.ts +0 -36
  82. package/unittests/routing.-.ts +0 -56
  83. package/unittests/scopes.test.ts +0 -22
  84. package/unittests/special-tags.test.ts +0 -39
  85. package/unittests/styles.test.ts +0 -9
  86. package/unittests/styling/animations.test.ts +0 -14
  87. package/unittests/styling/filters.test.ts +0 -23
  88. package/unittests/styling/inline-styling.test.ts +0 -18
  89. package/unittests/styling/pseudo-selectors.test.ts +0 -33
  90. package/unittests/styling/transformations.test.ts +0 -234
  91. package/unittests/styling/value-interpretation.test.ts +0 -3
  92. package/unittests/testpage.ts +0 -5
  93. package/unittests/wait.test.ts +0 -31
  94. package/webpack.config.js +0 -28
@@ -1,166 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
- import Component from "../src/component";
4
-
5
- // TODO: not sure if this is a valid test case.
6
- // The change event is dispatched on the option element, not the select.
7
- // Need to ensure this works with real elements and user interaction.
8
- class CompBindingInputChangeOption extends Component{
9
- props:{myValue:boolean} = {myValue: false}
10
- builder(){
11
- return dot.select(
12
- dot.option("a").value("a").selected()
13
- .option("b").value("b").bindTo(this.props.myValue)
14
- .option("c").value("c"))}
15
- ready(){
16
- dot(this.$el).as(dot.select).setVal("b");
17
- //this.myValue.setFrom(this.$el.childNodes[1]);
18
- var v = dot(this.$el).as(dot.select).getVal();
19
- this.$el.children[1].dispatchEvent(new Event("change"));
20
- dot(this.$el.parentNode as ParentNode).empty()
21
- .div("Var: " + this.props.myValue)
22
- .div("Input: " + v);
23
- }
24
- }
25
-
26
- class CompBindingWriteInput extends Component{builder(){return dot.div(new CompBindingWrite(dot.input(), "a", "b"))}}
27
- class CompBindingVarChangeInput extends Component{builder(){return dot.div(new CompBindingVarChange(dot.input(), "a", "b"))}}
28
- class CompBindingInputChangeInput extends Component{builder(){return dot.div(new CompBindingInputChange(dot.input(), "a", "b"))}}
29
- class CompBindingWriteTextArea extends Component{builder(){return dot.div(new CompBindingWrite(dot.textArea("x"), "a", "b"))}}
30
- class CompBindingVarChangeTextArea extends Component{builder(){return dot.div(new CompBindingVarChange(dot.textArea("x"), "a", "b"))}}
31
- class CompBindingInputChangeTextArea extends Component{builder(){return dot.div(new CompBindingInputChange(dot.textArea("x"), "a", "b"))}}
32
- class CompBindingWriteCheckboxOn extends Component{builder(){return dot.div(new CompBindingWrite(dot.input().type("checkbox"), false, true))}}
33
- class CompBindingVarChangeCheckboxOn extends Component{builder(){return dot.div(new CompBindingVarChange(dot.input().type("checkbox"), false, true))}}
34
- class CompBindingInputChangeCheckboxOn extends Component{builder(){return dot.div(new CompBindingInputChange(dot.input().type("checkbox"), false, true))}}
35
- class CompBindingWriteCheckboxOff extends Component{builder(){return dot.div(new CompBindingWrite(dot.input().type("checkbox").checked(), true, false))}}
36
- class CompBindingVarChangeCheckboxOff extends Component{builder(){return dot.div(new CompBindingVarChange(dot.input().type("checkbox").checked(), true, false))}}
37
- class CompBindingInputChangeCheckboxOff extends Component{builder(){return dot.div(new CompBindingInputChange(dot.input().type("checkbox").checked(), true, false))}}
38
- class CompBindingWriteRadioOn extends Component{builder(){return dot.div(new CompBindingWrite(dot.input().type("radio").name("radiotest1"), false, true))}}
39
- class CompBindingVarChangeRadioOn extends Component{builder(){return dot.div(new CompBindingVarChange(dot.input().type("radio").name("radiotest2"), false, true))}}
40
- class CompBindingInputChangeRadioOn extends Component{builder(){return dot.div(new CompBindingInputChange(dot.input().type("radio").name("radiotest3"), false, true))}}
41
- class CompBindingWriteRadioOff extends Component{builder(){return dot.div(new CompBindingWrite(dot.input().type("radio").name("radiotest4"), true, false))}}
42
- class CompBindingVarChangeRadioOff extends Component{builder(){return dot.div(new CompBindingVarChange(dot.input().type("radio").name("radiotest5"), true, false))}}
43
- class CompBindingInputChangeRadioOff extends Component{builder(){return dot.div(new CompBindingInputChange(dot.input().type("radio").name("radiotest6"), true, false))}}
44
- class CompBindingWriteSelect extends Component{builder(){return dot.div(new CompBindingWrite(new CompSelect(), "a", "b"))}}
45
- class CompBindingVarChangeSelect extends Component{builder(){return dot.div(new CompBindingVarChange(new CompSelect(), "a", "b"))}}
46
- class CompBindingInputChangeSelect extends Component{builder(){return dot.div(new CompBindingInputChange(new CompSelect(), "a", "b"))}}
47
-
48
- class CompBindingWrite extends Component{
49
- props:{v1:any, v2: any} = {v1: null, v2: null}
50
- builder(input, v1, v2){
51
- this.props.v1 = v1;
52
- this.props.v2 = v2;
53
- return dot.h(input).as(dot.input).bindTo(this.props.v2);
54
- // if(input instanceof Component){
55
- // }
56
- // else
57
- // return dot.h(input).as(dot.input).bindTo(this.props.v2);
58
- }
59
- ready(){
60
- var v = dot(this.$el).as(dot.input).getVal();
61
- dot(this.$el.parentNode as ParentNode).empty()
62
- .div("Var: " + this.props.v2)
63
- .div("Input: " + v);
64
- }
65
- }
66
- class CompBindingVarChange extends Component{
67
- props:{v1:any, v2: any} = {v1: null, v2: null}
68
- builder(input, v1, v2){
69
- this.props.v1 = v1;
70
- this.props.v2 = v2;
71
- return dot.h(input).as(dot.input).bindTo(this.props.v1);
72
- }
73
- ready(){
74
- this.props.v1 = this.props.v2;
75
- var v = dot(this.$el).as(dot.input).getVal();
76
- dot(this.$el.parentNode as ParentNode).empty()
77
- .div("Var: " + this.props.v1)
78
- .div("Input: " + v);
79
- }
80
- }
81
-
82
- class CompBindingInputChange extends Component{
83
- props:{v1:any, v2: any} = {v1: null, v2: null}
84
- builder(input, v1, v2){
85
- this.props.v1 = v1;
86
- this.props.v2 = v2;
87
- //this.myValue = dot.binding(v1);
88
- return dot.h(input).as(dot.input).bindTo(this.props.v1);
89
- }
90
- ready(){
91
- dot(this.$el).as(dot.input).setVal(this.props.v2);
92
- var v = dot(this.$el).as(dot.input).getVal();
93
- this.$el.dispatchEvent(new Event("change"));
94
- //this.v1 = v;
95
- dot(this.$el.parentNode as ParentNode).empty()
96
- .div("Var: " + this.props.v1)
97
- .div("Input: " + v);
98
- }
99
- }
100
-
101
-
102
- // class CompBindingWriteoption extends Component{ builder(){return dot.CompBindingwrite(dot.input(), false, true)}});
103
- // class CompBindingVarchangeOption extends Component{ builder(){return dot.CompBindingVarchange(dot.input(), false, true)}});
104
- // class CompBindingInputChangeOption extends Component{ builder(){return dot.CompBindingInputChange(dot.input(), false, true)}});
105
- class CompBindingWriteOption extends Component{
106
- props:{myValue:boolean} = {myValue: false}
107
- builder(){
108
- this.props.myValue = true;
109
- return dot.select(
110
- dot.option("a").value("a").selected()
111
- .option("b").value("b").bindTo(this.props.myValue)
112
- .option("c").value("c"))
113
- }
114
- ready(){
115
- var v = dot(this.$el).as(dot.select).getVal();
116
- dot(this.$el.parentNode as ParentNode).empty()
117
- .div("Var: " + this.props.myValue).div("Input: " + v)
118
- }
119
- }
120
- class CompBindingVarChangeOption extends Component{
121
- props:{myValue:boolean} = {myValue: false}
122
- builder(){
123
- this.props.myValue = false;
124
- return dot.select(
125
- dot.option("a").value("a").selected()
126
- .option("b").value("b").bindTo(this.props.myValue)
127
- .option("c").value("c"))
128
- }
129
- ready(){
130
- this.props.myValue = true;
131
- var v = dot(this.$el).as(dot.select).getVal();
132
- dot(this.$el.parentNode as ParentNode).empty()
133
- .div("Var: " + this.props.myValue)
134
- .div("Input: " + v)
135
- }
136
- }
137
-
138
- class CompSelect extends Component{ builder(){return dot.select(dot.option("a").value("a").option("b").value("b").option("c").value("c"));}}
139
-
140
-
141
-
142
- addTest("Var bound to input.", function(){return dot.h(new CompBindingWriteInput())}, "<div><div>Var: b</div><div>Input: b</div></div>");
143
- addTest("Var change updating input.", function(){return dot.h(new CompBindingVarChangeInput())}, "<div><div>Var: b</div><div>Input: b</div></div>");
144
- addTest("Input change updating var.", function(){return dot.h(new CompBindingInputChangeInput())}, "<div><div>Var: b</div><div>Input: b</div></div>");
145
- addTest("Var bound to textarea.", function(){return dot.h(new CompBindingWriteTextArea())}, "<div><div>Var: b</div><div>Input: b</div></div>");
146
- addTest("Var change updating textarea.", function(){return dot.h(new CompBindingVarChangeTextArea())}, "<div><div>Var: b</div><div>Input: b</div></div>");
147
- addTest("Textarea change updating var.", function(){return dot.h(new CompBindingInputChangeTextArea())}, "<div><div>Var: b</div><div>Input: b</div></div>");
148
- addTest("Var bound to checkbox on.", function(){return dot.h(new CompBindingWriteCheckboxOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
149
- addTest("Var change updating checkbox on.", function(){return dot.h(new CompBindingVarChangeCheckboxOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
150
- addTest("Checkbox change updating var on.", function(){return dot.h(new CompBindingInputChangeCheckboxOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
151
- addTest("Var bound to checkbox off.", function(){return dot.h(new CompBindingWriteCheckboxOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
152
- addTest("Var change updating checkbox off.", function(){return dot.h(new CompBindingVarChangeCheckboxOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
153
- addTest("Checkbox change updating var.", function(){return dot.h(new CompBindingInputChangeCheckboxOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
154
- addTest("Var bound to radio on.", function(){return dot.h(new CompBindingWriteRadioOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
155
- addTest("Var change updating radio on.", function(){return dot.h(new CompBindingVarChangeRadioOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
156
- addTest("Radio change updating var on.", function(){return dot.h(new CompBindingInputChangeRadioOn())}, "<div><div>Var: true</div><div>Input: true</div></div>");
157
- addTest("Var bound to radio off.", function(){return dot.h(new CompBindingWriteRadioOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
158
- addTest("Var change updating radio off.", function(){return dot.h(new CompBindingVarChangeRadioOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
159
- addTest("Radio change updating var off.", function(){return dot.h(new CompBindingInputChangeRadioOff())}, "<div><div>Var: false</div><div>Input: false</div></div>");
160
- addTest("Var bound to select.", function(){return dot.h(new CompBindingWriteSelect())}, "<div><div>Var: b</div><div>Input: b</div></div>");
161
- addTest("Var change updating select.", function(){return dot.h(new CompBindingVarChangeSelect())}, "<div><div>Var: b</div><div>Input: b</div></div>");
162
- addTest("Select change updating var.", function(){return dot.h(new CompBindingInputChangeSelect())}, "<div><div>Var: b</div><div>Input: b</div></div>");
163
- addTest("Var bound to option.", function(){return dot.h(new CompBindingWriteOption())}, "<div>Var: true</div><div>Input: b</div>");
164
- addTest("Var change updating option.", function(){return dot.h(new CompBindingVarChangeOption())}, "<div>Var: true</div><div>Input: b</div>");
165
- addTest("Option change updating var.", function(){return dot.h(new CompBindingInputChangeOption())}, "<div>Var: true</div><div>Input: b</div>");
166
- // expected output: Object { foo: "bar", baz: 42 }
@@ -1,5 +0,0 @@
1
- import dot from "../lib/dothtml.js";
2
-
3
- test("Integration test.", ()=>{
4
- dot.div();
5
- });
@@ -1,18 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
-
4
- addTest("Iterate.", function(){ return dot.iterate(3, function(i){return dot.h(i)}); }, "012");
5
- addTest("Iterate w/ friends.", function(){ return dot.h("s").iterate(3, function(i){return dot.h(i)}).h("f"); }, "s012f");
6
- addTest("Iterate no return.", function(){ return dot.h("s").iterate(3, function(i){dot.h(i); return dot.t("")}).h("f"); }, "sf");
7
- // addTest("Iterate raw dot.", function(){ return dot.h("s").iterate(3, dot.h("-")).h("f"); }, "s---f");
8
- // addTest("Iterate raw dot HTML.", function(){ return dot.h("s").iterate(3, dot.div()).h("f"); }, "s<div></div><div></div><div></div>f");
9
- // addTest("Iterate text.", function(){ return dot.h("s").iterate(3, "-").h("f"); }, "s---f");
10
- addTest("Nested iterate.", function(){
11
- return dot.h("s")
12
- .iterate(2, function(i){
13
- return dot.iterate(2, function(j){return j})
14
- }).h("f");
15
- }, "s0101f");
16
- addTest("Each.", function(){ return dot.each(["A", "B", "C"], function(x, i){return i + x}); }, "0A1B2C");
17
- addTest("Nested each.", function(){ return dot.each(["A", "B", "C"], function(x, i){return dot.h(i + x).each(["D", "E", "F"], function(y, j){return j + y})}); }, "0A0D1E2F1B0D1E2F2C0D1E2F");
18
- addTest("Hash each.", function(){ return dot.each({a: "x", b: "y", c: "z"}, function(x, i){return i + x}); }, "axbycz");
@@ -1,18 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
-
4
- addTest("If true else.", function(){ return dot.when(true, ()=>"if").otherwise(()=>"else"); }, "if");
5
- addTest("If false else.", function(){ return dot.when(false, ()=>"if").otherwise(()=>"else"); }, "else");
6
- addTest("If false else else.", function(){ return dot.when(false, ()=>"if").otherwise(()=>"else1").otherwise(()=>"else2"); }, "else1else2");
7
- addTest("If true elseif true else.", function(){ return dot.when(true, ()=>"if").otherwiseWhen(true, ()=>"elseif").otherwise(()=>"else"); }, "if");
8
- addTest("If true elseif false else.", function(){ return dot.when(true, ()=>"if").otherwiseWhen(false, ()=>"elseif").otherwise(()=>"else"); }, "if");
9
- addTest("If false elseif true else.", function(){ return dot.when(false, ()=>"if").otherwiseWhen(true, ()=>"elseif").otherwise(()=>"else"); }, "elseif");
10
- addTest("If false elseif false else.", function(){ return dot.when(false, ()=>"if").otherwiseWhen(false, ()=>"elseif").otherwise(()=>"else"); }, "else");
11
- addTest("Nested ifs.", function(){
12
- return dot.when(true,
13
- dot.when(false, ()=>"if if")
14
- .otherwiseWhen(true, ()=>"if elseif")
15
- .otherwise(()=>"if else")
16
- ).otherwiseWhen(true, ()=>"elseif")
17
- .otherwise(()=>"else");
18
- }, "if elseif");
@@ -1,86 +0,0 @@
1
-
2
- /**
3
- * 2022-07-28
4
- * The goal of these tests is to verify that the builder and style functions are called once when properties are updated.
5
- * The previous behavior was that specific elements within components would only be re-rendered if a property was used inside of a function.
6
- * This resulted in some annoying syntax, such as `dot.div(()=>{return this.props.x})`. And then restyling wouldn't happen at all unless expliticly executed.
7
- */
8
-
9
- import dot, { DotComponent, IDotCss, IDotElement } from "../src/dothtml";
10
- import addTest from "./core";
11
-
12
- class TestComponentA extends DotComponent{
13
- props={
14
- myValue: "not-set",
15
- rebuild: "no",
16
- restyle: "no",
17
- }
18
-
19
- builds: number = 0;
20
- styled: number = 0;
21
-
22
- builder(): IDotElement {
23
- this.builds++;
24
-
25
- this.props.rebuild;
26
-
27
- return dot.div(
28
- dot.div(this.props.myValue).div(this.props.myValue).div(()=>{ return this.props.myValue })
29
- );
30
- }
31
-
32
- style(css: IDotCss){
33
- console.log("RESTYLING!!");
34
- this.styled++;
35
-
36
- this.props.restyle;
37
- this.props.myValue;
38
- }
39
- }
40
-
41
- // addTest("Basic build and style.", function(){
42
- // let component = new TestComponentA();
43
- // dot(document.body).h(component);
44
-
45
- // return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
46
- // }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 1 1");
47
-
48
- // addTest("Update rebuild prop.", function(){
49
- // let component = new TestComponentA();
50
- // dot(document.body).h(component);
51
-
52
- // component.props.rebuild = "yes 1";
53
- // component.props.rebuild = "yes 2";
54
-
55
- // return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
56
- // }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 3 1");
57
-
58
- // addTest("Update restyle prop.", function(){
59
- // let component = new TestComponentA();
60
- // dot(document.body).h(component);
61
-
62
- // component.props.restyle = "yes 1";
63
- // component.props.restyle = "yes 2";
64
-
65
- // return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
66
- // }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 1 3");
67
-
68
- addTest("Update value.", function(){
69
- let component = new TestComponentA();
70
- dot(document.body).h(component);
71
-
72
- component.props.myValue = "set";
73
-
74
- return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
75
- }, "<div><div>set</div><div>set</div><div>set</div></div> 2 2");
76
-
77
- // addTest("Update value and other props.", function(){
78
- // let component = new TestComponentA();
79
- // dot(document.body).h(component);
80
-
81
- // component.props.rebuild = "yes";
82
- // component.props.restyle = "yes";
83
- // component.props.myValue = "set";
84
-
85
- // return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
86
- // }, "<div><div>set</div><div>set</div><div>set</div></div> 3 3");
@@ -1,36 +0,0 @@
1
- import addTest from "./core";
2
- import dot, { IDotElement } from "../src/dothtml";
3
-
4
- class RefComponent1 extends dot.Component{
5
- builder(): IDotElement {
6
- return dot.div(
7
- dot
8
- .span().ref("a")
9
- .span().ref("b")
10
- .span().ref("c")
11
- )
12
- }
13
- ready(){
14
- dot(this.$refs.a).t("a");
15
- dot(this.$refs.b).t("b");
16
- dot(this.$refs.c).t("c");
17
- }
18
- }
19
- class RefComponent2 extends dot.Component{
20
- builder(content): IDotElement {
21
- return dot.div(
22
- dot.span().ref("a")
23
- .h(content)
24
- )
25
- }
26
- ready(){
27
- dot(this.$refs.a).t("1");
28
- }
29
- }
30
-
31
- addTest("Ref.", ()=>{
32
- return dot.h(new RefComponent1())
33
- }, "<div><span>a</span><span>b</span><span>c</span></div>");
34
- addTest("Nested ref.", ()=>{
35
- return dot.h(new RefComponent2(new RefComponent1()))
36
- }, "<div><span>1</span><div><span>a</span><span>b</span><span>c</span></div></div>");
@@ -1,56 +0,0 @@
1
- // import addTest from "./core";
2
- // import dot from "../src/dothtml";
3
- // import Component from "../src/component";
4
-
5
- // class defaultpage extends Component{builder(){return dot.h1("Default")}}
6
- // class page1 extends Component{builder(){return dot.h1("Page 1.")}}
7
- // class page2 extends Component{builder(){return dot.h1("Page 2.")}}
8
- // class page3 extends Component{builder(){return dot.h1("Page 3.").router()}}
9
- // class page4 extends Component{builder(){return dot.h1("Good.")}}
10
- // class page5 extends Component{builder(){return dot.h1("Bad.")}}
11
- // class page6_7 extends Component{builder(){return dot.h1("Page 6/7.")}}
12
- // class page6 extends Component{builder(){return dot.h1("Page 6.")}}
13
- // class page7 extends Component{builder(){return dot.h1("Page 7.")}}
14
- // class awesomepage extends Component{builder(){return dot.h1(params.params.title).p(params.params.body)}}
15
- // class notfound extends Component{builder(){return dot.h1("Not Found.")}}
16
-
17
- // var routes = [
18
- // {title: "DOT Tests", path: "/", component: dot.defaultpage},
19
- // {title: "Page 1", path: "1", component: dot.page1},
20
- // {title: "Page 2", path: "2", component: dot.page2},
21
- // {title: "Page 3", path: "3", component: dot.page3},
22
- // {title: "Greedy Page 4", path: "greed", component: dot.page4},
23
- // {title: "Greedy Page 5", path: "greed", component: dot.page5},
24
- // {title: "Page 6/7", path: "6/7", component: dot.page6_7},
25
- // {title: "Awesome", path: "awesome/{title}/{body}", component: dot.awesomepage},
26
- // {title: "Ajax", path: "ajax", component: "testpage.js"},
27
- // {title: "Not Found", path: "*", component: dot.notfound},
28
- // ];
29
- // // addTest("Navigate with no router.", function(){return dot.div("abc").navigate("1")}, "<div>abc</div>");
30
- // // addTest("Chainability of navigate.", function(){return dot.div("abc").navigate("1").div("def")}, "<div>abc</div><div>def</div>");
31
- // // addTest("Default content.", function(){return dot.router(routes, true)}, "<dothtml-router></dothtml-router>");
32
- // // addTest("Default content, undefined navigate.", function(){return dot.router(routes, true).navigate()}, "<dothtml-router><h1>Default</h1></dothtml-router>");
33
- // // addTest("Default content, / navigate.", function(){return dot.router(routes, true).navigate("/")}, "<dothtml-router><h1>Default</h1></dothtml-router>");
34
- // // addTest("Unknown route.", function(){return dot.router(routes, true).navigate("unknown")}, "<dothtml-router><h1>Not Found.</h1></dothtml-router>");
35
- // // addTest("Navigate to 1.", function(){return dot.router(routes, true).navigate("1")}, "<dothtml-router><h1>Page 1.</h1></dothtml-router>");
36
- // // addTest("Navigate to 1/.", function(){return dot.router(routes, true).navigate("1/")}, "<dothtml-router><h1>Page 1.</h1></dothtml-router>");
37
- // // addTest("Navigate to 1 then 2.", function(){return dot.router(routes, true).navigate("1").navigate("2")}, "<dothtml-router><h1>Page 2.</h1></dothtml-router>");
38
- // // addTest("Navigate to the same page.", function(){return dot.router(routes, true).navigate("1").navigate("1")}, "<dothtml-router><h1>Page 1.</h1></dothtml-router>");
39
- // // addTest("Navigate from 1 to undefined.", function(){return dot.router(routes, true).navigate("1").navigate()}, "<dothtml-router><h1>Default</h1></dothtml-router>");
40
- // // addTest("Navigate from 1 to /.", function(){return dot.router(routes, true).navigate("1").navigate("/")}, "<dothtml-router><h1>Default</h1></dothtml-router>");
41
- // // addTest("Navigate to 6/7.", function(){return dot.router(routes, true).navigate("6/7")}, "<dothtml-router><h1>Page 6/7.</h1></dothtml-router>");
42
- // // addTest("Navigate to 6/8.", function(){return dot.router(routes, true).navigate("6/8")}, "<dothtml-router><h1>Not Found.</h1></dothtml-router>");
43
- // // addTest("Params.", function(){return dot.router(routes, true).navigate("awesome/Hello/Hello_World")}, "<dothtml-router><h1>Hello</h1><p>Hello_World</p></dothtml-router>");
44
- // // addTest("Greedy route.", function(){return dot.router(routes, true).navigate("greed")}, "<dothtml-router><h1>Good.</h1></dothtml-router>");
45
- // // addTest("Load page file.", function(){return dot.router(routes, true).navigate("ajax")}, "<dothtml-router><h1>Loaded Page</h1><p>This page was loaded from a file!</p></dothtml-router>");
46
- // // NESTED ROUTING (NOT SUPPORTED YET)
47
- // // addTest("Route not found child.", function(){return dot.router(routes, true).navigate("3/notfound")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router>Route \"notfound\" not found.</dothtml-router></dothtml-router>");
48
- // // addTest("Router in router / default.", function(){return dot.router(routes, true).navigate("3")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Default</h1></dothtml-router></dothtml-router>");
49
- // // addTest("Router in router / page 3/1.", function(){return dot.router(routes, true).navigate("3/1")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Page 1.</h1></dothtml-router></dothtml-router>");
50
- // // addTest("Router in router / page 3/2 => 3/1.", function(){return dot.router(routes, true).navigate("3/2").navigate("3/1")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Page 1.</h1></dothtml-router></dothtml-router>");
51
- // // addTest("Router in router / page 3/2 => 2.", function(){return dot.router(routes, true).navigate("3/1").navigate("2")}, "<dothtml-router><h1>Page 2.</h1></dothtml-router>");
52
- // // addTest("Router in router / page 2 => 3/1.", function(){return dot.router(routes, true).navigate("2").navigate("3/1")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Page 1.</h1></dothtml-router></dothtml-router>");
53
- // // addTest("Router in router / page 3/3/1.", function(){return dot.router(routes, true).navigate("3/3/1")}, "<dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Page 3.</h1><dothtml-router><h1>Page 1.</h1></dothtml-router></dothtml-router></dothtml-router>");
54
- // // CURRENTLY UNDEFINED:
55
- // //addTest("Two routers.", function(){return dot.router(routes, true).router(routes, true).navigate("1")}, "<dothtml-router></dothtml-router><dothtml-router><h1>Page 1.</h1></dothtml-router>");
56
- // // - Add test case for ensuring routers are removed from the allRouters object after calling empty().
@@ -1,22 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
-
4
- dot.resetScopeClass();
5
-
6
- //addTest("Get Last Node.", function(){ return dot.h(dot.div("text").__lastNode.innerHTML)}, "text"); // No longer supported.
7
- //addTest("Get Last Node - h.", function(){ return dot.h(dot.h("<div>text</div>").__lastNode.innerHTML)}, "text"); // No longer supported.
8
- addTest("Named scope.", function(){ return dot.div().class("before").scopeClass("MYSCOPE1", dot.div().class("test")).div().class("after"); }, "<div class=\"before\"></div><div class=\"dot-MYSCOPE1-test\"></div><div class=\"after\"></div>");
9
- addTest("No rollover scope.", function(){ return dot.div().class("test"); }, "<div class=\"test\"></div>");
10
- addTest("Named scope multiple elements.", function(){ return dot.div().scopeClass("MYSCOPE2", dot.div().class("test").div().div().class("test")); }, "<div></div><div class=\"dot-MYSCOPE2-test\"></div><div></div><div class=\"dot-MYSCOPE2-test\"></div>");
11
- //addTest("Unscope.", function(){ return dot.div().scopeClass("MYSCOPE2").div().class("test").div().div().class("test").unscopeClass().div().class("test"); }, "<div></div><div class=\"dot-MYSCOPE2-test\"></div><div></div><div class=\"dot-MYSCOPE2-test\"></div><div class=\"test\"></div>");
12
- //addTest("Extra unscope.", function(){ return dot.div().scopeClass("MYSCOPE2").div().class("test").div().div().class("test").unscopeClass().unscopeClass().div().class("test"); }, "<div></div><div class=\"dot-MYSCOPE2-test\"></div><div></div><div class=\"dot-MYSCOPE2-test\"></div><div class=\"test\"></div>");
13
- addTest("Nested element.", function(){ return dot.div().scopeClass("MYSCOPE", dot.div(dot.div().class("test-inner")).class("test-outer")); }, "<div></div><div class=\"dot-MYSCOPE-test-outer\"><div class=\"dot-MYSCOPE-test-inner\"></div></div>");
14
- addTest("Nested element new document.", function(){ return dot.scopeClass("MYSCOPE", dot.div(dot.div().class("test-inner")).class("test-outer")); }, "<div class=\"dot-MYSCOPE-test-outer\"><div class=\"dot-MYSCOPE-test-inner\"></div></div>");
15
- // I really don't care about this behavior. We can leave it as undefined, or accept the current behavior.
16
- //addTest("Scoped h.", function(){ return dot.scopeClass("MYSCOPE2", dot.h(dot.div().class("test"))); }, "<div class=\"dot-MYSCOPE2-test\"></div>");
17
- addTest("Nested scope.", function(){ return dot.scopeClass("MYSCOPE3", dot.div(dot.div().class("test-inner-before").scopeClass("MYSCOPE4", dot.div().class("test-inner"))).class("test-outer")); }, "<div class=\"dot-MYSCOPE3-test-outer\"><div class=\"dot-MYSCOPE3-test-inner-before\"></div><div class=\"dot-MYSCOPE4-test-inner\"></div></div>");
18
- addTest("Autoscope 1.", function(){ return dot.scopeClass(null, dot.div().class("test")); }, "<div class=\"dot-10000-test\"></div>");
19
- addTest("Autoscope 2.", function(){ return dot.scopeClass(null, dot.div().class("test")); }, "<div class=\"dot-10001-test\"></div>");
20
- addTest("Autoscope 2 with nest.", function(){ return dot.scopeClass(null, dot.div(dot.div().class("test2")).class("test")); }, "<div class=\"dot-10002-test\"><div class=\"dot-10002-test2\"></div></div>");
21
-
22
- addTest("Reset scope.", function(){ dot.resetScopeClass(); return dot.scopeClass(null, dot.div().class("test")); }, "<div class=\"dot-10000-test\"></div>");
@@ -1,39 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
-
4
- addTest("citeE.", function(){ return dot.cite(); }, "<cite></cite>");
5
- addTest("dataE.", function(){ return dot.data(); }, "<data></data>"); //Element not supported by most browsers.
6
- addTest("formE.", function(){ return dot.form(); }, "<form></form>");
7
- addTest("labelE.", function(){ return dot.label(); }, "<label></label>");
8
- addTest("spanE.", function(){ return dot.span(); }, "<span></span>");
9
- addTest("summaryE.", function(){ return dot.summary(); }, "<summary></summary>");
10
-
11
- addTest("citeA.", function(){ return dot.del().quoteCite(1); }, "<del cite=\"1\"></del>");
12
- addTest("dataA.", function(){ return dot.object().objectData(1); }, "<object data=\"1\"></object>");
13
- addTest("formA.", function(){ return dot.input().whichForm(1); }, "<input form=\"1\">");
14
- addTest("labelA.", function(){ return dot.track().trackLabel(1); }, ["<track label=\"1\">", "<track label=\"1\"></track>"]);
15
- addTest("spanA.", function(){ return dot.col().colSpan(1); }, "<col span=\"1\">");
16
- addTest("summaryA.", function(){ return dot.table().tableSummary(1); }, "<table summary=\"1\"></table>");
17
- addTest("optionLabelA.", function(){ return dot.option().optionLabel(1); }, "<option label=\"1\"></option>");
18
- addTest("acceptCharsetA.", function(){ return dot.form().acceptCharset("utf-8"); }, "<form accept-charset=\"utf-8\"></form>");
19
-
20
- // These aren't required anymore because all the overlapping names have been resolved.
21
- // addTest("Smart cite - attribute.", function(){ return dot.del().cite(1); }, "<del cite=\"1\"></del>");
22
- // addTest("Smart form - attribute.", function(){ return dot.input().form(1); }, "<input form=\"1\">");
23
- // addTest("Smart label - attribute.", function(){ return dot.track().label(1); }, ["<track label=\"1\">", "<track label=\"1\"></track>"]);
24
- // addTest("Smart span - attribute.", function(){ return dot.col().span(1); }, "<col span=\"1\">");
25
- // addTest("Smart summary - attribute.", function(){ return dot.table().summary(1); }, "<table summary=\"1\"></table>");
26
- // addTest("Smart cite - element.", function(){ return dot.div().cite(); }, "<div></div><cite></cite>");
27
- // addTest("Smart form - element.", function(){ return dot.div().form(); }, "<div></div><form></form>");
28
- // addTest("Smart label - element.", function(){ return dot.div().label(); }, "<div></div><label></label>");
29
- // addTest("Smart span - element.", function(){ return dot.div().span(); }, "<div></div><span></span>");
30
- // addTest("Smart summary - element.", function(){ return dot.div().summary(); }, "<div></div><summary></summary>");
31
- // addTest("Smart cite - append to blank.", function(){ return dot.citeE(); }, "<cite></cite>");
32
- // addTest("Smart form - append to blank.", function(){ return dot.formE(); }, "<form></form>");
33
- // addTest("Smart label - append to blank.", function(){ return dot.labelE(); }, "<label></label>");
34
- // addTest("Smart span - append to blank.", function(){ return dot.spanE(); }, "<span></span>");
35
- // addTest("Smart summary - append to blank.", function(){ return dot.summaryE(); }, "<summary></summary>");
36
- // addTest("Smart data - basic attribute.", function(){ return dot.object().data(1); }, "<object data=\"1\"></object>");
37
-
38
- addTest("Smart data - custom attribute.", function(){ return dot.div().customData("a", 1); }, "<div data-a=\"1\"></div>");
39
- addTest("Span after an image.", function(){ return dot.span("1").img().src("").span("2"); }, "<span>1</span><img src=\"\"><span>2</span>");
@@ -1,9 +0,0 @@
1
- import addTest from "./core";
2
- import dot from "../src/dothtml";
3
-
4
- addTest("Styles as a string.", function(){ return dot.t(dot.css.width(400).height(300)); }, "width:400px;height:300px;");
5
- addTest("String styles a div.", function(){ return dot.div().style(dot.css.width(400).height(300)); }, "<div style=\"width:400px;height:300px;\"></div>");
6
-
7
- // addTest("Builder styles a div.", function(){ return dot.div().style(css => {
8
- // css.width(400).height(300);
9
- // }); }, "<div style=\"width:400px;height:300px;\"></div>");
@@ -1,14 +0,0 @@
1
-
2
- import addTest from "../core";
3
- import dot from "../../src/dothtml";
4
-
5
- // For testing the passing of data into and out of components via properties and events, respectively.
6
-
7
- addTest("Dotcss returns stringable value.", function(){
8
- return dot.div(dot.css.color(0x102030).border("1px solid black").toString());
9
- }, "<div>color:\"rgb(16, 32, 48);\"border:\" 1px solid black \";</div>");
10
-
11
- addTest("Styling an element.", function(){
12
- return dot.div().style(dot.css.color(0x102030).border("1px solid black").toString());
13
- }, "<div style=\"color:'rgb(16, 32, 48);'border:' 1px solid black ';\"></div>");
14
-
@@ -1,23 +0,0 @@
1
-
2
- import addTest from "../core";
3
- import dot from "../../src/dothtml";
4
-
5
- // TODO: Need much more test coverage. Do later.
6
-
7
- addTest("Blur filter.", function(){
8
- return dot.div().style(
9
- dot.css.filter(f=>f.blur(2))
10
- );
11
- }, `<div style="filter:blur(2px);"></div>`);
12
-
13
- addTest("Multi filter param.", function(){
14
- return dot.div().style(
15
- dot.css.filter(f=>f.dropShadow(4,4,10,"blue"))
16
- );
17
- }, `<div style="filter:drop-shadow(4px 4px 10px rgb(0, 0, 255));"></div>`);
18
-
19
- addTest("Multi filter.", function(){
20
- return dot.div().style(
21
- dot.css.filter(f=>f.blur(2).opacity(20))
22
- );
23
- }, `<div style="filter:blur(2px) opacity(20%);"></div>`);
@@ -1,18 +0,0 @@
1
- import addTest from "../core";
2
- import dot from "../../src/dothtml";
3
-
4
- addTest("Dotcss returns stringable value.", function(){
5
- return dot.div(dot.css.color(0x102030).border("1px solid black").toString());
6
- }, `<div>color:"rgb(16, 32, 48);"border:" 1px solid black ";</div>`);
7
-
8
- addTest("Styling an element.", function(){
9
- return dot.div().style(dot.css.color(0x102030).border("1px solid black"));
10
- }, `<div style="color:'rgb(16, 32, 48);'border:' 1px solid black ';"></div>`);
11
-
12
- addTest("Restyling an element.", function(){
13
- let div = dot.div().style(dot.css.position("absolute").position("fixed"));
14
- // dot.css(div.getLast()).position("absolute");
15
- // dot.css(div.getLast()).position("fixed");
16
- return div;
17
- }, `<div style="position: 'fixed';"></div>`);
18
-
@@ -1,33 +0,0 @@
1
-
2
- import addTest from "../core";
3
- import dot from "../../src/dothtml";
4
-
5
- describe("Pseudo Selectors", () => {
6
- test.todo("pass");
7
- });
8
-
9
- // Possible syntaxes:
10
- // 1. Multiple style functions.
11
- // - dot(target).style(dot.css...)
12
- // - dot(target).styleHover(dot.css...)
13
- // P: Simple syntax.
14
- // C: How would this work in a component's style builder? Multiple style builders seems messed up.
15
- // 2. Pseudo functions.
16
- // - dot(target).style(dot.css...pseudoHover(css=>css...).pseudoVisited(css=>css...)...)
17
- // P: Works for component style functions.
18
- // C: Builder syntax is somewhat heavy.
19
- // 3. DOThtml style.
20
- // - dot(target).style(dot.css...pseudoHover...pseudoVisted...pseudoNone...)
21
- // P: No weird function syntax.
22
- // P: Consistent with dothtml.
23
- // C: Inconsistent with dotcss.
24
- // C: Just weird.
25
- // 4. Pseudo functions v2.
26
- // - dot(target).style(dot.css...pseudo("hover", css=>css...).pseudo("visited", css=>css...)...)
27
- // P/C: same as 2.
28
-
29
- // I think 2 is the winner.
30
-
31
- // addTest("Dotcss returns stringable value.", function(){
32
- // return dot.a("Hover over me!").style(dot.css.pseudoHover(c=>c.color("green")));
33
- // }, `<a style="color:"rgb(0, 255, 0);">Hover over me!</a>`); // TODO: need a way to inject the hover event.