Navigation

    Quasar Framework

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

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

    Help
    2
    2
    55
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      endielo last edited by endielo

      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
      
      1 Reply Last reply Reply Quote 1
      • D
        DavidGo last edited by

        Same issue. @endielo have you managed to do this?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post