This file contains 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
import { App } from './app'; | |
customElements.define('yag-app', App); | |
describe('app', () => { | |
let app: App; | |
beforeEach(() => { | |
app = document.createElement('yag-app') as App; | |
document.body.appendChild(app); | |
}); |
This file contains 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
<!doctype html> | |
<html lang="en" class="vvd-root"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="/src/styles.css" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Tauri App</title> | |
<script type="module" src="/src/main.ts" defer></script> | |
<style> | |
.logo.vite:hover { |
This file contains 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
import './main'; | |
describe('main', () => { | |
it ('should define yag-greeter', () => { | |
expect(customElements.get('yag-greeter')).toBeDefined(); | |
}); | |
}); | |
This file contains 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
beforeEach(() => { | |
greeter = document.createElement('yag-greeter'); | |
document.body.appendChild(greeter); | |
}); | |
afterEach(() => { | |
greeter.remove(); | |
}); |
This file contains 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
import '@vonage/vivid/button'; | |
import '@vonage/vivid/text-field'; | |
export const template = ` | |
<form class="row" id="greet-form" name="greet-form"> | |
<vwc-text-field id="greet-input" | |
placeholder="Enter a name..."></vwc-text-field> | |
<vwc-button type="submit" | |
label="Greet" | |
appearance="outlined"></vwc-button> |
This file contains 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
<html lang="en" class="vvd-root"> |
This file contains 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
export const template = ` | |
<style> | |
input, | |
button { | |
border-radius: 8px; | |
border: 1px solid transparent; | |
padding: 0.6em 1.2em; | |
font-size: 1em; | |
font-weight: 500; | |
font-family: inherit; |
This file contains 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
this.shadowRoot?.querySelector('#greet-form')?.addEventListener('submit', async (e) => { | |
e.preventDefault(); | |
const greetInputEl = this.shadowRoot?.querySelector('#greet-input') as HTMLInputElement; | |
const greetMsgEl = this.shadowRoot?.querySelector('#greet-msg') as HTMLElement; | |
greetMsgEl.textContent = await invoke('greet', { | |
name: greetInputEl.value, | |
}); | |
}); |
This file contains 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 set the greeting message inside the message element', async () => { | |
const greeter = document.createElement('yag-greeter'); | |
const name = 'John Doe'; | |
const greetForm = greeter.shadowRoot?.querySelector('#greet-form') as HTMLFormElement; | |
const greetInput = greeter.shadowRoot?.querySelector('#greet-input') as HTMLInputElement; | |
const greetMsgEl = greeter.shadowRoot?.querySelector('#greet-msg') as HTMLElement; | |
greetInput.value = name; | |
mockIPC((cmd, args) => { |
This file contains 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
import { mockIPC } from '@tauri-apps/api/mocks'; | |
import { Greeter } from './index'; | |
describe('greeter', () => { | |
let greeter: Greeter; | |
beforeAll(() => { | |
customElements.define('yag-greeter', Greeter); | |
}); |