File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,15 @@ export class MdLineSetter {
3030 this . _resetClasses ( ) ;
3131 if ( count === 2 || count === 3 ) {
3232 this . _setClass ( `md-${ count } -line` , true ) ;
33+ } else if ( count > 3 ) {
34+ this . _setClass ( `md-multi-line` , true ) ;
3335 }
3436 }
3537
3638 private _resetClasses ( ) : void {
3739 this . _setClass ( 'md-2-line' , false ) ;
3840 this . _setClass ( 'md-3-line' , false ) ;
41+ this . _setClass ( 'md-multi-line' , false ) ;
3942 }
4043
4144 private _setClass ( className : string , bool : boolean ) : void {
Original file line number Diff line number Diff line change @@ -50,10 +50,18 @@ $md-dense-three-line-height: 76px;
5050 height : $two-line-height ;
5151 }
5252
53+
5354 & .md-3-line .md-list-item {
5455 height : $three-line-height ;
5556 }
5657
58+ // list items with more than 3 lines should expand to match
59+ // the height of its contained text
60+ & .md-multi-line .md-list-item {
61+ height : 100% ;
62+ padding : 8px $md-list-side-padding ;
63+ }
64+
5765 .md-list-text {
5866 @include md-line-wrapper-base ();
5967 padding : 0 $md-list-side-padding ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ describe('MdList', () => {
1818 ListWithItemWithCssClass ,
1919 ListWithDynamicNumberOfLines ,
2020 ListWithMultipleItems ,
21+ ListWithManyLines ,
2122 ] ,
2223 } ) ;
2324
@@ -65,6 +66,15 @@ describe('MdList', () => {
6566 expect ( listItems [ 1 ] . nativeElement . className ) . toBe ( 'md-3-line' ) ;
6667 } ) ;
6768
69+ it ( 'should apply md-multi-line class to lists with more than 3 lines' , ( ) => {
70+ let fixture = TestBed . createComponent ( ListWithManyLines ) ;
71+ fixture . detectChanges ( ) ;
72+
73+ let listItems = fixture . debugElement . children [ 0 ] . queryAll ( By . css ( 'md-list-item' ) ) ;
74+ expect ( listItems [ 0 ] . nativeElement . className ) . toBe ( 'md-multi-line' ) ;
75+ expect ( listItems [ 1 ] . nativeElement . className ) . toBe ( 'md-multi-line' ) ;
76+ } ) ;
77+
6878 it ( 'should apply md-list-avatar class to list items with avatars' , ( ) => {
6979 let fixture = TestBed . createComponent ( ListWithAvatar ) ;
7080 fixture . detectChanges ( ) ;
@@ -152,6 +162,17 @@ class ListWithTwoLineItem extends BaseTestList { }
152162 </md-list>` } )
153163class ListWithThreeLineItem extends BaseTestList { }
154164
165+ @Component ( { template : `
166+ <md-list>
167+ <md-list-item *ngFor="let item of items">
168+ <h3 md-line>Line 1</h3>
169+ <p md-line>Line 2</p>
170+ <p md-line>Line 3</p>
171+ <p md-line>Line 4</p>
172+ </md-list-item>
173+ </md-list>` } )
174+ class ListWithManyLines extends BaseTestList { }
175+
155176@Component ( { template : `
156177 <md-list>
157178 <md-list-item>
You can’t perform that action at this time.
0 commit comments