Created
September 29, 2023 10:29
-
-
Save YonatanKra/b2bfcac413148194d04c76a79a0a4634 to your computer and use it in GitHub Desktop.
Tauri-demo: logout button click event logs us out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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