Skip to content

Commit

Permalink
fix(module:input): do not set box-sizing when measuring
Browse files Browse the repository at this point in the history
  • Loading branch information
stingshen committed Jan 19, 2022
1 parent 69c6258 commit e03d9c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 6 additions & 8 deletions components/input/autosize.spec.ts
Expand Up @@ -8,7 +8,7 @@ import { dispatchFakeEvent, MockNgZone } from 'ng-zorro-antd/core/testing';
import { NzAutosizeDirective } from './autosize.directive';
import { NzInputModule } from './input.module';

describe('autoresize', () => {
fdescribe('autoresize', () => {
let zone: MockNgZone;

beforeEach(
Expand Down Expand Up @@ -215,33 +215,32 @@ describe('autoresize', () => {
});

@Component({
template: ` <textarea nz-input nzAutosize [ngModel]="value"></textarea> `,
template: ` <textarea nz-input nzAutosize [ngModel]="value" [hidden]="hidden"></textarea> `,
encapsulation: ViewEncapsulation.None,
styles: [
`
textarea.cdk-textarea-autosize-measuring {
textarea.nz-textarea-autosize-measuring {
height: auto !important;
overflow: hidden !important;
padding: 2px 0 !important;
box-sizing: content-box !important;
}
`
]
})
export class NzTestInputWithTextAreaAutoSizeStringComponent {
value = '';
hidden = false;
}

@Component({
template: ` <textarea nz-input ngModel [nzAutosize]="{ minRows: minRows, maxRows: maxRows }"></textarea> `,
encapsulation: ViewEncapsulation.None,
styles: [
`
textarea.cdk-textarea-autosize-measuring {
textarea.nz-textarea-autosize-measuring {
height: auto !important;
overflow: hidden !important;
padding: 2px 0 !important;
box-sizing: content-box !important;
}
`
]
Expand All @@ -256,11 +255,10 @@ export class NzTestInputWithTextAreaAutoSizeObjectComponent {
encapsulation: ViewEncapsulation.None,
styles: [
`
textarea.cdk-textarea-autosize-measuring {
textarea.nz-textarea-autosize-measuring {
height: auto !important;
overflow: hidden !important;
padding: 2px 0 !important;
box-sizing: content-box !important;
}
`
]
Expand Down
1 change: 0 additions & 1 deletion components/input/style/patch.less
Expand Up @@ -4,7 +4,6 @@ textarea.nz-textarea-autosize-measuring {
// Having 2px top and bottom padding seems to fix a bug where Chrome gets an incorrect
// measurement. We just have to account for it later and subtract it off the final result.
padding: 2px 0 !important;
box-sizing: content-box !important;
}

.@{search-prefix} {
Expand Down

0 comments on commit e03d9c0

Please sign in to comment.