Skip to content

Commit

Permalink
feat(client): add input for manual test (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-julien authored May 17, 2023
1 parent 5cb0094 commit aeff56b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/components/Route/List/ItemWithParams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<p>Route: <span class="font-bold">{{ routeInfo.route }}</span> -- Hydration failed time : {{ totalFailedTime }} </p>
</template>
<template v-if="routeInfo.paths.length">
<RouteListItemWithParamsItem v-for="path in routeInfo.paths" :key="path.path" class="flex justify-between w-full pl-5" :route="path" />
<RouteListItemWithParamsItem v-for="path in routeInfo.paths" :key="path.path" class="flex justify-between w-full pl-5 my-2" :route="path" />
</template>
<p v-else ml-5>
There's no path available, try to test a page that satisfies {{ routeInfo.route }}
Expand Down
35 changes: 35 additions & 0 deletions client/components/TestingInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div flex gap-2>
<NButton :disabled="isTesting" @click="test">
<span v-if="!isTesting">
Test
</span>
<Icon v-else name="line-md:loading-twotone-loop" />
</NButton>
<NTextInput v-model="text">
<template #icon>
<NButton rounded-xl p-1 @click="reset">
<Icon name="maki:cross-11" />
</NButton>
</template>
</NTextInput>
</div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import useTestHydration from '~/composables/useTestHydration'
const text = ref('')
const { isTesting, testPath } = useTestHydration()
function reset () {
text.value = ''
}
function test () {
const path = text.value.startsWith('/') ? text.value : '/' + text.value
testPath(path)
}
</script>
6 changes: 5 additions & 1 deletion client/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<NavHeader class="mb-3" />
<NavHeader class="mb-3">
<template #prepend>
<TestingInput />
</template>
</NavHeader>
<div class="flex flex-col gap-5">
<div>
<div class="mb-3 text-xl">
Expand Down

0 comments on commit aeff56b

Please sign in to comment.