Skip to content

Commit

Permalink
Add a typeText function to trigger change after setting element value…
Browse files Browse the repository at this point in the history
… in tests
  • Loading branch information
volkanceylan committed Oct 13, 2024
1 parent dd5876e commit e53c89b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions build/test-utils/editorutils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Fluent } from "@serenity-is/corelib";

export function typeText(editor: { value: string, element: Fluent }, value: string) {
editor.element.trigger("focus");
editor.value = value;
editor.element.trigger("blur");
editor.element.trigger("change");
}
4 changes: 4 additions & 0 deletions build/test-utils/entitydialogutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ export class EntityDialogWrapper<TDialog extends EntityDialog<any, any>> {
waitForAjaxRequests(timeout: number = 10000): Promise<void> {
return waitForAjaxRequests(timeout);
}

getForm<TForm>(type: { new(prefix: string): TForm }): TForm {
return new type(this.actual.idPrefix);
}
}
1 change: 1 addition & 0 deletions build/test-utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./entitydialogutils";
export * from "./editorutils";
export * from "./mocks";
export * from "./waitutils";
2 changes: 1 addition & 1 deletion build/test-utils/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ export function mockGridSize() {
`;

document.head.appendChild(style);
}
}

0 comments on commit e53c89b

Please sign in to comment.