How to trigger the dialog onOk button ( jest unit test )



  • Hello,

    I am trying to test a component which will need the user to confirm the action.

      methods: {
        click() {
          this.$q
            .dialog({
              title: "Confirm",
              message: "Are you sure to delete this record?",
              cancel: true,
              persistent: true
            })
            .onOk(() => {
              console.log('Deleting');
              // delete action here...
            })
        }
      }
    
        in my test:
        ...
        wrapper.find('.q-btn.delete' ).trigger('click')    // find and click the delete button 
        // what should I do to trigger the "OK" button ?
        // and then expect the console.log('Deleteing')  have been called
    

Log in to reply