Skip to content

Commit a7d2733

Browse files
authored
test: add missing test for value warning (#2360)
1 parent 835ca67 commit a7d2733

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

‎packages/field-base/test/input-field-mixin.test.js‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,28 @@ describe('input-field-mixin', () => {
167167
describe('slotted input value', () => {
168168
beforeEach(() => {
169169
sinon.stub(console, 'warn');
170+
element = document.createElement('input-field-mixin-element');
170171
});
171172

172173
afterEach(() => {
174+
document.body.removeChild(element);
173175
console.warn.restore();
174176
});
175177

176178
it('should warn when value is set on the slotted input', () => {
177-
element = fixtureSync(`
178-
<input-field-mixin-element>
179-
<input slot="input" value="foo">
180-
</input-field-mixin-element>
181-
`);
179+
input = document.createElement('input');
180+
input.setAttribute('slot', 'input');
181+
input.value = 'foo';
182+
element.appendChild(input);
183+
document.body.appendChild(element);
182184
expect(console.warn.called).to.be.true;
183185
});
186+
187+
it('should not warn when value is set on the element itself', () => {
188+
element.value = 'foo';
189+
document.body.appendChild(element);
190+
expect(console.warn.called).to.be.false;
191+
});
184192
});
185193

186194
describe('invalid', () => {

0 commit comments

Comments
 (0)