diff --git a/packages/vaadin-checkbox/test/checkbox-group.test.js b/packages/vaadin-checkbox/test/checkbox-group.test.js
index 024edf5c4e..66c3a2a056 100644
--- a/packages/vaadin-checkbox/test/checkbox-group.test.js
+++ b/packages/vaadin-checkbox/test/checkbox-group.test.js
@@ -508,13 +508,12 @@ describe('slot focus', () => {
`);
group._observer.flush();
- group.focus();
helper = group.querySelector('[slot="helper"]');
});
it('should not get focus after click', () => {
+ const spy = sinon.spy(group, 'focus');
helper.click();
-
- expect(group.hasAttribute('focused')).to.be.false;
+ expect(spy.called).to.be.false;
});
});
diff --git a/packages/vaadin-custom-field/test/helper.test.js b/packages/vaadin-custom-field/test/helper.test.js
index 5866f60ea8..4e70781078 100644
--- a/packages/vaadin-custom-field/test/helper.test.js
+++ b/packages/vaadin-custom-field/test/helper.test.js
@@ -110,19 +110,16 @@ describe('helper text', () => {
beforeEach(() => {
field = fixtureSync(`
-
-
-
+
+
`);
helper = field.querySelector('[slot="helper"]');
- field.focus();
});
it('should not focus the field on helper click', () => {
const spy = sinon.spy(field, 'focus');
helper.click();
-
expect(spy.called).to.be.false;
});
});
diff --git a/packages/vaadin-text-field/test/text-area.test.js b/packages/vaadin-text-field/test/text-area.test.js
index 48e40505f3..fd93db9135 100644
--- a/packages/vaadin-text-field/test/text-area.test.js
+++ b/packages/vaadin-text-field/test/text-area.test.js
@@ -348,18 +348,14 @@ describe('helper text', () => {
beforeEach(() => {
field = fixtureSync(`
-
-
-
+
`);
helper = field.querySelector('[slot="helper"]');
- field.focus();
});
it('helper should get focus when clicked', () => {
const spy = sinon.spy(field, 'focus');
-
helper.click();
expect(spy.called).to.be.false;
});
@@ -369,17 +365,14 @@ describe('helper text', () => {
let field, helper;
beforeEach(() => {
- field = fixtureSync(`
-
-
- `);
-
+ field = fixtureSync('');
helper = field.shadowRoot.querySelector('[part="helper-text"]');
});
it('should not get focus when helper text is clicked', () => {
+ const spy = sinon.spy(field, 'focus');
helper.click();
- expect(field.hasAttribute('focused')).to.be.false;
+ expect(spy.called).to.be.false;
});
});
});
diff --git a/packages/vaadin-text-field/test/text-field.test.js b/packages/vaadin-text-field/test/text-field.test.js
index 942a85d2f7..7e9f921330 100644
--- a/packages/vaadin-text-field/test/text-field.test.js
+++ b/packages/vaadin-text-field/test/text-field.test.js
@@ -614,15 +614,13 @@ describe('helper slot', () => {
});
});
- describe('nested helper', () => {
+ describe('slotted helper', () => {
let field, helper;
beforeEach(() => {
field = fixtureSync(`
-
-
-
+
`);
helper = field.querySelector('[slot="helper"]');
@@ -631,7 +629,6 @@ describe('helper slot', () => {
it('helper should get focus when clicked', () => {
const spy = sinon.spy(field, 'focus');
helper.click();
-
expect(spy.called).to.be.false;
});
});
@@ -640,18 +637,13 @@ describe('helper slot', () => {
let field, helper;
beforeEach(() => {
- field = fixtureSync(`
-
-
- `);
-
+ field = fixtureSync('');
helper = field.shadowRoot.querySelector('[part="helper-text"]');
});
it('should not get focus when helper text is only text', () => {
const spy = sinon.spy(field, 'focus');
helper.click();
-
expect(spy.called).to.be.false;
});
});