Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inherited properties test #2263

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a6beb22
Add custom element with inheritance
justinfagnani Oct 17, 2023
9b66359
Update expected tests to 34
justinfagnani Oct 17, 2023
ad31807
Collect all library failures before exiting
justinfagnani Oct 17, 2023
d8cb9d8
Add Angular test
justinfagnani Oct 17, 2023
8be969b
Add Svelte test
justinfagnani Oct 17, 2023
22be6ae
Add AngularJS test
justinfagnani Oct 17, 2023
a28dd5f
Add Dio test
justinfagnani Oct 17, 2023
e103ad3
Add Dojo test
justinfagnani Oct 17, 2023
16c7eaf
Add Hybrids test
justinfagnani Oct 17, 2023
63c8773
Add Hyperapp test
justinfagnani Oct 17, 2023
d6042f4
Add hyperHTML test
justinfagnani Oct 17, 2023
3d2f142
Add Lit test
justinfagnani Oct 17, 2023
cd47c10
Add Mithril test
justinfagnani Oct 17, 2023
65b9177
Add Omi test
justinfagnani Oct 17, 2023
4cbaa95
Add Polymer test
justinfagnani Oct 17, 2023
a150005
Add Preact test
justinfagnani Oct 17, 2023
a75ccf3
Add React test
justinfagnani Oct 17, 2023
5bef7e2
Add React-experimental test
justinfagnani Oct 17, 2023
b89e837
Add Riot test
justinfagnani Oct 17, 2023
430fb2f
Add Skate test
justinfagnani Oct 17, 2023
3fc0c2b
Add Solid test
justinfagnani Oct 17, 2023
7917e80
Add Stencil test
justinfagnani Oct 17, 2023
9e41e90
Add Surplus test
justinfagnani Oct 17, 2023
f263682
Add Vue test
justinfagnani Oct 17, 2023
6536e19
Format expected results
justinfagnani Oct 17, 2023
f154bf0
Address feedback on AngularJS
justinfagnani Oct 18, 2023
e11ab34
Update copyright year
justinfagnani Oct 18, 2023
b0dd42f
Fix imports of ce-with-inheritance
justinfagnani Oct 18, 2023
78fe699
Narrow the test to search for unique failures
justinfagnani Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions libraries/__shared__/webcomponents/src/ce-with-inheritance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* @license
* Copyright 2017 Google Inc. All rights reserved.
justinfagnani marked this conversation as resolved.
Show resolved Hide resolved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

class CEBaseClass extends HTMLElement {
set bool(value) {
this._bool = value;
}
get bool() {
return this._bool;
}
set num(value) {
this._num = value;
}
get num() {
return this._num;
}
set str(value) {
this._str = value;
}
get str() {
return this._str;
}
set arr(value) {
this._arr = value;
}
get arr() {
return this._arr;
}
set obj(value) {
this._obj = value;
}
get obj() {
return this._obj;
}
set camelCaseObj(value) {
this._camelCaseObj = value;
}
get camelCaseObj() {
return this._camelCaseObj;
}
}
class CEWithInheritance extends CEBaseClass {}
customElements.define('ce-with-inheritance', CEWithInheritance);
6 changes: 3 additions & 3 deletions libraries/angular/meta/expectedResults.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"success": 32,
"success": 34,
"failed": 0,
"skipped": 0,
"error": false,
Expand All @@ -12,8 +12,8 @@
"passed": 16
},
"advancedSupport": {
"total": 16,
"total": 18,
"failed": 0,
"passed": 16
"passed": 18
}
}
13 changes: 13 additions & 0 deletions libraries/angular/src/advanced-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
ComponentWithChildrenRerender,
ComponentWithDifferentViews,
ComponentWithProperties,
ComponentWithInheritance,
ComponentWithUnregistered,
ComponentWithImperativeEvent,
ComponentWithDeclarativeEvent
Expand Down Expand Up @@ -78,6 +79,18 @@ describe("advanced support", function() {
let data = wc.camelCaseObj;
expect(data).to.eql({ label: "passed" });
});

it("will pass object data to inherited properties", function() {
this.weight = 2;
let fixture = TestBed.createComponent(ComponentWithInheritance);
fixture.detectChanges();
let root = fixture.debugElement.nativeElement;
let wc = root.querySelector("#wc");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check bools, nums, and strings? Or do you want to do that in a basic test? Follow up PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow up PR?

expect(wc.arr).to.eql(["A", "n", "g", "u", "l", "a", "r"]);
expect(wc.obj).to.eql({ org: "angular", repo: "angular" });
expect(wc.camelCaseObj).to.eql({ label: "passed" });
});

});

describe("events", function() {
Expand Down
26 changes: 26 additions & 0 deletions libraries/angular/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import 'ce-without-children';
import 'ce-with-children';
import 'ce-with-properties';
import 'ce-with-inheritance';
import 'ce-with-event';

@Component({
Expand Down Expand Up @@ -105,6 +106,31 @@ export class ComponentWithProperties {
}
}

@Component({
template: `
<div>
<ce-with-inheritance id="wc"
[bool]="data.bool"
[num]="data.num"
[str]="data.str"
[arr]="data.arr"
[obj]="data.obj"
[camelCaseObj]="data.camelCaseObj"
></ce-with-inheritance>
</div>
`
})
export class ComponentWithInheritance {
data = {
bool: true,
num: 42,
str: 'Angular',
arr: ['A', 'n', 'g', 'u', 'l', 'a', 'r'],
obj: { org: 'angular', repo: 'angular' },
camelCaseObj: { label: "passed" }
}
}

@Component({
template: `
<div>
Expand Down
8 changes: 4 additions & 4 deletions libraries/angularjs/meta/expectedResults.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"success": 30,
"failed": 2,
"failed": 4,
"skipped": 0,
"error": false,
"disconnected": false,
"exitCode": 1,
"score": 94,
"score": 89,
"basicSupport": {
"total": 16,
"failed": 0,
"passed": 16
},
"advancedSupport": {
"total": 16,
"failed": 2,
"total": 18,
"failed": 4,
"passed": 14
}
}
10 changes: 10 additions & 0 deletions libraries/angularjs/src/advanced-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ describe("advanced support", () => {
let data = wc.camelCaseObj;
expect(data).to.eql({ label: "passed" });
});

it("will pass object data to inherited properties", function() {
this.weight = 2;
let root = prep("<comp-with-inheritance>")
scope.$digest()
let wc = root.querySelector('#wc')
expect(wc.arr).to.eql(['A', 'n', 'g', 'u', 'l', 'a', 'r']);
expect(wc.obj).to.eql({ org: "angular", repo: "angular" });
expect(wc.camelCaseObj).to.eql({ label: "passed" });
});
});

describe("events", () => {
Expand Down
29 changes: 29 additions & 0 deletions libraries/angularjs/src/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,34 @@ const ComponentWithProps = {
}
};

const ComponentWithInheritance = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about angularjs but looking at what's already here, i think the component needs to be added here:

import 'angular';
import {
ComponentWithoutChildren,
ComponentWithChildren,
ComponentWithChildrenRerender,
ComponentWithDifferentViews,
ComponentWithProps,
ComponentWithImperativeEvent,
ComponentWithDeclarativeEvent
} from './components';
export default angular.module('ce-tests', [])
.component('compNoChildren', ComponentWithoutChildren)
.component('compWithChildren', ComponentWithChildren)
.component('compWithChildrenRerender', ComponentWithChildrenRerender)
.component('compWithDifferentViews', ComponentWithDifferentViews)
.component('compWithProps', ComponentWithProps)
.component('compWithImperativeEvent', ComponentWithImperativeEvent)
.component('compWithDeclarativeEvent', ComponentWithDeclarativeEvent)
.name;

needs to import ComponentWithInheritance declared here, and needs

.component('compWithInheritance', ComponentWithInheritance)

and the top of this file also has import lines, which probably needs this added

import 'ce-with-inheritance';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.... it's working w/o that, but I'm not sure what that means.

template: `
<div>
<ce-with-inheritance id="wc"
ng-prop-bool="$ctrl.bool"
ng-prop-num="$ctrl.num"
ng-prop-str="$ctrl.str"
ng-prop-arr="$ctrl.arr"
ng-prop-obj="$ctrl.obj"
ng-prop-camel-case-obj="$ctrl.camelCaseObj"
></ce-with-inheritance>
</div>
`,
controller: class {
constructor() {}
$onInit() {
angular.extend(this, {
bool: true,
num: 42,
str: 'Angular',
arr: ['A', 'n', 'g', 'u', 'l', 'a', 'r'],
obj: { org: 'angular', repo: 'angular' },
camelCaseObj: { label: "passed" }
});
}
}
};

const ComponentWithImperativeEvent = {
template: `
<div>
Expand Down Expand Up @@ -154,6 +182,7 @@ export {
ComponentWithChildrenRerender,
ComponentWithDifferentViews,
ComponentWithProps,
ComponentWithInheritance,
ComponentWithImperativeEvent,
ComponentWithDeclarativeEvent
}
6 changes: 3 additions & 3 deletions libraries/dio/meta/expectedResults.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"success": 26,
"success": 28,
"failed": 6,
"skipped": 0,
"error": false,
Expand All @@ -12,8 +12,8 @@
"passed": 16
},
"advancedSupport": {
"total": 16,
"total": 18,
"failed": 6,
"passed": 10
"passed": 12
}
}
12 changes: 11 additions & 1 deletion libraries/dio/src/advanced-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
ComponentWithProperties,
ComponentWithUnregistered,
ComponentWithImperativeEvent,
ComponentWithDeclarativeEvent
ComponentWithDeclarativeEvent,
ComponentWithInheritance
} from "./components";

// Setup the test harness. This will get cleaned out with every test.
Expand Down Expand Up @@ -72,6 +73,15 @@ describe("advanced support", function() {
expect(data).to.eql({ label: "passed" });
});

it("will pass object data to inherited properties", function() {
this.weight = 2;
render(<ComponentWithInheritance />, scratch);
let wc = scratch.querySelector("#wc");
expect(wc.arr).to.eql(["D", "I", "O"]);
expect(wc.obj).to.eql({ org: "thysultan", repo: "dio.js" });
expect(wc.camelCaseObj).to.eql({ label: "passed" });
});

});

describe("events", function() {
Expand Down
25 changes: 25 additions & 0 deletions libraries/dio/src/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,31 @@ export class ComponentWithProperties extends Component {
}
}

export class ComponentWithInheritance extends Component {
justinfagnani marked this conversation as resolved.
Show resolved Hide resolved
render () {
const data = {
bool: true,
num: 42,
str: 'DIO',
arr: ['D', 'I', 'O'],
obj: { org: 'thysultan', repo: 'dio.js' },
camelCaseObj: { label: "passed" }
};
return (
<div>
<ce-with-inheritance id="wc"
bool={data.bool}
num={data.num}
str={data.str}
arr={data.arr}
obj={data.obj}
camelCaseObj={data.camelCaseObj}
></ce-with-inheritance>
</div>
);
}
}

export class ComponentWithUnregistered extends Component {
render () {
const data = {
Expand Down
6 changes: 3 additions & 3 deletions libraries/dojo/meta/expectedResults.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"success": 32,
"success": 34,
"failed": 0,
"skipped": 0,
"error": false,
Expand All @@ -12,8 +12,8 @@
"passed": 16
},
"advancedSupport": {
"total": 16,
"total": 18,
"failed": 0,
"passed": 16
"passed": 18
}
}
13 changes: 12 additions & 1 deletion libraries/dojo/src/advanced-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import { expect } from "chai";
import {
ComponentWithProperties,
ComponentWithDeclarativeEvent
ComponentWithDeclarativeEvent,
ComponentWithInheritance
} from "./components";

import renderer, { w } from "@dojo/framework/core/vdom";
Expand Down Expand Up @@ -70,6 +71,16 @@ describe("advanced support", function() {
expect(data).to.eql({ label: "passed" });
});

it("will pass object data to inherited properties", function() {
this.weight = 2;
const r = renderer(() => w(ComponentWithInheritance, {}));
r.mount({ domNode: scratch, sync: true });
const wc: any = document.querySelector("ce-with-inheritance");
expect(wc.arr).to.eql(["d", "o", "j", "o"]);
expect(wc.obj).to.eql({ org: "dojo", repo: "dojo" });
expect(wc.camelCaseObj).to.eql({ label: "passed" });
});

});

describe("events", function() {
Expand Down
12 changes: 12 additions & 0 deletions libraries/dojo/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ export const ComponentWithProperties = factory(() => {
return v('ce-with-properties', data);
});

export const ComponentWithInheritance = factory(() => {
justinfagnani marked this conversation as resolved.
Show resolved Hide resolved
const data = {
bool: true,
num: 42,
str: 'Dojo',
arr: ['d', 'o', 'j', 'o'],
obj: { org: 'dojo', repo: 'dojo' },
camelCaseObj: { label: "passed" }
};
return v('ce-with-inheritance', data);
});

export const ComponentWithUnregistered = factory(() => {
const data = {
bool: true,
Expand Down
8 changes: 4 additions & 4 deletions libraries/hybrids/meta/expectedResults.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"success": 30,
"failed": 2,
"failed": 4,
"skipped": 0,
"error": false,
"disconnected": false,
"exitCode": 1,
"score": 94,
"score": 89,
"basicSupport": {
"total": 16,
"failed": 0,
"passed": 16
},
"advancedSupport": {
"total": 16,
"failed": 2,
"total": 18,
"failed": 4,
"passed": 14
}
}
Loading
Loading