Skip to content

Commit

Permalink
Don't flex-grow the input-field part of a text-field
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Jan 14, 2019
1 parent 090aa2f commit 34b65aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vaadin-text-field-mixin.html
Expand Up @@ -46,6 +46,10 @@
flex: auto;
}

.vaadin-text-field-container [part="input-field"] {
flex-grow: 0;
}

/* Reset the native input styles */
[part="value"],
[part="input-field"] ::slotted(input),
Expand Down
27 changes: 27 additions & 0 deletions test/text-field.html
Expand Up @@ -19,6 +19,14 @@
</template>
</test-fixture>

<test-fixture id="wrapped">
<template>
<div>
<vaadin-text-field></vaadin-text-field>
</div>
</template>
</test-fixture>

<test-fixture id="default-with-slotted-input">
<template>
<vaadin-text-field>
Expand All @@ -28,6 +36,25 @@
</test-fixture>

<script>

describe('Wrapped', () => {
var wrapper, textField, inputField;

beforeEach(() => {
wrapper = fixture('wrapped');
textField = wrapper.firstElementChild;
inputField = textField.shadowRoot.querySelector('[part=input-field]');
});

it('should not grow the input field inside a flex container', () => {
const fieldHeight = inputField.clientHeight;
wrapper.style.display = 'flex';
wrapper.style.height = '100px';
expect(inputField.clientHeight).to.equal(fieldHeight);
});

});

['', 'with slotted input'].forEach(condition => {
let fixtureName = '';
if (condition !== '') {
Expand Down

0 comments on commit 34b65aa

Please sign in to comment.