Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/routes/(auth)/billing/create/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</div>

<div class="field">
<label for="input-tax_name">Name</label>
<label for="input-tax_name">{form.type === 'company' ? 'Company Name' : 'Name'}</label>
<div class="input">
<input id="input-tax_name" bind:value={form.taxName} required>
</div>
Expand Down
25 changes: 25 additions & 0 deletions tests/billing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,31 @@ test.describe('billing accounts', () => {
const main = page.locator('.content-wrapper')
await expect(main.getByText(/don't have access to any billing accounts/)).toBeVisible()
})

test('create form labels tax name as Company Name when entity type is company', async ({ page }) => {
await page.goto('/billing/create')

const main = page.locator('.content-wrapper')
const taxNameLabel = main.locator('label[for="input-tax_name"]')
await expect(taxNameLabel).toHaveText('Name')

await main.locator('#input-type').selectOption('company')
await expect(taxNameLabel).toHaveText('Company Name')

await main.locator('#input-type').selectOption('individual')
await expect(taxNameLabel).toHaveText('Name')
})

test('update form labels tax name as Company Name for a company account', async ({ page }) => {
await setMocks({
'billing.get': { ok: true, result: sampleBillingAccount } // type: company
})

await page.goto('/billing/create?id=ba-1')

const main = page.locator('.content-wrapper')
await expect(main.locator('label[for="input-tax_name"]')).toHaveText('Company Name')
})
})

test.describe('invoice detail', () => {
Expand Down
Loading