Skip to content

Commit 1f87068

Browse files
Add camel case named property test (#2239)
* Add camelCase property to shared web component * Fix typo in update-goldens command * Update expected tests to 32 * Add Svelte test * Add Angular test * Add AngularJS test * Add Dio test * Add Dojo test * Add Hybrids test * Add Hyperapp test * Add hyperHTML test * Add Lit test * Add Mithril test * Add Omi test * Add Polymer test * Add Preact test * Add React test * Add React experimental test * Add Riot test * Add Skate test * Add Solid test * Add Stencil test * Add Surplus test * Add Vue test * Format expected results
1 parent fa77020 commit 1f87068

File tree

71 files changed

+362
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+362
-112
lines changed

libraries/__shared__/webcomponents/src/ce-with-properties.js

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class CEWithProperties extends HTMLElement {
4646
get obj() {
4747
return this._obj;
4848
}
49+
set camelCaseObj(value) {
50+
this._camelCaseObj = value;
51+
}
52+
get camelCaseObj() {
53+
return this._camelCaseObj;
54+
}
4955
}
5056

5157
customElements.define('ce-with-properties', CEWithProperties);

libraries/angular/meta/expectedResults.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"success": 30,
2+
"success": 32,
33
"failed": 0,
44
"skipped": 0,
55
"error": false,
@@ -12,8 +12,8 @@
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
15+
"total": 16,
1616
"failed": 0,
17-
"passed": 14
17+
"passed": 16
1818
}
1919
}

libraries/angular/src/advanced-tests.js

+10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ describe("advanced support", function() {
6868
let data = wc.obj;
6969
expect(data).to.eql({ org: "angular", repo: "angular" });
7070
});
71+
72+
it("will pass object data to a camelCase-named property", function() {
73+
this.weight = 2;
74+
let fixture = TestBed.createComponent(ComponentWithProperties);
75+
fixture.detectChanges();
76+
let root = fixture.debugElement.nativeElement;
77+
let wc = root.querySelector("#wc");
78+
let data = wc.camelCaseObj;
79+
expect(data).to.eql({ label: "passed" });
80+
});
7181
});
7282

7383
describe("events", function() {

libraries/angular/src/components.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class ComponentWithDifferentViews {
8989
[str]="data.str"
9090
[arr]="data.arr"
9191
[obj]="data.obj"
92+
[camelCaseObj]="data.camelCaseObj"
9293
></ce-with-properties>
9394
</div>
9495
`
@@ -99,7 +100,8 @@ export class ComponentWithProperties {
99100
num: 42,
100101
str: 'Angular',
101102
arr: ['A', 'n', 'g', 'u', 'l', 'a', 'r'],
102-
obj: { org: 'angular', repo: 'angular' }
103+
obj: { org: 'angular', repo: 'angular' },
104+
camelCaseObj: { label: "passed" }
103105
}
104106
}
105107

Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"success": 30,
3-
"failed": 0,
3+
"failed": 2,
44
"skipped": 0,
55
"error": false,
66
"disconnected": false,
7-
"exitCode": 0,
8-
"score": 100,
7+
"exitCode": 1,
8+
"score": 94,
99
"basicSupport": {
1010
"total": 16,
1111
"failed": 0,
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
16-
"failed": 0,
15+
"total": 16,
16+
"failed": 2,
1717
"passed": 14
1818
}
1919
}

libraries/angularjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"output": [
3636
"results"
3737
],
38-
"command": "cross-env LIBRARY_NAME=angular karma start"
38+
"command": "cross-env LIBRARY_NAME=angular karma start || echo ''"
3939
},
4040
"build": {
4141
"dependencies": [

libraries/angularjs/src/advanced-tests.js

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ describe("advanced support", () => {
3838
let data = wc.obj;
3939
expect(data).to.eql({ org: "angular", repo: "angular" });
4040
});
41+
42+
it("will pass object data to a camelCase-named property", function() {
43+
this.weight = 2;
44+
let root = prep("<comp-with-props>")
45+
scope.$digest()
46+
let wc = root.querySelector('#wc')
47+
let data = wc.camelCaseObj;
48+
expect(data).to.eql({ label: "passed" });
49+
});
4150
});
4251

4352
describe("events", () => {

libraries/angularjs/src/components.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const ComponentWithProps = {
6262
ng-prop-str="$ctrl.str"
6363
ng-prop-arr="$ctrl.arr"
6464
ng-prop-obj="$ctrl.obj"
65+
ng-prop-camel-case-obj="$ctrl.camelCaseObj"
6566
></ce-with-properties>
6667
</div>
6768
`,
@@ -73,7 +74,8 @@ const ComponentWithProps = {
7374
num: 42,
7475
str: 'Angular',
7576
arr: ['A', 'n', 'g', 'u', 'l', 'a', 'r'],
76-
obj: { org: 'angular', repo: 'angular' }
77+
obj: { org: 'angular', repo: 'angular' },
78+
camelCaseObj: { label: "passed" }
7779
});
7880
}
7981
}
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"success": 24,
2+
"success": 26,
33
"failed": 6,
44
"skipped": 0,
55
"error": false,
66
"disconnected": false,
77
"exitCode": 1,
8-
"score": 91,
8+
"score": 92,
99
"basicSupport": {
1010
"total": 16,
1111
"failed": 0,
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
15+
"total": 16,
1616
"failed": 6,
17-
"passed": 8
17+
"passed": 10
1818
}
1919
}

libraries/dio/src/advanced-tests.js

+9
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ describe("advanced support", function() {
6363
let data = wc.obj;
6464
expect(data).to.eql({ org: "thysultan", repo: "dio.js" });
6565
});
66+
67+
it("will pass object data to a camelCase-named property", function() {
68+
this.weight = 2;
69+
render(<ComponentWithProperties />, scratch);
70+
let wc = scratch.querySelector("#wc");
71+
let data = wc.camelCaseObj;
72+
expect(data).to.eql({ label: "passed" });
73+
});
74+
6675
});
6776

6877
describe("events", function() {

libraries/dio/src/components.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export class ComponentWithProperties extends Component {
9191
num: 42,
9292
str: 'DIO',
9393
arr: ['D', 'I', 'O'],
94-
obj: { org: 'thysultan', repo: 'dio.js' }
94+
obj: { org: 'thysultan', repo: 'dio.js' },
95+
camelCaseObj: { label: "passed" }
9596
};
9697
return (
9798
<div>
@@ -101,6 +102,7 @@ export class ComponentWithProperties extends Component {
101102
str={data.str}
102103
arr={data.arr}
103104
obj={data.obj}
105+
camelCaseObj={data.camelCaseObj}
104106
></ce-with-properties>
105107
</div>
106108
);

libraries/dojo/meta/expectedResults.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"success": 30,
2+
"success": 32,
33
"failed": 0,
44
"skipped": 0,
55
"error": false,
@@ -12,8 +12,8 @@
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
15+
"total": 16,
1616
"failed": 0,
17-
"passed": 14
17+
"passed": 16
1818
}
1919
}

libraries/dojo/src/advanced-tests.ts

+10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ describe("advanced support", function() {
6060
const data = wc.obj;
6161
expect(data).to.eql({ org: "dojo", repo: "dojo" });
6262
});
63+
64+
it("will pass object data to a camelCase-named property", function() {
65+
this.weight = 2;
66+
const r = renderer(() => w(ComponentWithProperties, {}));
67+
r.mount({ domNode: scratch, sync: true });
68+
const wc: any = document.querySelector("ce-with-properties");
69+
const data = wc.camelCaseObj;
70+
expect(data).to.eql({ label: "passed" });
71+
});
72+
6373
});
6474

6575
describe("events", function() {

libraries/dojo/src/components.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export const ComponentWithProperties = factory(() => {
6161
num: 42,
6262
str: 'Dojo',
6363
arr: ['d', 'o', 'j', 'o'],
64-
obj: { org: 'dojo', repo: 'dojo' }
64+
obj: { org: 'dojo', repo: 'dojo' },
65+
camelCaseObj: { label: "passed" }
6566
};
6667
return v('ce-with-properties', data);
6768
});
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"success": 30,
3-
"failed": 0,
3+
"failed": 2,
44
"skipped": 0,
55
"error": false,
66
"disconnected": false,
7-
"exitCode": 0,
8-
"score": 100,
7+
"exitCode": 1,
8+
"score": 94,
99
"basicSupport": {
1010
"total": 16,
1111
"failed": 0,
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
16-
"failed": 0,
15+
"total": 16,
16+
"failed": 2,
1717
"passed": 14
1818
}
1919
}

libraries/hybrids/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"output": [
3535
"results"
3636
],
37-
"command": "cross-env LIBRARY_NAME=hybrids karma start"
37+
"command": "cross-env LIBRARY_NAME=hybrids karma start || echo ''"
3838
},
3939
"build": {
4040
"dependencies": [

libraries/hybrids/src/advanced-tests.js

+11
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ describe("advanced support", function() {
6767
done();
6868
});
6969
});
70+
71+
it("will pass object data to a camelCase-named property", function(done) {
72+
this.weight = 2;
73+
requestAnimationFrame(() => {
74+
const wc = root.firstElementChild.shadowRoot.querySelector('#wc');
75+
const data = wc.camelCaseObj;
76+
expect(data).to.eql({ label: "passed" });
77+
done();
78+
});
79+
});
80+
7081
});
7182

7283
describe("events", function() {

libraries/hybrids/src/components.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export const ComponentWithProperties = {
5656
num=${42}
5757
str=${"hybrids"}
5858
arr=${["h", "y", "b", "r", "i", "d", "s"]}
59-
obj=${{ library: "hybrids" }}
59+
obj=${{ library: "hybrids" }},
60+
camelCaseObj=${{ label: "passed" }}
6061
></ce-with-properties>
6162
`,
6263
};

libraries/hyperapp/meta/expectedResults.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"success": 30,
2+
"success": 32,
33
"failed": 0,
44
"skipped": 0,
55
"error": false,
@@ -12,8 +12,8 @@
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
15+
"total": 16,
1616
"failed": 0,
17-
"passed": 14
17+
"passed": 16
1818
}
1919
}

libraries/hyperapp/src/advanced-tests.js

+11
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,25 @@ describe("advanced support", function () {
5252
let wc = testContainer.querySelector("#wc");
5353
expect(wc.arr).to.eql(["H", "y", "p", "e", "r", "a", "p", "p"]);
5454
});
55+
5556
it("will pass object data as a property", async function () {
5657
this.weight = 2;
5758
ComponentWithProperties(root);
5859
await new Promise(requestAnimationFrame);
5960
let wc = testContainer.querySelector("#wc");
6061
expect(wc.obj).to.eql({ org: "Hyperapp", repo: "hyperapp.js" });
6162
});
63+
64+
it("will pass object data to a camelCase-named property", async function () {
65+
this.weight = 2;
66+
ComponentWithProperties(root);
67+
await new Promise(requestAnimationFrame);
68+
let wc = testContainer.querySelector("#wc");
69+
expect(wc.camelCaseObj).to.eql({ label: "passed" });
70+
});
71+
6272
});
73+
6374
describe("events", function () {
6475
it("can declaratively listen to a lowercase DOM event dispatched by a Custom Element", async function () {
6576
this.weight = 2;

libraries/hyperapp/src/components.js

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const ComponentWithProperties = node =>
7676
str: "Hyperapp",
7777
arr: ["H", "y", "p", "e", "r", "a", "p", "p"],
7878
obj: { org: "Hyperapp", repo: "hyperapp.js" },
79+
camelCaseObj: { label: "passed" },
7980
}),
8081
]),
8182
})

libraries/hyperhtml/meta/expectedResults.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"success": 30,
2+
"success": 32,
33
"failed": 0,
44
"skipped": 0,
55
"error": false,
@@ -12,8 +12,8 @@
1212
"passed": 16
1313
},
1414
"advancedSupport": {
15-
"total": 14,
15+
"total": 16,
1616
"failed": 0,
17-
"passed": 14
17+
"passed": 16
1818
}
1919
}

libraries/hyperhtml/src/advanced-tests.js

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ describe("advanced support", function() {
6262
let wc = root.querySelector("#wc");
6363
expect(wc.obj).to.eql({ org: "viperHTML", repo: "hyperHTML" });
6464
});
65+
66+
it("will pass object data to a camelCase-named property", async function() {
67+
this.weight = 2;
68+
ComponentWithProperties(root);
69+
let wc = root.querySelector("#wc");
70+
expect(wc.camelCaseObj).to.eql({ label: "passed" });
71+
});
72+
6573
});
6674

6775
describe("events", function() {

libraries/hyperhtml/src/components.js

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const ComponentWithProperties = (root) => hyper(root)`
7575
str=${'hyperHTML'}
7676
arr=${['h', 'y', 'p', 'e', 'r', 'H', 'T', 'M', 'L']}
7777
obj=${{org: 'viperHTML', repo: 'hyperHTML'}}
78+
camelCaseObj=${{ label: "passed" }}
7879
></ce-with-properties>
7980
</div>`;
8081

0 commit comments

Comments
 (0)