Skip to content

Commit

Permalink
test(ts-interface-generator): add more testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
akudev committed Sep 25, 2024
1 parent 20ccfa2 commit 53ece8b
Show file tree
Hide file tree
Showing 14 changed files with 2,128 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ declare module "./SampleControl" {
*/
alsoLabelledBy?: Control | string | (Control | string)[];
/**
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
singlePress?: (event: SampleControl$SinglePressEvent) => void;
/**
* Fired when double-clicked.
*/
Expand Down Expand Up @@ -338,6 +343,62 @@ declare module "./SampleControl" {
*/
removeAllAlsoLabelledBy(): string[];
// event: singlePress
/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;
/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param data An application-specific payload object that will be passed to the event handler along with the event object when firing the event
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress<CustomDataType extends object>(data: CustomDataType, fn: (event: SampleControl$SinglePressEvent, data: CustomDataType) => void, listener?: object): this;
/**
* Detaches event handler "fn" from the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* The passed function and listener object must match the ones used for event registration.
*
* @param fn The function to be called, when the event occurs
* @param listener Context object on which the given function had to be called
* @returns Reference to "this" in order to allow method chaining
*/
detachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;
/**
* Fires event "singlePress" to attached listeners.
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* @param parameters Parameters to pass along with the event
* @returns Reference to "this" in order to allow method chaining
*/
fireSinglePress(parameters?: SampleControl$SinglePressEventParameters): this;
// event: doublePress
/**
Expand Down Expand Up @@ -393,19 +454,35 @@ declare module "./SampleControl" {
* The return value of this method indicates whether the default action should be executed.
*
* @param parameters Parameters to pass along with the event
* @param [mParameters.delay] Fired when double-clicked.
*
* @returns Whether or not to prevent the default action
*/
fireDoublePress(parameters?: SampleControl$DoublePressEventParameters): boolean;
}
/**
* Interface describing the parameters of SampleControl's 'singlePress' event.
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
// eslint-disable-next-line
export interface SampleControl$SinglePressEventParameters {
}
/**
* Interface describing the parameters of SampleControl's 'doublePress' event.
* Fired when double-clicked.
*/
// eslint-disable-next-line
export interface SampleControl$DoublePressEventParameters {
delay?: number;
}
/**
* Type describing the SampleControl's 'singlePress' event.
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
export type SampleControl$SinglePressEvent = Event<SampleControl$SinglePressEventParameters>;
/**
* Type describing the SampleControl's 'doublePress' event.
* Fired when double-clicked.
Expand Down Expand Up @@ -661,6 +738,62 @@ declare module "./SampleControl" {
*/
removeAllAlsoLabelledBy(): string[];
// event: singlePress
/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;
/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param data An application-specific payload object that will be passed to the event handler along with the event object when firing the event
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress<CustomDataType extends object>(data: CustomDataType, fn: (event: SampleControl$SinglePressEvent, data: CustomDataType) => void, listener?: object): this;
/**
* Detaches event handler "fn" from the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* The passed function and listener object must match the ones used for event registration.
*
* @param fn The function to be called, when the event occurs
* @param listener Context object on which the given function had to be called
* @returns Reference to "this" in order to allow method chaining
*/
detachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;
/**
* Fires event "singlePress" to attached listeners.
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* @param parameters Parameters to pass along with the event
* @returns Reference to "this" in order to allow method chaining
*/
fireSinglePress(parameters?: SampleControl$SinglePressEventParameters): this;
// event: doublePress
/**
Expand Down Expand Up @@ -716,6 +849,8 @@ declare module "./SampleControl" {
* The return value of this method indicates whether the default action should be executed.
*
* @param parameters Parameters to pass along with the event
* @param [mParameters.delay] Fired when double-clicked.
*
* @returns Whether or not to prevent the default action
*/
fireDoublePress(parameters?: SampleControl$DoublePressEventParameters): boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ declare module "./SampleControl" {
*/
alsoLabelledBy?: Control | string | (Control | string)[];

/**
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
singlePress?: (event: SampleControl$SinglePressEvent) => void;

/**
* Fired when double-clicked.
*/
Expand Down Expand Up @@ -292,6 +297,62 @@ declare module "./SampleControl" {
*/
removeAllAlsoLabelledBy(): string[];

// event: singlePress

/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;

/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param data An application-specific payload object that will be passed to the event handler along with the event object when firing the event
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress<CustomDataType extends object>(data: CustomDataType, fn: (event: SampleControl$SinglePressEvent, data: CustomDataType) => void, listener?: object): this;

/**
* Detaches event handler "fn" from the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* The passed function and listener object must match the ones used for event registration.
*
* @param fn The function to be called, when the event occurs
* @param listener Context object on which the given function had to be called
* @returns Reference to "this" in order to allow method chaining
*/
detachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;

/**
* Fires event "singlePress" to attached listeners.
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* @param parameters Parameters to pass along with the event
* @returns Reference to "this" in order to allow method chaining
*/
fireSinglePress(parameters?: SampleControl$SinglePressEventParameters): this;

// event: doublePress

/**
Expand Down Expand Up @@ -347,19 +408,35 @@ declare module "./SampleControl" {
* The return value of this method indicates whether the default action should be executed.
*
* @param parameters Parameters to pass along with the event
* @param [mParameters.delay] Fired when double-clicked.
*
* @returns Whether or not to prevent the default action
*/
fireDoublePress(parameters?: SampleControl$DoublePressEventParameters): boolean;
}

/**
* Interface describing the parameters of SampleControl's 'singlePress' event.
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
// eslint-disable-next-line
export interface SampleControl$SinglePressEventParameters {
}

/**
* Interface describing the parameters of SampleControl's 'doublePress' event.
* Fired when double-clicked.
*/
// eslint-disable-next-line
export interface SampleControl$DoublePressEventParameters {
delay?: number;
}

/**
* Type describing the SampleControl's 'singlePress' event.
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*/
export type SampleControl$SinglePressEvent = Event<SampleControl$SinglePressEventParameters>;

/**
* Type describing the SampleControl's 'doublePress' event.
* Fired when double-clicked.
Expand Down Expand Up @@ -615,6 +692,62 @@ declare module "./SampleControl" {
*/
removeAllAlsoLabelledBy(): string[];

// event: singlePress

/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;

/**
* Attaches event handler "fn" to the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "SampleControl" itself.
*
* @param data An application-specific payload object that will be passed to the event handler along with the event object when firing the event
* @param fn The function to be called when the event occurs
* @param listener Context object to call the event handler with. Defaults to this "SampleControl" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachSinglePress<CustomDataType extends object>(data: CustomDataType, fn: (event: SampleControl$SinglePressEvent, data: CustomDataType) => void, listener?: object): this;

/**
* Detaches event handler "fn" from the "singlePress" event of this "SampleControl".
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* The passed function and listener object must match the ones used for event registration.
*
* @param fn The function to be called, when the event occurs
* @param listener Context object on which the given function had to be called
* @returns Reference to "this" in order to allow method chaining
*/
detachSinglePress(fn: (event: SampleControl$SinglePressEvent) => void, listener?: object): this;

/**
* Fires event "singlePress" to attached listeners.
*
* Fired when single-clicked. This event has no parameters, which requires an eslint-disable in the generated code.
*
* @param parameters Parameters to pass along with the event
* @returns Reference to "this" in order to allow method chaining
*/
fireSinglePress(parameters?: SampleControl$SinglePressEventParameters): this;

// event: doublePress

/**
Expand Down Expand Up @@ -670,6 +803,8 @@ declare module "./SampleControl" {
* The return value of this method indicates whether the default action should be executed.
*
* @param parameters Parameters to pass along with the event
* @param [mParameters.delay] Fired when double-clicked.
*
* @returns Whether or not to prevent the default action
*/
fireDoublePress(parameters?: SampleControl$DoublePressEventParameters): boolean;
Expand Down
Loading

0 comments on commit 53ece8b

Please sign in to comment.