我无法获取下表中单元格的计数。我想只在表格主体中获取计数。请帮助我实现这一点-我希望得到计数-
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$0.90</td>
请让我知道如何实现这一目标。谢谢!!
<div class="show-for-large-up">
<table>
<thead>
<tr>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<th class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0" ng-bind-html="receiptTemplate.paymentFee" width="300">Payment Fee</th>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
</thead>
<tbody>
<!-- ngRepeat: lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index -->
<tr class="ng-scope" ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index">
<td class="ng-binding">$45.00</td>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$0.90</td>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
<!-- end ngRepeat: lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index -->
<tr class="ng-scope" ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index">
<td class="ng-binding">Jul 21, 2017</td>
<td class="ng-binding">$0.00</td>
<!-- ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
<td class="ng-binding ng-scope" ng-if="paymentDetails.responseObject[0].fee_amount > 0">$1.68</td>
<!-- end ngIf: paymentDetails.responseObject[0].fee_amount > 0 -->
</tr>
</tbody>
</table>
</div>
我试过的 - 但我得到的计数是 3。实际上计数应该是 1
var paymentTable = $$('.show-for-large-up tr');
var row = paymentTable.$$('[ng-repeat="lineItem in paymentDetails.responseObject[0].schedules[0].schedule_line_items track by $index"]');
var cell = row.$$('[ng-if="paymentDetails.responseObject[0].fee_amount > 0"]');
var cellCount = cell.filter(function(elm) {
return elm.count();
expect(elm.count()).toBe(1);
});