Skip to content

Commit 82d7b69

Browse files
committed
refactor: Clarify comment ID variable names.
1 parent 7a00c08 commit 82d7b69

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

test/webdriverio/test/workspace_comment_test.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ suite('Workspace comment navigation', function () {
2929
// Setup Selenium for all of the tests
3030
setup(async function () {
3131
this.browser = await testSetup(testFileLocations.NAVIGATION_TEST_BLOCKS);
32-
[this.comment1, this.comment2] = await this.browser.execute(() => {
32+
[this.commentId1, this.commentId2] = await this.browser.execute(() => {
3333
const workspace = Blockly.getMainWorkspace();
3434
const comment1 = Blockly.serialization.workspaceComments.append(
3535
{
@@ -69,11 +69,11 @@ suite('Workspace comment navigation', function () {
6969
await focusOnBlock(this.browser, 'p5_canvas_1');
7070
await keyDown(this.browser);
7171
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
72-
chai.assert.equal(focusedNodeId, this.comment1);
72+
chai.assert.equal(focusedNodeId, this.commentId1);
7373
});
7474

7575
test('Navigate forward from workspace comment to block', async function () {
76-
await focusOnWorkspaceComment(this.browser, this.comment2);
76+
await focusOnWorkspaceComment(this.browser, this.commentId2);
7777
await keyDown(this.browser);
7878
const focusedBlock = await getFocusedBlockType(this.browser);
7979
chai.assert.equal(focusedBlock, 'p5_draw');
@@ -83,101 +83,101 @@ suite('Workspace comment navigation', function () {
8383
await focusOnBlock(this.browser, 'p5_draw_1');
8484
await keyUp(this.browser);
8585
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
86-
chai.assert.equal(focusedNodeId, this.comment2);
86+
chai.assert.equal(focusedNodeId, this.commentId2);
8787
});
8888

8989
test('Navigate backward from workspace comment to block', async function () {
90-
await focusOnWorkspaceComment(this.browser, this.comment1);
90+
await focusOnWorkspaceComment(this.browser, this.commentId1);
9191
await keyUp(this.browser);
9292
const focusedBlock = await getFocusedBlockType(this.browser);
9393
chai.assert.equal(focusedBlock, 'p5_canvas');
9494
});
9595

9696
test('Navigate forward from workspace comment to workspace comment', async function () {
97-
await focusOnWorkspaceComment(this.browser, this.comment1);
97+
await focusOnWorkspaceComment(this.browser, this.commentId1);
9898
await keyDown(this.browser);
9999
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
100-
chai.assert.equal(focusedNodeId, this.comment2);
100+
chai.assert.equal(focusedNodeId, this.commentId2);
101101
});
102102

103103
test('Navigate backward from workspace comment to workspace comment', async function () {
104-
await focusOnWorkspaceComment(this.browser, this.comment2);
104+
await focusOnWorkspaceComment(this.browser, this.commentId2);
105105
await keyUp(this.browser);
106106
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
107-
chai.assert.equal(focusedNodeId, this.comment1);
107+
chai.assert.equal(focusedNodeId, this.commentId1);
108108
});
109109

110110
test('Navigate forward from workspace comment to workspace comment button', async function () {
111-
await focusOnWorkspaceComment(this.browser, this.comment1);
111+
await focusOnWorkspaceComment(this.browser, this.commentId1);
112112
await keyRight(this.browser);
113113
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
114-
chai.assert.equal(focusedNodeId, `${this.comment1}_collapse_bar_button`);
114+
chai.assert.equal(focusedNodeId, `${this.commentId1}_collapse_bar_button`);
115115
});
116116

117117
test('Navigate backward from workspace comment button to workspace comment', async function () {
118-
await focusOnWorkspaceComment(this.browser, this.comment1);
118+
await focusOnWorkspaceComment(this.browser, this.commentId1);
119119
await keyRight(this.browser);
120120
await keyLeft(this.browser);
121121
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
122-
chai.assert.equal(focusedNodeId, this.comment1);
122+
chai.assert.equal(focusedNodeId, this.commentId1);
123123
});
124124

125125
test('Navigate forward from workspace comment button to workspace comment button', async function () {
126-
await focusOnWorkspaceComment(this.browser, this.comment1);
126+
await focusOnWorkspaceComment(this.browser, this.commentId1);
127127
await keyRight(this.browser);
128128
await keyRight(this.browser);
129129
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
130-
chai.assert.equal(focusedNodeId, `${this.comment1}_delete_bar_button`);
130+
chai.assert.equal(focusedNodeId, `${this.commentId1}_delete_bar_button`);
131131
});
132132

133133
test('Navigate backward from workspace comment button to workspace comment button', async function () {
134-
await focusOnWorkspaceComment(this.browser, this.comment1);
134+
await focusOnWorkspaceComment(this.browser, this.commentId1);
135135
await keyRight(this.browser);
136136
await keyRight(this.browser);
137137
await keyLeft(this.browser);
138138
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
139-
chai.assert.equal(focusedNodeId, `${this.comment1}_collapse_bar_button`);
139+
chai.assert.equal(focusedNodeId, `${this.commentId1}_collapse_bar_button`);
140140
});
141141

142142
test('Activate workspace comment button', async function () {
143-
await focusOnWorkspaceComment(this.browser, this.comment1);
143+
await focusOnWorkspaceComment(this.browser, this.commentId1);
144144
await keyRight(this.browser);
145145
await this.browser.keys(Key.Enter);
146146
await this.browser.pause(PAUSE_TIME);
147147
const collapsed = await this.browser.execute((commentId) => {
148148
return Blockly.getMainWorkspace()
149149
.getCommentById(commentId)
150150
?.isCollapsed();
151-
}, this.comment1);
151+
}, this.commentId1);
152152
chai.assert.isTrue(collapsed);
153153
});
154154

155155
test('Activating workspace comment focuses its editor', async function () {
156-
await focusOnWorkspaceComment(this.browser, this.comment1);
156+
await focusOnWorkspaceComment(this.browser, this.commentId1);
157157
await this.browser.keys(Key.Enter);
158158
await this.browser.pause(PAUSE_TIME);
159159
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
160-
chai.assert.equal(focusedNodeId, `${this.comment1}_comment_textarea_`);
160+
chai.assert.equal(focusedNodeId, `${this.commentId1}_comment_textarea_`);
161161
});
162162

163163
test('Terminating editing commits edits and focuses root workspace comment', async function () {
164-
await focusOnWorkspaceComment(this.browser, this.comment1);
164+
await focusOnWorkspaceComment(this.browser, this.commentId1);
165165
await this.browser.keys(Key.Enter);
166166
await this.browser.pause(PAUSE_TIME);
167167
await this.browser.keys('Hello world');
168168
await this.browser.pause(PAUSE_TIME);
169169
await this.browser.keys(Key.Escape);
170170
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
171-
chai.assert.equal(focusedNodeId, `${this.comment1}`);
171+
chai.assert.equal(focusedNodeId, `${this.commentId1}`);
172172

173173
const commentText = await this.browser.execute((commentId) => {
174174
return Blockly.getMainWorkspace().getCommentById(commentId)?.getText();
175-
}, this.comment1);
175+
}, this.commentId1);
176176
chai.assert.equal(commentText, 'Comment oneHello world');
177177
});
178178

179179
test('Action menu can be displayed for a workspace comment', async function () {
180-
await focusOnWorkspaceComment(this.browser, this.comment1);
180+
await focusOnWorkspaceComment(this.browser, this.commentId1);
181181
await this.browser.keys([Key.Ctrl, Key.Return]);
182182
await this.browser.pause(PAUSE_TIME);
183183
chai.assert.isTrue(
@@ -195,9 +195,9 @@ suite('Workspace comment navigation', function () {
195195
});
196196

197197
test('Workspace comments can be moved', async function () {
198-
await focusOnWorkspaceComment(this.browser, this.comment1);
198+
await focusOnWorkspaceComment(this.browser, this.commentId1);
199199

200-
const initialPosition = await this.getCommentLocation(this.comment1);
200+
const initialPosition = await this.getCommentLocation(this.commentId1);
201201
chai.assert.deepEqual(initialPosition, [200, 200]);
202202

203203
await this.browser.keys('m');
@@ -210,7 +210,7 @@ suite('Workspace comment navigation', function () {
210210
await this.browser.pause(PAUSE_TIME);
211211
await this.browser.keys(Key.Enter);
212212

213-
const newPosition = await this.getCommentLocation(this.comment1);
213+
const newPosition = await this.getCommentLocation(this.commentId1);
214214
chai.assert.deepEqual(newPosition, [220, 240]);
215215
});
216216
});

0 commit comments

Comments
 (0)