无法触发点击 prime ng 时间日历

cannot trigger click on prime ng time calendar

我有一个带有 prime ng 日历的 angular 应用程序。 下面是我的示例代码:

<p-calendar [(ngModel)]="myDate" [inline]="true" [timeOnly]="true"></p-calendar>

这是从第一个 ng 开始的修改后的 stackblitz:

stackblitz

出于测试目的,我想通过强制点击人字形 up/down 图标以编程方式更改时间,例如使用柏树命令:

cy.get('.pi-chevron-up').first().click();

不幸的是,我无法使用 jquery 函数实现触发器(请参阅随附的 stackblitz)。

有人可以帮忙吗?

对我来说没问题,这是我的测试

it('increments the counter via chevron click', () => {

  cy.visit('http://localhost:4200')

  let initial, next;

  cy.get('.pi-chevron-up')
    .first()
    .parent()
    .next('span')
    .then($el => initial = +$el.text())

  cy.wrap([1,2,3]).each(() => {   // do it 3 times

    cy.get('.pi-chevron-up')
      .first()
      .click()

    cy.get('.pi-chevron-up')
      .first()
      .parent()
      .next('span')
      .then($el => next = +$el.text())
      .then(() => {
        expect(next).to.eq(initial + 1)
        initial = next
      })
  })

})