Skip to content

Commit 6144919

Browse files
authored
refactor!: remove deprecated default slot support (#5003)
1 parent bbbbae3 commit 6144919

3 files changed

Lines changed: 1 addition & 52 deletions

File tree

‎packages/radio-group/src/vaadin-radio-button.js‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.
1212
import { InputController } from '@vaadin/field-base/src/input-controller.js';
1313
import { LabelMixin } from '@vaadin/field-base/src/label-mixin.js';
1414
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
15-
import { SlotTargetController } from '@vaadin/field-base/src/slot-target-controller.js';
1615
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
1716

1817
/**
@@ -111,10 +110,6 @@ class RadioButton extends LabelMixin(
111110
</div>
112111
113112
<slot name="label"></slot>
114-
115-
<div style="display: none !important">
116-
<slot id="noop"></slot>
117-
</div>
118113
</div>
119114
`;
120115
}
@@ -161,21 +156,6 @@ class RadioButton extends LabelMixin(
161156
}),
162157
);
163158
this.addController(new LabelledInputController(this.inputElement, this._labelController));
164-
this.addController(
165-
new SlotTargetController(
166-
this.$.noop,
167-
() => this._labelController.node,
168-
() => this.__warnDeprecated(),
169-
),
170-
);
171-
}
172-
173-
/** @private */
174-
__warnDeprecated() {
175-
console.warn(
176-
`WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-radio-button> is deprecated.
177-
Please use <label slot="label"> wrapper or the label property instead.`,
178-
);
179159
}
180160
}
181161

‎packages/radio-group/test/dom/__snapshots__/radio-button.test.snap.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ snapshots["vaadin-radio-button shadow default"] =
6161
</div>
6262
<slot name="label">
6363
</slot>
64-
<div style="display: none !important">
65-
<slot id="noop">
66-
</slot>
67-
</div>
6864
</div>
6965
`;
7066
/* end snapshot vaadin-radio-button shadow default */

‎packages/radio-group/test/radio-button.test.js‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -250,40 +250,13 @@ describe('radio-button', () => {
250250
expect(radio.hasAttribute('has-label')).to.be.false;
251251
});
252252

253-
it('should not set has-label attribute when only one empty text node added', async () => {
254-
const textNode = document.createTextNode(' ');
255-
radio.appendChild(textNode);
256-
await nextFrame();
257-
expect(radio.hasAttribute('has-label')).to.be.false;
258-
});
259-
260253
it('should set has-label attribute when the label is added', async () => {
261254
const paragraph = document.createElement('p');
262255
paragraph.textContent = 'Added label';
256+
paragraph.setAttribute('slot', 'label');
263257
radio.appendChild(paragraph);
264258
await nextFrame();
265259
expect(radio.hasAttribute('has-label')).to.be.true;
266260
});
267261
});
268-
269-
describe('warnings', () => {
270-
beforeEach(() => {
271-
sinon.stub(console, 'warn');
272-
});
273-
274-
afterEach(() => {
275-
console.warn.restore();
276-
});
277-
278-
it('should warn about using default slot label', async () => {
279-
fixtureSync('<vaadin-radio-button>label</vaadin-radio-button>');
280-
// Wait for MutationObserver
281-
await nextFrame();
282-
283-
expect(console.warn.calledOnce).to.be.true;
284-
expect(console.warn.args[0][0]).to.include(
285-
'WARNING: Since Vaadin 22, placing the label as a direct child of a <vaadin-radio-button> is deprecated.',
286-
);
287-
});
288-
});
289262
});

0 commit comments

Comments
 (0)