Skip to content

Commit

Permalink
fix(autosize): export md-autosize directive
Browse files Browse the repository at this point in the history
Closes #2419
  • Loading branch information
devversion committed Dec 27, 2016
1 parent 026c70a commit 24cdad7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib/input/autosize.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MdInputModule} from './input';
Expand Down Expand Up @@ -97,6 +97,12 @@ describe('MdTextareaAutosize', () => {
expect(parseInt(textarea.style.maxHeight))
.toBeGreaterThan(previousMaxHeight, 'Expected increased max-height with maxRows increase.');
});

it('should export the mdAutosize reference', () => {
expect(fixture.componentInstance.autosize).toBeTruthy();
expect(fixture.componentInstance.autosize.resizeToFitContent).toBeTruthy();
});

});


Expand All @@ -109,10 +115,14 @@ const textareaStyleReset = `
}`;

@Component({
template: `<textarea md-autosize [minRows]="minRows" [maxRows]="maxRows">{{content}}</textarea>`,
template: `
<textarea md-autosize [minRows]="minRows" [maxRows]="maxRows" #autosize="mdAutosize">
{{content}}
</textarea>`,
styles: [textareaStyleReset],
})
class AutosizeTextAreaWithContent {
@ViewChild('autosize') autosize: MdTextareaAutosize;
minRows: number = null;
maxRows: number = null;
content: string = '';
Expand Down
1 change: 1 addition & 0 deletions src/lib/input/autosize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Directive, ElementRef, Input, OnInit} from '@angular/core';
*/
@Directive({
selector: 'textarea[md-autosize], textarea[mat-autosize]',
exportAs: 'mdAutosize',
host: {
'(input)': 'resizeToFitContent()',
'[style.min-height]': '_minHeight',
Expand Down

0 comments on commit 24cdad7

Please sign in to comment.