@@ -331,8 +331,8 @@ describe('directive', function () {
331331 expect ( styles . paddingLeft ) . toBe ( '50%' ) ;
332332 } ) ;
333333
334- describe ( 'wt- responsive-column ' , function ( ) {
335- it ( 'supports ng-if applied on TD ' , function ( ) {
334+ describe ( 'responsive-dynamic ' , function ( ) {
335+ it ( 'supports ng-if applied on all TDs ' , function ( ) {
336336 var markup = [
337337 '<table wt-responsive-table>' ,
338338 ' <thead>' ,
@@ -360,5 +360,37 @@ describe('directive', function () {
360360 expect ( els . eq ( 0 ) . attr ( 'data-title' ) ) . toBe ( 'column' ) ;
361361 } ) ;
362362
363+ it ( 'supports ng-if applied on some TDs' , function ( ) {
364+ var markup = [
365+ '<table wt-responsive-table>' ,
366+ ' <thead>' ,
367+ ' <tr>' ,
368+ ' <th>column</th>' ,
369+ ' <th>simple</th>' ,
370+ ' </tr>' ,
371+ ' </thead>' ,
372+ ' <tbody>' ,
373+ ' <tr>' ,
374+ ' <td ng-if="!condition" responsive-dynamic>tom</td>' ,
375+ ' <td ng-if="condition" responsive-dynamic>jerry</td>' ,
376+ ' <td>simple</td>' ,
377+ ' </tr>' ,
378+ ' </tbody>' ,
379+ '</table>'
380+ ] . join ( '' ) ;
381+ var element = angular . element ( markup ) ;
382+ var scope = $rootScope . $new ( ) ;
383+ scope . condition = true ;
384+
385+ $compile ( element ) ( scope ) ;
386+ scope . $digest ( ) ;
387+
388+ var els = element . find ( 'tbody tr:first td' ) ;
389+ expect ( els . eq ( 0 ) . text ( ) ) . toBe ( 'jerry' ) ;
390+ expect ( els . eq ( 0 ) . attr ( 'data-title' ) ) . toBe ( 'column' ) ;
391+ expect ( els . eq ( 1 ) . text ( ) ) . toBe ( 'simple' ) ;
392+ expect ( els . eq ( 1 ) . attr ( 'data-title' ) ) . toBe ( 'simple' ) ;
393+ } ) ;
394+
363395 } ) ;
364396} ) ;
0 commit comments