@@ -82,6 +82,44 @@ describe('directive', function () {
82
82
expect ( headerRow . eq ( 3 ) . attr ( 'data-title' ) ) . toBeUndefined ( ) ;
83
83
} ) ;
84
84
85
+ it ( 'supports <th> as first column of each <tr>' , function ( ) {
86
+ var markup = [
87
+ '<table wt-responsive-table>' ,
88
+ ' <tr>' ,
89
+ ' <th>First title</th>' ,
90
+ ' <td>First column</td>' ,
91
+ ' </tr>' ,
92
+ ' <tr>' ,
93
+ ' <th>Second title</th>' ,
94
+ ' <td>Second column</td>' ,
95
+ ' </tr>' ,
96
+ ' <tr>' ,
97
+ ' <th>Third title</th>' ,
98
+ ' <td>Third column</td>' ,
99
+ ' </tr>' ,
100
+ ' <tr>' ,
101
+ ' <th>Forth title</th>' ,
102
+ ' <td>Forth column</td>' ,
103
+ ' </tr>' ,
104
+ '</table>'
105
+ ] . join ( '' ) ;
106
+ var element = angular . element ( markup ) ;
107
+ document . body . appendChild ( element [ 0 ] ) ;
108
+ $compile ( element ) ;
109
+
110
+ var firstDataRow = element . find ( 'tr td' ) ;
111
+ expect ( firstDataRow . eq ( 0 ) . attr ( 'data-title' ) ) . toBe ( 'First title' ) ;
112
+ expect ( firstDataRow . eq ( 1 ) . attr ( 'data-title' ) ) . toBe ( 'Second title' ) ;
113
+ expect ( firstDataRow . eq ( 2 ) . attr ( 'data-title' ) ) . toBe ( 'Third title' ) ;
114
+ expect ( firstDataRow . eq ( 3 ) . attr ( 'data-title' ) ) . toBe ( 'Forth title' ) ;
115
+
116
+ var headerRow = element . find ( 'tr th' ) ;
117
+ expect ( headerRow . eq ( 0 ) . attr ( 'data-title' ) ) . toBeUndefined ( ) ;
118
+ expect ( headerRow . eq ( 1 ) . attr ( 'data-title' ) ) . toBeUndefined ( ) ;
119
+ expect ( headerRow . eq ( 2 ) . attr ( 'data-title' ) ) . toBeUndefined ( ) ;
120
+ expect ( headerRow . eq ( 3 ) . attr ( 'data-title' ) ) . toBeUndefined ( ) ;
121
+ } ) ;
122
+
85
123
it ( 'supports colspan' , function ( ) {
86
124
var markup = [
87
125
'<table wt-responsive-table>' ,
0 commit comments