Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 29, 2023 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/b2bfcac413148194d04c76a79a0a4634 to your computer and use it in GitHub Desktop.
Save YonatanKra/b2bfcac413148194d04c76a79a0a4634 to your computer and use it in GitHub Desktop.
Tauri-demo: logout button click event logs us out
it('should call `logout` on auth component when logout button is clicked', () => {
isLoggedIn = true;
app.connectedCallback();
getLogoutButton()?.dispatchEvent(new CustomEvent('click'));
expect(authComponent.logout).toHaveBeenCalled();
});
constructor() {
super();
this.attachShadow({mode: 'open'});
this.shadowRoot!.innerHTML = `
<vwc-header>
<h1>Your Awesome Game!</h1> (yag... dah...)
<vwc-button id="login-button" slot="hidden" appearance="filled" connotation="alert" label="Sign out"></vwc-button>
<main slot="app-content">
<vwc-layout gutters="small" id="main-content">
Application content
</vwc-layout>
</main>
</vwc-header>
`;
this.#loginButton.addEventListener('click', () => this.#authComponent?.logout());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment