-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(directory) add service to cart from service details page (#4543)
feat: add/remove service from service details page
- Loading branch information
1 parent
ac1564a
commit fb363b0
Showing
6 changed files
with
121 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<button type="button" class="btn px-2" :class="buttonClass"> | ||
{{ label }} | ||
</button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
export type TButtonType = "outline" | "full"; | ||
export type TButtonSize = "sm" | "md" | "lg"; | ||
const props = withDefaults( | ||
defineProps<{ | ||
label: string; | ||
type?: TButtonType; | ||
size?: TButtonSize; | ||
}>(), | ||
{ | ||
type: "full", | ||
size: "md", | ||
} | ||
); | ||
const buttonClass = computed(() => { | ||
return `btn-${props.type === "outline" ? "outline-" : ""}secondary btn-${ | ||
props.size | ||
}`; | ||
}); | ||
</script> |
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 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 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 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
19 changes: 19 additions & 0 deletions
19
apps/directory/tests/add-remove-from-service-detail.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { getSchemaName } from './getSchemaName'; | ||
|
||
const schemaName = getSchemaName(); | ||
|
||
test('add/remove service from service detaill page', async ({ page }) => { | ||
await page.goto(`/${schemaName}/directory/`); | ||
await page.getByRole('button', { name: 'Services' }).first().click(); | ||
await page.getByRole('link', { name: 'Biobank Service' }).click(); | ||
await expect(page.locator('h1')).toContainText('Biobank Service'); | ||
await expect(page.getByRole('main')).toContainText('Add'); | ||
await page.getByRole('button', { name: 'Add' }).click(); | ||
// 1 is the number of services added | ||
await expect(page.getByRole('main')).toContainText('1'); | ||
await expect(page.getByRole('main')).toContainText('Remove'); | ||
await page.getByRole('button', { name: 'Remove' }).click(); | ||
// after removing the service, the text should be 'Add' | ||
await expect(page.getByRole('main')).toContainText('Add'); | ||
}); |