Skip to content

Commit 7caf099

Browse files
committed
replace more occurences
1 parent dae124e commit 7caf099

File tree

11 files changed

+61
-72
lines changed

11 files changed

+61
-72
lines changed

packages/combo-box/test/interactions.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@vaadin/chai-plugins';
2-
import { resetMouse, sendKeys, sendMouse } from '@vaadin/test-runner-commands';
2+
import { resetMouse, sendKeys, sendMouse, sendMouseToElement } from '@vaadin/test-runner-commands';
33
import {
44
aTimeout,
55
click,
@@ -224,8 +224,7 @@ describe('interactions', () => {
224224
it('should keep focus in the input on toggle button click', async () => {
225225
comboBox.focus();
226226
comboBox.open();
227-
const rect = comboBox._toggleElement.getBoundingClientRect();
228-
await sendMouse({ type: 'click', position: [rect.x, rect.y] });
227+
await sendMouseToElement({ type: 'click', element: comboBox._toggleElement });
229228
expect(document.activeElement).to.equal(input);
230229
});
231230

packages/combo-box/test/visual/lumo/combo-box.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown, nextFrame } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../common.js';
@@ -126,21 +126,23 @@ describe('combo-box', () => {
126126
element.autoOpenDisabled = true;
127127
});
128128

129+
afterEach(async () => {
130+
await resetMouse();
131+
});
132+
129133
it('keyboard focus-ring', async () => {
130134
await sendKeys({ press: 'Tab' });
131135
await visualDiff(div, 'keyboard-focus-ring');
132136
});
133137

134138
it('pointer focus-ring disabled', async () => {
135-
const bounds = element.getBoundingClientRect();
136-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
139+
await sendMouseToElement({ type: 'click', element });
137140
await visualDiff(div, 'pointer-focus-ring-disabled');
138141
});
139142

140143
it('pointer focus-ring enabled', async () => {
141144
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
142-
const bounds = element.getBoundingClientRect();
143-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
145+
await sendMouseToElement({ type: 'click', element });
144146
await visualDiff(div, 'pointer-focus-ring-enabled');
145147
});
146148
});

packages/dashboard/test/dashboard-widget-reordering.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ describe('dashboard - widget reordering', () => {
143143
dashboard.addEventListener('dashboard-item-selected-changed', spy);
144144
await resetMouse();
145145
// Hover over the widget drag handle
146-
await sendMouseToElement(getDraggable(getElementFromCell(dashboard, 0, 0)!));
146+
await sendMouseToElement({
147+
type: 'move',
148+
element: getDraggable(getElementFromCell(dashboard, 0, 0)!),
149+
});
147150
// Press down the left mouse button
148151
await sendMouse({
149152
type: 'down',

packages/date-picker/test/visual/lumo/date-picker.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../../not-animated-styles.js';
@@ -129,21 +129,23 @@ describe('date-picker', () => {
129129
element.autoOpenDisabled = true;
130130
});
131131

132+
afterEach(async () => {
133+
await resetMouse();
134+
});
135+
132136
it('keyboard focus-ring', async () => {
133137
await sendKeys({ press: 'Tab' });
134138
await visualDiff(div, 'keyboard-focus-ring');
135139
});
136140

137141
it('pointer focus-ring disabled', async () => {
138-
const bounds = element.getBoundingClientRect();
139-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
142+
await sendMouseToElement({ type: 'click', element });
140143
await visualDiff(div, 'pointer-focus-ring-disabled');
141144
});
142145

143146
it('pointer focus-ring enabled', async () => {
144147
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
145-
const bounds = element.getBoundingClientRect();
146-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
148+
await sendMouseToElement({ type: 'click', element });
147149
await visualDiff(div, 'pointer-focus-ring-enabled');
148150
});
149151
});

packages/grid-pro/test/edit-column-renderer.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@vaadin/chai-plugins';
2-
import { sendMouse } from '@vaadin/test-runner-commands';
2+
import { resetMouse, sendMouseToElement } from '@vaadin/test-runner-commands';
33
import { enter, esc, fixtureSync, focusout, nextFrame, space } from '@vaadin/testing-helpers';
44
import sinon from 'sinon';
55
import '../theme/lumo/vaadin-grid-pro.js';
@@ -159,6 +159,10 @@ describe('edit column renderer', () => {
159159
cell = getContainerCell(grid.$.items, 0, 0);
160160
});
161161

162+
afterEach(async () => {
163+
await resetMouse();
164+
});
165+
162166
it('should call the edit mode renderer to cell when entering edit mode', () => {
163167
column.editModeRenderer = function (root) {
164168
root.innerHTML = '<input>';
@@ -265,8 +269,7 @@ describe('edit column renderer', () => {
265269
await nextFrame();
266270
editor = getCellEditor(cell);
267271

268-
const { x, y } = editor.$.clearButton.getBoundingClientRect();
269-
await sendMouse({ type: 'click', position: [Math.floor(x + 10), Math.floor(y + 10)] });
272+
await sendMouseToElement({ type: 'click', element: editor.$.clearButton });
270273
await nextFrame();
271274
expect(getCellEditor(cell)).to.be.ok;
272275
});

packages/multi-select-combo-box/test/visual/lumo/multi-select-combo-box.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../common.js';
@@ -189,21 +189,23 @@ describe('multi-select-combo-box', () => {
189189
element.autoOpenDisabled = true;
190190
});
191191

192+
afterEach(async () => {
193+
await resetMouse();
194+
});
195+
192196
it('keyboard focus-ring', async () => {
193197
await sendKeys({ press: 'Tab' });
194198
await visualDiff(div, 'keyboard-focus-ring');
195199
});
196200

197201
it('pointer focus-ring disabled', async () => {
198-
const bounds = element.getBoundingClientRect();
199-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
202+
await sendMouseToElement({ type: 'click', element });
200203
await visualDiff(div, 'pointer-focus-ring-disabled');
201204
});
202205

203206
it('pointer focus-ring enabled', async () => {
204207
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
205-
const bounds = element.getBoundingClientRect();
206-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
208+
await sendMouseToElement({ type: 'click', element });
207209
await visualDiff(div, 'pointer-focus-ring-enabled');
208210
});
209211
});

packages/number-field/test/visual/lumo/number-field.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../common.js';
@@ -134,21 +134,23 @@ describe('number-field', () => {
134134
});
135135

136136
describe('focus', () => {
137+
afterEach(async () => {
138+
await resetMouse();
139+
});
140+
137141
it('keyboard focus-ring', async () => {
138142
await sendKeys({ press: 'Tab' });
139143
await visualDiff(div, 'keyboard-focus-ring');
140144
});
141145

142146
it('pointer focus-ring disabled', async () => {
143-
const bounds = element.getBoundingClientRect();
144-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
147+
await sendMouseToElement({ type: 'click', element });
145148
await visualDiff(div, 'pointer-focus-ring-disabled');
146149
});
147150

148151
it('pointer focus-ring enabled', async () => {
149152
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
150-
const bounds = element.getBoundingClientRect();
151-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
153+
await sendMouseToElement({ type: 'click', element });
152154
await visualDiff(div, 'pointer-focus-ring-enabled');
153155
});
154156
});

packages/text-area/test/visual/lumo/text-area.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../common.js';
@@ -148,21 +148,23 @@ describe('text-area', () => {
148148
});
149149

150150
describe('focus', () => {
151+
afterEach(async () => {
152+
await resetMouse();
153+
});
154+
151155
it('keyboard focus-ring', async () => {
152156
await sendKeys({ press: 'Tab' });
153157
await visualDiff(div, 'keyboard-focus-ring');
154158
});
155159

156160
it('pointer focus-ring disabled', async () => {
157-
const bounds = element.getBoundingClientRect();
158-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
161+
await sendMouseToElement({ type: 'click', element });
159162
await visualDiff(div, 'pointer-focus-ring-disabled');
160163
});
161164

162165
it('pointer focus-ring enabled', async () => {
163166
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
164-
const bounds = element.getBoundingClientRect();
165-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
167+
await sendMouseToElement({ type: 'click', element });
166168
await visualDiff(div, 'pointer-focus-ring-enabled');
167169
});
168170
});

packages/text-field/test/visual/lumo/text-field.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouse, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '@vaadin/vaadin-lumo-styles/test/autoload.js';
@@ -197,6 +197,10 @@ describe('text-field', () => {
197197
});
198198

199199
describe('focus', () => {
200+
afterEach(async () => {
201+
await resetMouse();
202+
});
203+
200204
it('keyboard focus-ring', async () => {
201205
await sendKeys({ press: 'Tab' });
202206
await visualDiff(div, 'keyboard-focus-ring');
@@ -209,15 +213,13 @@ describe('text-field', () => {
209213
});
210214

211215
it('pointer focus-ring disabled', async () => {
212-
const bounds = element.getBoundingClientRect();
213-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
216+
await sendMouseToElement({ type: 'click', element });
214217
await visualDiff(div, 'pointer-focus-ring-disabled');
215218
});
216219

217220
it('pointer focus-ring enabled', async () => {
218221
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
219-
const bounds = element.getBoundingClientRect();
220-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
222+
await sendMouseToElement({ type: 'click', element });
221223
await visualDiff(div, 'pointer-focus-ring-enabled');
222224
});
223225

packages/time-picker/test/visual/lumo/time-picker.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sendKeys, sendMouse } from '@vaadin/test-runner-commands';
1+
import { resetMouse, sendKeys, sendMouseToElement } from '@vaadin/test-runner-commands';
22
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
33
import { visualDiff } from '@web/test-runner-visual-regression';
44
import '../common.js';
@@ -100,21 +100,23 @@ describe('time-picker', () => {
100100
element.autoOpenDisabled = true;
101101
});
102102

103+
afterEach(async () => {
104+
await resetMouse();
105+
});
106+
103107
it('keyboard focus-ring', async () => {
104108
await sendKeys({ press: 'Tab' });
105109
await visualDiff(div, 'keyboard-focus-ring');
106110
});
107111

108112
it('pointer focus-ring disabled', async () => {
109-
const bounds = element.getBoundingClientRect();
110-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
113+
await sendMouseToElement({ type: 'click', element });
111114
await visualDiff(div, 'pointer-focus-ring-disabled');
112115
});
113116

114117
it('pointer focus-ring enabled', async () => {
115118
element.style.setProperty('--lumo-input-field-pointer-focus-visible', '1');
116-
const bounds = element.getBoundingClientRect();
117-
await sendMouse({ type: 'click', position: [bounds.left + 5, bounds.top + 5] });
119+
await sendMouseToElement({ type: 'click', element });
118120
await visualDiff(div, 'pointer-focus-ring-enabled');
119121
});
120122
});

scripts/mergeLitTests.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)