Skip to content

Commit

Permalink
Try to make tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
benjick committed May 5, 2020
1 parent d476535 commit 25ddb63
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .docker/frontend/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ import { Storyblok } from './vsf-storyblok-module'

import { registerModule } from '@vue-storefront/core/lib/modules'

import { extendMappingFallback } from './vsf-mapping-fallback'
import { forProduct, forCategory, tap } from './vsf-mapping-fallback/builtin'
import { forStoryblok } from './vsf-storyblok-module/mappingFallback'

const extendUrlModule = extendMappingFallback(
tap, forProduct, forCategory, forStoryblok
)

// TODO:distributed across proper pages BEFORE 1.11
export function registerClientModules () {
registerModule(UrlModule)
registerModule(extendUrlModule)
registerModule(CatalogModule)
registerModule(CheckoutModule) // To Checkout
registerModule(CartModule)
Expand Down
2 changes: 1 addition & 1 deletion .docker/vsf-mapping-fallback
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ services:
- './theme/components/storyblok:/var/www/src/themes/default/components/storyblok'
- './theme/head.js:/var/www/src/themes/default/head.js'
- './theme/index.js:/var/www/src/themes/default/index.js'
- './.docker/vsf-mapping-fallback:/var/www/src/modules/vsf-mapping-fallback'
# Module
- './packages/vsf-storyblok-module:/var/www/src/modules/vsf-storyblok-module:delegated'
healthcheck:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'
export default {
name: 'DebugBlok',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'
export default {
extends: Blok,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'
export default {
extends: Blok,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'
export default {
name: 'TileBlok',
Expand Down
8 changes: 4 additions & 4 deletions packages/vsf-storyblok-module/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const components = {
debug: () => import('./Debug.vue'),
page: () => import('./Page.vue'),
grid: () => import('./Grid.vue'),
tile: () => import('./Tile.vue')
debug: () => import('./defaults/Debug.vue'),
page: () => import('./defaults/Page.vue'),
grid: () => import('./defaults/Grid.vue'),
tile: () => import('./defaults/Tile.vue'),
}

export function add (key: string, component: any, options: any = {}) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vsf-storyblok-module/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TaskQueue } from '@vue-storefront/core/lib/sync'
import qs from 'qs'

const fetchStory = async url => {
const { result: { story } }: any = await TaskQueue.execute({
const { result: story }: any = await TaskQueue.execute({
url,
payload: {
headers: { 'Content-Type': 'application/json' },
Expand Down Expand Up @@ -66,7 +66,7 @@ export const actions: ActionTree<StoryblokState, RootState> = {
return cachedStory
}

const url = `${config.storyblok.endpoint}/story/${key}`
const url = `${config.storyblok.endpoint}/story/${key}`.replace(/([^:]\/)\/+/g, "$1")
const story = await fetchStory(url)

commit('setStory', { key, story })
Expand Down
12 changes: 12 additions & 0 deletions theme/components/storyblok/RichText.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<sb-rich-text v-if="item.text" :text="item.text" />
</template>

<script>
import { Blok } from 'src/modules/vsf-storyblok-module/components'
export default {
name: 'RichTextBlok',
extends: Blok
}
</script>
1 change: 1 addition & 0 deletions theme/components/storyblok/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { add } from 'src/modules/vsf-storyblok-module/components'
add('hero', () => import('./Hero.vue'))
add('demoImage', () => import('./Image.vue'))
add('ciLink', () => import('./Link.vue'))
add('RichText', () => import('./RichText.vue'))
// Overwrite an existing component
// add('tile', () => import('./Tile.vue'), { force: true })

0 comments on commit 25ddb63

Please sign in to comment.