expect(view.$el.html()).toContain('Admin');
Run Code Online (Sandbox Code Playgroud)
视图确实包含"管理员"这个词,所以我希望它返回true.我怎样才能做到这一点?
expect(view.$el.html()).toContain('Admin');
Run Code Online (Sandbox Code Playgroud)
这回来了undefined.我怎样才能让它回归true?
<header class="main">
<div id="heading">
<ul class="header-view right">
<li class="inline"><a href="#link" class="button help-btn tab-btn"><span> </span>Help</a></li>
<li class="inline last"><a href="#og" class="button admin-btn tab-btn expand-admin"><span></span>Admin</a></li>
</ul>
</div>
</header>
Run Code Online (Sandbox Code Playgroud)
这是从中返回的 view.$el.html
请帮忙.
我一直在尝试仅使用css选择器nth-child和/或nth-last-child中的前四个列表项目
<ul>
<li>Hello first item</li>
<li>Hello item 2<li>
<li>Hello item 3</li>
<li>Hello item 4</li>
<li>Hello item 5</li>
<li>Hello item 6</li>
<li>Hello item 7</li>
<li>Hello item 8</li>
<li>Hello item 9</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我的第一次尝试:
ul li:nth-child(1n):not(:nth-last-child(-n+5)){
font-weight:bold;
}
Run Code Online (Sandbox Code Playgroud)
但我想简化它
所以我的第二个:
ul li:nth-child(-n+4){
font-weight:bold;
}
Run Code Online (Sandbox Code Playgroud)
你能告诉我是否有比第二个更好的解决方案/这是针对第一个(n)孩子的正确方法吗?
我正在尝试在 angular ng-repeat 中使用以下数据进行循环
{
"qid": "173995X306X4091",
"gid": null,
"comments": "Milestone1: Here is the milestone1details",
"owner": "Me",
"targetdate": "28-10-2016"
},
{
"qid": "173995X306X4101",
"gid": null,
"comments": "",
"owner": "",
"targetdate": ""
}
Run Code Online (Sandbox Code Playgroud)
HTML :
<div class="modal-body" ng-repeat="milestone in milestones ">
<table class="table table-striped">
<thead>
<tr>
<th>Milestone </th>
<th>Milestone Owner</th>
<th>Milestone Target date</th>
</tr>
</thead>
<tr>
<td>{{milestone.comments }} </td>
<td>{{milestone.owner }}</td>
<td>{{milestone.targetdate }}</td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
我不希望显示空属性:就像下面的第二个对象
<table class="table table-striped">
<thead>
<tr>
<th>Milestone </th>
<th>Milestone Owner</th>
<th>Milestone Target date</th>
</tr>
</thead> …Run Code Online (Sandbox Code Playgroud)