inovex / elements

Lovingly crafted ui components based on web components. Works well with all Frameworks - including Angular, React and Vue.
https://elements.inovex.de
MIT License
69 stars 9 forks source link

ino-snackbar: add open property #1319

Closed janivo closed 3 months ago

janivo commented 4 months ago

Context

Currently, managing the visibility of the ino-snackbar component involves manual destruction and rendering of a new snackbar instance. This contrasts with our ino-dialog component, which offers the capability to control visibility using the 'open' property. To enhance consistency and usability across components, we aim to update the ino-snackbar component to include an open property, allowing users to control its visibility programmatically.

Acceptance Criteria

Test Cases

  1. Display Snackbar Test

    • Scenario: User sets the 'open' property to true.
    • Expected Result: The snackbar is displayed to the user.
    • Steps:
      1. Set the 'open' property of the snackbar to true.
      2. Verify that the snackbar is visible on the screen.
  2. Hide Snackbar Test

    • Scenario: User sets the 'open' property to false.
    • Expected Result: The snackbar is hidden from the user.
    • Steps:
      1. Set the 'open' property of the snackbar to false.
      2. Verify that the snackbar is no longer visible on the screen.
  3. Auto-Hide Snackbar Test

    • Scenario: Snackbar auto-hides after a specified timeout.
    • Expected Result: The snackbar hides automatically after the timeout.
    • Steps:
      1. Set the 'open' property of the snackbar to true.
      2. Wait for the specified timeout duration.
      3. Verify that the snackbar is hidden automatically.
  4. Snackbar Hide Event Test

    • Scenario: User interacts with the snackbar to hide it.
    • Expected Result: The snackbar emits a hide event.
    • Steps:
      1. Set the 'open' property of the snackbar to true.
      2. Interact with the snackbar to trigger its hide action (e.g., click on the close button).
      3. Verify that the snackbar emits a hide event.