Skip to content

Commit

Permalink
test: disable autoImport (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Jan 23, 2023
1 parent 1f7d3a2 commit 9923502
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runtime/composables/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { HeadObjectPlain } from '@vueuse/head'
import type { Ref } from 'vue'
import { hasProtocol, joinURL, withTrailingSlash, withoutTrailingSlash } from 'ufo'
import { ParsedContent } from '../types'
import { useRoute, nextTick, useHead, unref, watch, useRuntimeConfig } from '#imports'
import { useRoute, nextTick, useHead, unref, watch, useRuntimeConfig, useRequestEvent } from '#imports'

export const useContentHead = (
_content: ParsedContent | Ref<ParsedContent>,
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/basic/.nuxtrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imports.autoImport=false
4 changes: 3 additions & 1 deletion test/fixtures/basic/pages/features/query-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
</div>
</template>

<script setup>
<script setup lang="ts">
import { queryContent, useRoute, useAsyncData } from '#imports'
const route = useRoute()
const prefix = route.query.prefix === undefined ? '/_partial' : ''
const path = route.query.path || ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</template>

<script setup lang="ts">
import { queryContent, useAsyncData } from '#imports'
const path = '/'
const { data } = await useAsyncData(`content-${path}`, () => queryContent().where({ _path: path, draft: { $ne: true } }).findOne())
</script>
2 changes: 2 additions & 0 deletions test/fixtures/basic/pages/locale-[locale].vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
</template>

<script setup lang="ts">
import { queryContent, useRoute, useAsyncData, computed } from '#imports'
const route = useRoute()
const { data: list } = await useAsyncData(route.path, () => queryContent().locale(route.params.locale).find())
const ids = computed(() => list.value.map(item => item._id).join('\n'))
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/basic/pages/nav-with-query.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { queryContent } from '#imports'
const catsQuery = queryContent('cats')
const numbersQuery = queryContent('numbers')
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/basic/pages/parse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
</template>

<script setup>
import { useRoute, useAsyncData } from '#imports'
const { content } = useRoute().query
const { data } = await useAsyncData(content, async () => {
return await $fetch('/api/parse', {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/document-driven/pages/custom-search.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup>
import { definePageMeta, useContent, useContentHead } from '#imports'
definePageMeta({
documentDriven: {
page: {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/document-driven/pages/disabled.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>

<script setup lang="ts">
import { definePageMeta, useContent } from '#imports'
definePageMeta({
documentDriven: false
})
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/document-driven/pages/home.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup>
import { definePageMeta, useContent, useContentHead } from '#imports'
definePageMeta({
documentDriven: {
page: '/',
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/document-driven/pages/no-surround.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
</template>

<script setup lang="ts">
import { definePageMeta, useContent } from '#imports'
definePageMeta({
documentDriven: {
surround: false
Expand Down

0 comments on commit 9923502

Please sign in to comment.