jomarko commented on code in PR #2462:
URL:
https://github.com/apache/incubator-kie-tools/pull/2462#discussion_r1678872316
##########
packages/dmn-editor/tests-e2e/__fixtures__/nodes.ts:
##########
@@ -163,15 +163,15 @@ export class Nodes {
await this.page.mouse.up();
}
- public async select(args: { name: string; position?: NodePosition }) {
+ public async select(args: { name: string; position?: NodePosition;
dblClick?: boolean }) {
const node = this.get({ name: args.name });
const position =
args.position !== undefined
? await this.getPositionalNodeHandleCoordinates({ node, position:
args.position })
: undefined;
- await node.click({ position });
+ args.dblClick ? await node.dblclick({ position }) : await node.click({
position });
Review Comment:
yes, well spotted. the reason for adding is actually the `nodes.rename`.
Until now, we used `nodes.rename` always just after a node was dragged into the
diagram (it was focused and ready to be renamed, i.e. the text box had focus
and all text was selected so could be replaced with new value)
This PR add a test, where we want to rename a node, that is already in
diagram. For the current implementation of `nodes.rename` it is not enough to
do `node.click()` before renaming is started, but the `node.dblClick` is needed
to start the renaming.
So I decided to keep the responsibility on the test author side. It means
test author needs to know `dblCkick` is needed before node rename starts so
test author needs to call select with `dblClick` option. In other words, I keep
single responsibility for the fixture methods we have. `select` is only for
selecting node (by click or dblClick) and `rename` only renames the node.
I could probably adapt the `nodes.rename` to contain also this `dblCkick`
but then probably we need to change the method name because it will not only
rename, what do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]