【发布时间】:2023-02-18 19:04:46
【问题描述】:
我有代码
<div class="project" *ngIf="role$ | async">
<button mat-button *ngIf="id !== 5" (click)="doSomething()">DO</button>
</div>
我不确定*ngIf 会调用什么属性? display或visible或disabled?我该如何测试它?
The following is the wrong code, I guess
cy.get('.project').then(($div) => {
if ($div.is(':disabled')) {
cy.log('Div is disabled!')
return
} else {
cy.log('Div is enabled!')
cy.wrap($div).click()
}
})
【问题讨论】:
-
你能运行这个命令并告诉我记录了什么吗?
cy.get('.project').invoke('attr', '*ngIf').then((val) => {cy.log(val)}) -
如果这不起作用,请尝试使用不带星号的
ngIf。 -
似乎
*ngIf可以无误地调用。我可以嘲笑它是真的还是假的? -
记录值是多少?