Skip to content

Commit bd1f29f

Browse files
test(vue): add e2e test for Vue component changes (#627)
* test(vue): add e2e test for Vue component changes * prettier * minor tweak * enable headless test back again * prettier
1 parent 1405854 commit bd1f29f

File tree

17 files changed

+917
-168
lines changed

17 files changed

+917
-168
lines changed

example-project/component-library-angular/src/directives/proxies.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ export declare interface MyButton extends Components.MyButton {
4040

4141

4242
@ProxyCmp({
43-
inputs: ['checked', 'color', 'disabled', 'indeterminate', 'mode', 'name', 'value']
43+
inputs: ['alignment', 'checked', 'color', 'disabled', 'indeterminate', 'justify', 'labelPlacement', 'mode', 'name', 'value']
4444
})
4545
@Component({
4646
selector: 'my-checkbox',
4747
changeDetection: ChangeDetectionStrategy.OnPush,
4848
template: '<ng-content></ng-content>',
4949
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
50-
inputs: ['checked', 'color', 'disabled', 'indeterminate', 'mode', 'name', 'value'],
50+
inputs: ['alignment', 'checked', 'color', 'disabled', 'indeterminate', 'justify', 'labelPlacement', 'mode', 'name', 'value'],
5151
})
5252
export class MyCheckbox {
5353
protected el: HTMLMyCheckboxElement;
5454
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
5555
c.detach();
5656
this.el = r.nativeElement;
57-
proxyOutputs(this, this.el, ['myChange', 'myFocus', 'myBlur']);
57+
proxyOutputs(this, this.el, ['ionChange', 'ionFocus', 'ionBlur']);
5858
}
5959
}
6060

@@ -63,17 +63,19 @@ import type { CheckboxChangeEventDetail as IMyCheckboxCheckboxChangeEventDetail
6363

6464
export declare interface MyCheckbox extends Components.MyCheckbox {
6565
/**
66-
* Emitted when the checked property has changed.
66+
* Emitted when the checked property has changed as a result of a user action such as a click.
67+
68+
This event will not emit when programmatically setting the `checked` property.
6769
*/
68-
myChange: EventEmitter<CustomEvent<IMyCheckboxCheckboxChangeEventDetail>>;
70+
ionChange: EventEmitter<CustomEvent<IMyCheckboxCheckboxChangeEventDetail>>;
6971
/**
70-
* Emitted when the toggle has focus.
72+
* Emitted when the checkbox has focus.
7173
*/
72-
myFocus: EventEmitter<CustomEvent<void>>;
74+
ionFocus: EventEmitter<CustomEvent<void>>;
7375
/**
74-
* Emitted when the toggle loses focus.
76+
* Emitted when the checkbox loses focus.
7577
*/
76-
myBlur: EventEmitter<CustomEvent<void>>;
78+
ionBlur: EventEmitter<CustomEvent<void>>;
7779
}
7880

7981

example-project/component-library-react/src/components.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export const MyButton: StencilReactComponent<MyButtonElement, MyButtonEvents> =
4242
});
4343

4444
type MyCheckboxEvents = {
45-
onMyChange: EventName<MyCheckboxCustomEvent<CheckboxChangeEventDetail>>,
46-
onMyFocus: EventName<CustomEvent<void>>,
47-
onMyBlur: EventName<CustomEvent<void>>
45+
onIonChange: EventName<MyCheckboxCustomEvent<CheckboxChangeEventDetail>>,
46+
onIonFocus: EventName<CustomEvent<void>>,
47+
onIonBlur: EventName<CustomEvent<void>>
4848
};
4949

5050
export const MyCheckbox: StencilReactComponent<MyCheckboxElement, MyCheckboxEvents> = /*@__PURE__*/ createComponent<MyCheckboxElement, MyCheckboxEvents>({
@@ -53,9 +53,9 @@ export const MyCheckbox: StencilReactComponent<MyCheckboxElement, MyCheckboxEven
5353
// @ts-ignore - React type of Stencil Output Target may differ from the React version used in the Nuxt.js project, this can be ignored.
5454
react: React,
5555
events: {
56-
onMyChange: 'myChange',
57-
onMyFocus: 'myFocus',
58-
onMyBlur: 'myBlur'
56+
onIonChange: 'ionChange',
57+
onIonFocus: 'ionFocus',
58+
onIonBlur: 'ionBlur'
5959
} as MyCheckboxEvents,
6060
defineCustomElement: defineMyCheckbox
6161
});

example-project/component-library-vue/src/index.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ export const MyCheckbox = /*@__PURE__*/ globalThis.window ? defineContainer<JSX.
6868
'indeterminate',
6969
'disabled',
7070
'value',
71-
'myChange',
72-
'myFocus',
73-
'myBlur',
74-
'myStyle'
71+
'labelPlacement',
72+
'justify',
73+
'alignment',
74+
'ionChange',
75+
'ionFocus',
76+
'ionBlur'
7577
], [
76-
'myChange',
77-
'myFocus',
78-
'myBlur',
79-
'myStyle'
78+
'ionChange',
79+
'ionFocus',
80+
'ionBlur'
8081
],
8182
'checked', 'myChange') : defineStencilSSRComponent({
8283
tagName: 'my-checkbox',
@@ -87,11 +88,12 @@ export const MyCheckbox = /*@__PURE__*/ globalThis.window ? defineContainer<JSX.
8788
'checked': [Boolean, "checked"],
8889
'indeterminate': [Boolean, "indeterminate"],
8990
'disabled': [Boolean, "disabled"],
90-
'value': [String, "value"],
91-
'onMyChange': [Function],
92-
'onMyFocus': [Function],
93-
'onMyBlur': [Function],
94-
'onMyStyle': [Function]
91+
'labelPlacement': [String, "label-placement"],
92+
'justify': [String, "justify"],
93+
'alignment': [String, "alignment"],
94+
'onIonChange': [Function],
95+
'onIonFocus': [Function],
96+
'onIonBlur': [Function]
9597
}
9698
});
9799

example-project/component-library/src/components.d.ts

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
*/
77
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
88
import { AutocompleteTypes, Color, ComponentProps, ComponentRef, OverlayEventDetail, TextFieldTypes } from "./interfaces";
9-
import { CheckboxChangeEventDetail, Color as Color1, StyleEventDetail } from "./components/element-interface";
9+
import { CheckboxChangeEventDetail } from "./components/my-checkbox/my-checkbox";
1010
import { IMyComponent } from "./components/helpers";
1111
import { InputChangeEventDetail } from "./components/my-input/my-input";
12+
import { Color as Color1, StyleEventDetail } from "./components/element-interface";
1213
import { RadioGroupChangeEventDetail } from "./components/my-radio-group/my-radio-group";
1314
import { RangeChangeEventDetail, RangeValue } from "./components/my-range/my-range";
1415
export { AutocompleteTypes, Color, ComponentProps, ComponentRef, OverlayEventDetail, TextFieldTypes } from "./interfaces";
15-
export { CheckboxChangeEventDetail, Color as Color1, StyleEventDetail } from "./components/element-interface";
16+
export { CheckboxChangeEventDetail } from "./components/my-checkbox/my-checkbox";
1617
export { IMyComponent } from "./components/helpers";
1718
export { InputChangeEventDetail } from "./components/my-input/my-input";
19+
export { Color as Color1, StyleEventDetail } from "./components/element-interface";
1820
export { RadioGroupChangeEventDetail } from "./components/my-radio-group/my-radio-group";
1921
export { RangeChangeEventDetail, RangeValue } from "./components/my-range/my-range";
2022
export namespace Components {
@@ -77,14 +79,18 @@ export namespace Components {
7779
"type": 'submit' | 'reset' | 'button';
7880
}
7981
interface MyCheckbox {
82+
/**
83+
* How to control the alignment of the checkbox and label on the cross axis. `"start"`: The label and control will appear on the left of the cross axis in LTR, and on the right side in RTL. `"center"`: The label and control will appear at the center of the cross axis in both LTR and RTL. Setting this property will change the checkbox `display` to `block`.
84+
*/
85+
"alignment"?: 'start' | 'center';
8086
/**
8187
* If `true`, the checkbox is selected.
8288
*/
8389
"checked": boolean;
8490
/**
8591
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
8692
*/
87-
"color"?: Color1;
93+
"color"?: string;
8894
/**
8995
* If `true`, the user cannot interact with the checkbox.
9096
*/
@@ -93,6 +99,14 @@ export namespace Components {
9399
* If `true`, the checkbox will visually appear as indeterminate.
94100
*/
95101
"indeterminate": boolean;
102+
/**
103+
* How to pack the label and checkbox within a line. `"start"`: The label and checkbox will appear on the left in LTR and on the right in RTL. `"end"`: The label and checkbox will appear on the right in LTR and on the left in RTL. `"space-between"`: The label and checkbox will appear on opposite ends of the line with space between the two elements. Setting this property will change the checkbox `display` to `block`.
104+
*/
105+
"justify"?: 'start' | 'end' | 'space-between';
106+
/**
107+
* Where to place the label relative to the checkbox. `"start"`: The label will appear to the left of the checkbox in LTR and to the right in RTL. `"end"`: The label will appear to the right of the checkbox in LTR and to the left in RTL. `"fixed"`: The label has the same behavior as `"start"` except it also has a fixed width. Long text will be truncated with ellipses ("..."). `"stacked"`: The label will appear above the checkbox regardless of the direction. The alignment of the label can be controlled with the `alignment` property.
108+
*/
109+
"labelPlacement": 'start' | 'end' | 'fixed' | 'stacked';
96110
/**
97111
* The mode determines which platform styles to use.
98112
*/
@@ -101,10 +115,11 @@ export namespace Components {
101115
* The name of the control, which is submitted with the form data.
102116
*/
103117
"name": string;
118+
"setFocus": () => Promise<void>;
104119
/**
105-
* The value of the toggle does not mean if it's checked or not, use the `checked` property for that. The value of a toggle is analogous to the value of a `<input type="checkbox">`, it's only used when the toggle participates in a native `<form>`.
120+
* The value of the checkbox does not mean if it's checked or not, use the `checked` property for that. The value of a checkbox is analogous to the value of an `<input type="checkbox">`, it's only used when the checkbox participates in a native `<form>`.
106121
*/
107-
"value": string;
122+
"value": any | null;
108123
}
109124
interface MyComponent {
110125
/**
@@ -462,10 +477,9 @@ declare global {
462477
new (): HTMLMyButtonElement;
463478
};
464479
interface HTMLMyCheckboxElementEventMap {
465-
"myChange": CheckboxChangeEventDetail;
466-
"myFocus": void;
467-
"myBlur": void;
468-
"myStyle": StyleEventDetail;
480+
"ionChange": CheckboxChangeEventDetail;
481+
"ionFocus": void;
482+
"ionBlur": void;
469483
}
470484
interface HTMLMyCheckboxElement extends Components.MyCheckbox, HTMLStencilElement {
471485
addEventListener<K extends keyof HTMLMyCheckboxElementEventMap>(type: K, listener: (this: HTMLMyCheckboxElement, ev: MyCheckboxCustomEvent<HTMLMyCheckboxElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -703,14 +717,18 @@ declare namespace LocalJSX {
703717
"type"?: 'submit' | 'reset' | 'button';
704718
}
705719
interface MyCheckbox {
720+
/**
721+
* How to control the alignment of the checkbox and label on the cross axis. `"start"`: The label and control will appear on the left of the cross axis in LTR, and on the right side in RTL. `"center"`: The label and control will appear at the center of the cross axis in both LTR and RTL. Setting this property will change the checkbox `display` to `block`.
722+
*/
723+
"alignment"?: 'start' | 'center';
706724
/**
707725
* If `true`, the checkbox is selected.
708726
*/
709727
"checked"?: boolean;
710728
/**
711729
* The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics).
712730
*/
713-
"color"?: Color1;
731+
"color"?: string;
714732
/**
715733
* If `true`, the user cannot interact with the checkbox.
716734
*/
@@ -719,6 +737,14 @@ declare namespace LocalJSX {
719737
* If `true`, the checkbox will visually appear as indeterminate.
720738
*/
721739
"indeterminate"?: boolean;
740+
/**
741+
* How to pack the label and checkbox within a line. `"start"`: The label and checkbox will appear on the left in LTR and on the right in RTL. `"end"`: The label and checkbox will appear on the right in LTR and on the left in RTL. `"space-between"`: The label and checkbox will appear on opposite ends of the line with space between the two elements. Setting this property will change the checkbox `display` to `block`.
742+
*/
743+
"justify"?: 'start' | 'end' | 'space-between';
744+
/**
745+
* Where to place the label relative to the checkbox. `"start"`: The label will appear to the left of the checkbox in LTR and to the right in RTL. `"end"`: The label will appear to the right of the checkbox in LTR and to the left in RTL. `"fixed"`: The label has the same behavior as `"start"` except it also has a fixed width. Long text will be truncated with ellipses ("..."). `"stacked"`: The label will appear above the checkbox regardless of the direction. The alignment of the label can be controlled with the `alignment` property.
746+
*/
747+
"labelPlacement"?: 'start' | 'end' | 'fixed' | 'stacked';
722748
/**
723749
* The mode determines which platform styles to use.
724750
*/
@@ -728,25 +754,21 @@ declare namespace LocalJSX {
728754
*/
729755
"name"?: string;
730756
/**
731-
* Emitted when the toggle loses focus.
757+
* Emitted when the checkbox loses focus.
732758
*/
733-
"onMyBlur"?: (event: MyCheckboxCustomEvent<void>) => void;
759+
"onIonBlur"?: (event: MyCheckboxCustomEvent<void>) => void;
734760
/**
735-
* Emitted when the checked property has changed.
761+
* Emitted when the checked property has changed as a result of a user action such as a click. This event will not emit when programmatically setting the `checked` property.
736762
*/
737-
"onMyChange"?: (event: MyCheckboxCustomEvent<CheckboxChangeEventDetail>) => void;
763+
"onIonChange"?: (event: MyCheckboxCustomEvent<CheckboxChangeEventDetail>) => void;
738764
/**
739-
* Emitted when the toggle has focus.
765+
* Emitted when the checkbox has focus.
740766
*/
741-
"onMyFocus"?: (event: MyCheckboxCustomEvent<void>) => void;
767+
"onIonFocus"?: (event: MyCheckboxCustomEvent<void>) => void;
742768
/**
743-
* Emitted when the styles change.
769+
* The value of the checkbox does not mean if it's checked or not, use the `checked` property for that. The value of a checkbox is analogous to the value of an `<input type="checkbox">`, it's only used when the checkbox participates in a native `<form>`.
744770
*/
745-
"onMyStyle"?: (event: MyCheckboxCustomEvent<StyleEventDetail>) => void;
746-
/**
747-
* The value of the toggle does not mean if it's checked or not, use the `checked` property for that. The value of a toggle is analogous to the value of a `<input type="checkbox">`, it's only used when the toggle participates in a native `<form>`.
748-
*/
749-
"value"?: string;
771+
"value"?: any | null;
750772
}
751773
interface MyComponent {
752774
/**

0 commit comments

Comments
 (0)