Skip to content

Commit

Permalink
fix(StepConversion): fixed the conversion to input steps
Browse files Browse the repository at this point in the history
  • Loading branch information
tabris87 committed Jun 5, 2024
1 parent 5bcf850 commit ac1224a
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 191 deletions.
81 changes: 0 additions & 81 deletions webapp/control/CodeViewer.gen.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,100 +15,19 @@ declare module "./CodeViewer" {
export default interface CodeViewer {

// property: height

/**
* Gets current value of property "height".
*
* Default value is: "100%"
* @returns Value of property "height"
*/
getHeight(): string;

/**
* Sets a new value for property "height".
*
* When called with a value of "null" or "undefined", the default value of the property will be restored.
*
* Default value is: "100%"
* @param [height="100%"] New value for property "height"
* @returns Reference to "this" in order to allow method chaining
*/
setHeight(height: string): this;

// property: language

/**
* Gets current value of property "language".
*
* Default value is: ""
* @returns Value of property "language"
*/
getLanguage(): string;

/**
* Sets a new value for property "language".
*
* When called with a value of "null" or "undefined", the default value of the property will be restored.
*
* Default value is: ""
* @param [language=""] New value for property "language"
* @returns Reference to "this" in order to allow method chaining
*/
setLanguage(language: string): this;

/**
* Binds property "language" to model data.
*
* See {@link sap.ui.base.ManagedObject#bindProperty ManagedObject.bindProperty} for a
* detailed description of the possible properties of "oBindingInfo"
* @param oBindingInfo The binding information
* @returns Reference to "this" in order to allow method chaining
*/
bindLanguage(bindingInfo: PropertyBindingInfo): this;

/**
* Unbinds property "language" from model data.
*
* @returns Reference to "this" in order to allow method chaining
*/
unbindLanguage(): this;

// property: code

/**
* Gets current value of property "code".
*
* Default value is: ""
* @returns Value of property "code"
*/
getCode(): string;

/**
* Sets a new value for property "code".
*
* When called with a value of "null" or "undefined", the default value of the property will be restored.
*
* Default value is: ""
* @param [code=""] New value for property "code"
* @returns Reference to "this" in order to allow method chaining
*/
setCode(code: string): this;

/**
* Binds property "code" to model data.
*
* See {@link sap.ui.base.ManagedObject#bindProperty ManagedObject.bindProperty} for a
* detailed description of the possible properties of "oBindingInfo"
* @param oBindingInfo The binding information
* @returns Reference to "this" in order to allow method chaining
*/
bindCode(bindingInfo: PropertyBindingInfo): this;

/**
* Unbinds property "code" from model data.
*
* @returns Reference to "this" in order to allow method chaining
*/
unbindCode(): this;
}
}
108 changes: 0 additions & 108 deletions webapp/control/EditableTitle.gen.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,129 +16,21 @@ declare module "./EditableTitle" {
export default interface EditableTitle {

// property: prefix

/**
* Gets current value of property "prefix".
*
* Default value is: ""
* @returns Value of property "prefix"
*/
getPrefix(): string;

/**
* Sets a new value for property "prefix".
*
* When called with a value of "null" or "undefined", the default value of the property will be restored.
*
* Default value is: ""
* @param [prefix=""] New value for property "prefix"
* @returns Reference to "this" in order to allow method chaining
*/
setPrefix(prefix: string): this;

/**
* Binds property "prefix" to model data.
*
* See {@link sap.ui.base.ManagedObject#bindProperty ManagedObject.bindProperty} for a
* detailed description of the possible properties of "oBindingInfo"
* @param oBindingInfo The binding information
* @returns Reference to "this" in order to allow method chaining
*/
bindPrefix(bindingInfo: PropertyBindingInfo): this;

/**
* Unbinds property "prefix" from model data.
*
* @returns Reference to "this" in order to allow method chaining
*/
unbindPrefix(): this;

// property: text

/**
* Gets current value of property "text".
*
* Default value is: ""
* @returns Value of property "text"
*/
getText(): string;

/**
* Sets a new value for property "text".
*
* When called with a value of "null" or "undefined", the default value of the property will be restored.
*
* Default value is: ""
* @param [text=""] New value for property "text"
* @returns Reference to "this" in order to allow method chaining
*/
setText(text: string): this;

/**
* Binds property "text" to model data.
*
* See {@link sap.ui.base.ManagedObject#bindProperty ManagedObject.bindProperty} for a
* detailed description of the possible properties of "oBindingInfo"
* @param oBindingInfo The binding information
* @returns Reference to "this" in order to allow method chaining
*/
bindText(bindingInfo: PropertyBindingInfo): this;

/**
* Unbinds property "text" from model data.
*
* @returns Reference to "this" in order to allow method chaining
*/
unbindText(): this;

// event: change

/**
* Attaches event handler "fn" to the "change" event of this "EditableTitle".
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "EditableTitle" 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 "EditableTitle" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachChange(fn: (event: EditableTitle$ChangeEvent) => void, listener?: object): this;

/**
* Attaches event handler "fn" to the "change" event of this "EditableTitle".
*
* When called, the context of the event handler (its "this") will be bound to "oListener" if specified,
* otherwise it will be bound to this "EditableTitle" 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 "EditableTitle" itself
*
* @returns Reference to "this" in order to allow method chaining
*/
attachChange<CustomDataType extends object>(data: CustomDataType, fn: (event: EditableTitle$ChangeEvent, data: CustomDataType) => void, listener?: object): this;

/**
* Detaches event handler "fn" from the "change" event of this "EditableTitle".
*
* 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
*/
detachChange(fn: (event: EditableTitle$ChangeEvent) => void, listener?: object): this;

/**
* Fires event "change" to attached listeners.
*
* @param parameters Parameters to pass along with the event
* @param [mParameters.value]
*
* @returns Reference to "this" in order to allow method chaining
*/
fireChange(parameters?: EditableTitle$ChangeEventParameters): this;
}

Expand Down
2 changes: 1 addition & 1 deletion webapp/service/JourneyStorage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default class JourneyStorageService {
if (!el) {
a.push([b]);
} else {
if (el[0].equalsTo(b) && b.actionType === StepType.KEYPRESS) {
if (el[0].control.controlId.id === b.control.controlId.id && b.actionType === StepType.KEYPRESS) {
el.push(b);
a.push(el);
} else {
Expand Down
107 changes: 107 additions & 0 deletions webapp/test/unit/service/JourneyStorage.service.qunit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import Journey from "com/ui5/journeyrecorder/model/class/Journey.class";
import { ClickStep, Control, InputStep, KeyPressStep, ValidationStep } from "com/ui5/journeyrecorder/model/class/Step.class";
import JourneyStorageService from "com/ui5/journeyrecorder/service/JourneyStorage.service";

QUnit.module("JourneyStorageService");

QUnit.test("The JourneyStorageService generates a correct InputStep from a Select and KeyPress Step", function(assert) {
const stepControl: Control = {
controlId: {
id: "control",
use: true
},
type: "Input"
};
const location = "DummyURL";
const viewInfo = {
absoluteViewName: "test.whatever.View",
relativeViewName: "View"
};

const valStep = new ValidationStep();
valStep.control = stepControl;
valStep.actionLocation = location;
valStep.viewInfos = viewInfo;

const keyPress1Step = new KeyPressStep();
keyPress1Step.control = stepControl;
keyPress1Step.actionLocation = location;
keyPress1Step.viewInfos = viewInfo;
keyPress1Step.key = "1"
keyPress1Step.keyCode = 49

const keyPress2Step = new KeyPressStep();
keyPress2Step.control = stepControl;
keyPress2Step.actionLocation = location;
keyPress2Step.viewInfos = viewInfo;
keyPress2Step.key = "2"
keyPress2Step.keyCode = 50

const recording = {
id: "123",
created: Date.now(),
steps: [
valStep,
keyPress1Step,
keyPress2Step
]
};

const genJourney = JourneyStorageService.createJourneyFromRecording(recording);
assert.ok(genJourney instanceof Journey);
assert.ok(genJourney.id);
assert.ok(genJourney.created <= Date.now());
assert.ok(genJourney.steps[0] instanceof InputStep);
});



QUnit.test("The JourneyStorageService generates a correct InputStep from a Click and KeyPress Step", function(assert) {
const stepControl: Control = {
controlId: {
id: "control",
use: true
},
type: "Input"
};
const location = "DummyURL";
const viewInfo = {
absoluteViewName: "test.whatever.View",
relativeViewName: "View"
};

const valStep = new ClickStep();
valStep.control = stepControl;
valStep.actionLocation = location;
valStep.viewInfos = viewInfo;

const keyPress1Step = new KeyPressStep();
keyPress1Step.control = stepControl;
keyPress1Step.actionLocation = location;
keyPress1Step.viewInfos = viewInfo;
keyPress1Step.key = "1"
keyPress1Step.keyCode = 49

const keyPress2Step = new KeyPressStep();
keyPress2Step.control = stepControl;
keyPress2Step.actionLocation = location;
keyPress2Step.viewInfos = viewInfo;
keyPress2Step.key = "2"
keyPress2Step.keyCode = 50

const recording = {
id: "123",
created: Date.now(),
steps: [
valStep,
keyPress1Step,
keyPress2Step
]
};

const genJourney = JourneyStorageService.createJourneyFromRecording(recording);
assert.ok(genJourney instanceof Journey);
assert.ok(genJourney.id);
assert.ok(genJourney.created <= Date.now());
assert.ok(genJourney.steps[0] instanceof InputStep);
});
4 changes: 3 additions & 1 deletion webapp/test/unit/unitTests.qunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
QUnit.config.autostart = false;

// import all your QUnit tests here
void Promise.all([/* import("unit/controller/Main.qunit") */ import("unit/class/Journey.class.qunit")]).then(() => {
void Promise.all([
import("unit/service/JourneyStorage.service.qunit"),
import("unit/class/Journey.class.qunit")]).then(() => {
QUnit.start();
});

0 comments on commit ac1224a

Please sign in to comment.