Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Adjust some components #9

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 1 addition & 2 deletions example/cypress/e2e/button.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ describe('Button', () => {
cy.get('@primaryButton').find('span[class*=_label]');

// disabled buttons not emit click
cy.get('@disabledButton').click({ force: true });
cy.get('@disabledButton').dblclick({ force: true });
cy.get('@disabledButton').should('be.disabled');
cy.get('@disabledButton').contains('0');
});
});
4 changes: 2 additions & 2 deletions example/cypress/e2e/data-table.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('DataTable', () => {
.should('not.exist');

cy.get('@columnsDefined')
.find('table tbody td[class*=_align__left_]')
.find('table tbody td[class*=_align__start_]')
.contains('1')
.should('exist');

Expand All @@ -42,7 +42,7 @@ describe('DataTable', () => {
.should('exist');

cy.get('@columnsNotDefined')
.find('table tbody td[class*=_align__left_]')
.find('table tbody td[class*=_align__start_]')
.contains('1')
.should('exist');
});
Expand Down
18 changes: 12 additions & 6 deletions example/cypress/e2e/overlays/tooltip.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@ describe('Tooltip', () => {

cy.get('div[data-cy=tooltip-0]').as('defaultTooltip');

cy.get('@defaultTooltip').find('div[class*=_trigger_]');
cy.get('@defaultTooltip').find('div[class*=_activator_]');
cy.get('@defaultTooltip').trigger('mouseover');
cy.get('@defaultTooltip').find('div[role=tooltip]');
cy.get('@defaultTooltip').trigger('mouseleave');
cy.get('@defaultTooltip').find('div[role=tooltip]').should('not.exist');
cy.get('@defaultTooltip')
.find('div[role=tooltip-content]')
.should('not.exist');
});

it('checks for and trigger arrow tooltip', () => {
cy.get('div[data-cy=tooltip-4]').as('tooltipWithArrow');

cy.get('@tooltipWithArrow').find('div[class*=_trigger_]');
cy.get('@tooltipWithArrow').find('div[class*=_activator_]');
cy.get('@tooltipWithArrow').trigger('mouseover');
cy.get('@tooltipWithArrow').find('div[role=tooltip]');
cy.get('@tooltipWithArrow').find('span[data-popper-arrow]');
cy.get('@tooltipWithArrow').trigger('mouseleave');
cy.get('@tooltipWithArrow').find('div[role=tooltip]').should('not.exist');
cy.get('@tooltipWithArrow')
.find('div[role=tooltip-content]')
.should('not.exist');
cy.get('@tooltipWithArrow')
.find('span[data-popper-arrow]')
.should('not.exist');
Expand All @@ -34,8 +38,10 @@ describe('Tooltip', () => {
it('disabled should not trigger tooltip', () => {
cy.get('div[data-cy=tooltip-8]').as('disabledTooltip');

cy.get('@disabledTooltip').find('div[class*=_trigger_]');
cy.get('@disabledTooltip').find('div[class*=_activator_]');
cy.get('@disabledTooltip').trigger('mouseover');
cy.get('@disabledTooltip').find('div[role=tooltip]').should('not.exist');
cy.get('@disabledTooltip')
.find('div[role=tooltip-content]')
.should('not.exist');
});
});
6 changes: 3 additions & 3 deletions example/src/components/AppFootNav.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import { computed, toRefs, useCssModule } from 'vue';
import { get } from '@vueuse/shared';
import { useRoute } from 'vue-router/composables';
import { type SideNavLink } from '@/types';
import router from '@/router';

const props = defineProps<{
navigation: Array<{
Expand All @@ -11,15 +11,15 @@ const props = defineProps<{
}>;
}>();

const route = computed(() => router.currentRoute);
const route = useRoute();
const css = useCssModule();

const { navigation } = toRefs(props);
const links = computed(() =>
get(navigation).flatMap((section) => section.links),
);
const currentPage = computed(() =>
get(links).find((link) => link.to.name === route.value.name),
get(links).find((link) => link.to.name === route.name),
);
const currentPageIndex = computed(() => {
const current = get(currentPage);
Expand Down
6 changes: 3 additions & 3 deletions example/src/components/AppSideNav.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed, useCssModule } from 'vue';
import { useCssModule } from 'vue';
import { useRoute } from 'vue-router/composables';
import { type SideNavLink } from '@/types';
import router from '@/router';

defineProps<{
navigation: Array<{
Expand All @@ -10,7 +10,7 @@ defineProps<{
}>;
}>();

const route = computed(() => router.currentRoute);
const route = useRoute();
const css = useCssModule();
</script>

Expand Down
1 change: 1 addition & 0 deletions example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const pinia = createPinia();
setActivePinia(pinia);

new Vue({
// @ts-ignore
pinia,
router,
render: (h) => h(App),
Expand Down
35 changes: 35 additions & 0 deletions example/src/views/CardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,41 @@ const sections = ref<
divide: true,
dense: true,
},
{
content: 'Lorem ipsum dolor sit amet consect '.repeat(4),
header: 'Card with small border radius',
subheader: 'Card subheader',
variant: 'outlined',
prepend: 'OP',
rounded: 'sm',
},
{
content: 'Lorem ipsum dolor sit amet consect '.repeat(4),
header: 'Divided Card with large border radius',
subheader: 'Card subheader',
variant: 'outlined',
prepend: 'OP',
rounded: 'lg',
divide: true,
},
{
content: 'Lorem ipsum dolor sit amet consect '.repeat(4),
header: 'Card with image and small border radius',
subheader: 'Card subheader',
variant: 'outlined',
prepend: 'OP',
rounded: 'sm',
image: 'https://placehold.co/480x160',
},
{
content: 'Lorem ipsum dolor sit amet consect '.repeat(4),
header: 'Card with image and large border radius',
subheader: 'Card subheader',
variant: 'outlined',
prepend: 'OP',
rounded: 'lg',
image: 'https://placehold.co/480x160',
},
],
},
]);
Expand Down
2 changes: 1 addition & 1 deletion example/src/views/CheckboxView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const checkboxes = ref([
v-for="(checkbox, i) in checkboxes"
:key="i"
v-model="checkbox.value"
:indeterminate="checkbox.indeterminate"
v-bind="checkbox"
@update:indeterminate="checkbox.indeterminate = $event"
>
<span class="capitalize"> {{ checkbox.color }} </span>
</RuiCheckbox>
Expand Down
13 changes: 8 additions & 5 deletions example/src/views/DataTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ const columns: DataTableColumn[] = [
key: 'name',
label: 'Full name',
sortable: true,
align: 'start',
},
{
key: 'username',
label: 'Username',
sortable: true,
align: 'center',
},
{
key: 'email',
label: 'Email address',
sortable: true,
align: 'end',
},
{
key: 'address.street',
Expand All @@ -82,7 +85,7 @@ const columns: DataTableColumn[] = [
{
key: 'phone',
label: 'Phone',
align: 'right',
align: 'end',
},
{
key: 'action',
Expand Down Expand Up @@ -125,7 +128,7 @@ const fixedColumns: DataTableColumn[] = [
{
key: 'phone',
label: 'Phone',
align: 'right',
align: 'end',
},
{
key: 'action',
Expand Down Expand Up @@ -624,7 +627,7 @@ onBeforeMount(() => {
@update:pagination="table.pagination = $event"
@update:sort="table.sort = $event"
>
<template #action-data>
<template #item.action>
<RuiButton icon variant="text" size="sm">
<RuiIcon name="more-fill" color="primary" />
</RuiButton>
Expand Down Expand Up @@ -672,7 +675,7 @@ onBeforeMount(() => {
@update:pagination="table.pagination = $event"
@update:sort="table.sort = $event"
>
<template #action-data>
<template #item.action>
<RuiButton icon variant="text" size="sm">
<RuiIcon name="more-fill" color="primary" />
</RuiButton>
Expand Down Expand Up @@ -716,7 +719,7 @@ onBeforeMount(() => {
@update:pagination="table.pagination = $event"
@update:sort="table.sort = $event"
>
<template #action-data>
<template #item.action>
<RuiButton icon variant="text" size="sm">
<RuiIcon name="more-fill" color="primary" />
</RuiButton>
Expand Down
7 changes: 6 additions & 1 deletion example/src/views/RadioView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ const radioGroups = ref([
<div>
<h2 class="text-h4 mb-6" data-cy="radio-buttons">Radio Buttons</h2>
<div class="grid gap-4 grid-cols-6 mb-14" data-cy="radio-wrapper">
<RuiRadio v-for="(radio, j) in radios" :key="j" v-bind="radio">
<RuiRadio
v-for="(radio, j) in radios"
:key="j"
v-model="radio.value"
v-bind="radio"
>
<span v-if="radio.label" class="capitalize"> {{ radio.label }} </span>
</RuiRadio>
</div>
Expand Down
Loading
Loading