Skip to content

Commit c1b4545

Browse files
authored
fix: update fixed storyblok-js (#795)
1 parent 40a5d06 commit c1b4545

File tree

9 files changed

+39
-62
lines changed

9 files changed

+39
-62
lines changed

cypress/components/index.cy.ts

+13-39
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('@storyblok/vue', () => {
3232
beforeEach(() => {
3333
cy.spy(window.console, 'log').as('log');
3434
cy.spy(window.console, 'error').as('error');
35-
delete window.storyblokRegisterEvent;
35+
delete (window as any).storyblokRegisterEvent;
3636
document.getElementById('storyblok-javascript-bridge')?.remove();
3737
});
3838

@@ -206,51 +206,28 @@ describe('@storyblok/vue', () => {
206206
components: { Teaser, Grid, Page, Feature },
207207
});
208208

209-
cy.get('[data-test=root]')
210-
.children()
211-
.find('h1')
212-
.should('have.text', 'Headline 1');
209+
cy.contains('h1', 'Headline 1', { timeout: 1000 });
213210
});
214211

215212
it('Should render headline tags correctly', () => {
216213
prepare({ use: [apiPlugin] }, RichText, {
217214
components: { Teaser, Grid, Page, Feature },
218215
});
219216

220-
cy.get('[data-test=root]')
221-
.children()
222-
.find('h1')
223-
.should('have.text', 'Headline 1');
224-
cy.get('[data-test=root]')
225-
.children()
226-
.find('h2')
227-
.should('have.text', 'Headline 2');
228-
cy.get('[data-test=root]')
229-
.children()
230-
.find('h3')
231-
.should('have.text', 'Headline 3');
232-
cy.get('[data-test=root]')
233-
.children()
234-
.find('h4')
235-
.should('have.text', 'Headline 4');
236-
cy.get('[data-test=root]')
237-
.children()
238-
.find('h5')
239-
.should('have.text', 'Headline 5');
240-
cy.get('[data-test=root]')
241-
.children()
242-
.find('h6')
243-
.should('have.text', 'Headline 6');
217+
cy.contains('h1', 'Headline 1', { timeout: 1000 });
218+
cy.contains('h2', 'Headline 2', { timeout: 1000 });
219+
cy.contains('h3', 'Headline 3', { timeout: 1000 });
220+
cy.contains('h4', 'Headline 4', { timeout: 1000 });
221+
cy.contains('h5', 'Headline 5', { timeout: 1000 });
222+
cy.contains('h6', 'Headline 6', { timeout: 1000 });
244223
});
245224

246225
it('Should render images correctly', () => {
247226
prepare({ use: [apiPlugin] }, RichText, {
248227
components: { Teaser, Grid, Page, Feature },
249228
});
250229

251-
cy.get('[data-test=root]')
252-
.children()
253-
.find('img')
230+
cy.get('img')
254231
.should(
255232
'have.attr',
256233
'src',
@@ -263,9 +240,7 @@ describe('@storyblok/vue', () => {
263240
components: { Teaser, Grid, Page, Feature },
264241
});
265242

266-
cy.get('[data-test=root]')
267-
.children()
268-
.find('a')
243+
cy.get('a')
269244
.should('have.attr', 'href', 'https://storyblok.com/');
270245
});
271246

@@ -274,10 +249,9 @@ describe('@storyblok/vue', () => {
274249
components: { IframeEmbed },
275250
});
276251

277-
cy.get('[data-test=root]')
278-
.children()
279-
.find('iframe')
280-
.should('have.attr', 'src', 'https://storyblok.com/');
252+
cy.get('iframe')
253+
.should('exist')
254+
.and('have.attr', 'src', 'https://storyblok.com/');
281255
});
282256

283257
it('should redirect internal links', () => {

cypress/components/testing-components/Essential.vue

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const blokProd = {
1515
const storyblokApi = useStoryblokApi();
1616
const apiExists = !!(storyblokApi && typeof storyblokApi.get === 'function');
1717
18+
// eslint-disable-next-line no-console
1819
onMounted(() => useStoryblokBridge(12345, () => console.log('hola')));
1920
</script>
2021

cypress/components/testing-components/RichTextChild.vue

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
<script setup lang="ts">
22
import {
3-
useStoryblok,
3+
MarkTypes,
44
StoryblokRichText,
55
type StoryblokRichTextNode,
6-
MarkTypes,
7-
} from "@storyblok/vue";
8-
import { type VNode, h } from "vue";
9-
import { RouterLink } from "vue-router";
10-
const story = await useStoryblok("vue/test-richtext", { version: "draft" });
6+
useStoryblok,
7+
} from '@storyblok/vue';
8+
import { h, type VNode } from 'vue';
9+
import { RouterLink } from 'vue-router';
10+
11+
const story = await useStoryblok('vue/test-richtext', { version: 'draft' });
1112
1213
const resolvers = {
1314
[MarkTypes.LINK]: (node: StoryblokRichTextNode<VNode>) => {
14-
return node.attrs?.linktype === "STORY"
15+
return node.attrs?.linktype === 'STORY'
1516
? h(
1617
RouterLink,
1718
{
1819
to: node.attrs?.href,
1920
target: node.attrs?.target,
2021
},
21-
node.text
22+
node.text,
2223
)
2324
: h(
24-
"a",
25+
'a',
2526
{
2627
href: node.attrs?.href,
2728
target: node.attrs?.target,
2829
},
29-
node.text
30+
node.text,
3031
);
3132
},
3233
};

cypress/support/commands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
3535
// }
3636
// }
37-
// }
37+
// }

cypress/support/component.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable ts/no-namespace */
12
// ***********************************************************
23
// This example support/component.ts is processed and
34
// loaded automatically before your test files.
@@ -19,23 +20,23 @@
1920
// Alternatively you can use CommonJS syntax:
2021
// require('./commands')
2122

22-
import { mount } from "cypress/vue";
23+
import { mount } from 'cypress/vue';
2324

2425
// Augment the Cypress namespace to include type definitions for
2526
// your custom command.
2627
// Alternatively, can be defined in cypress/support/component.d.ts
2728
// with a <reference path="./component" /> at the top of your spec.
2829
declare global {
29-
// eslint-disable-next-line no-unused-vars
30+
3031
namespace Cypress {
31-
// eslint-disable-next-line no-unused-vars
32+
3233
interface Chainable {
3334
mount: typeof mount;
3435
}
3536
}
3637
}
3738

38-
Cypress.Commands.add("mount", mount);
39+
Cypress.Commands.add('mount', mount);
3940

4041
// Example use:
4142
// cy.mount(MyComponent)

cypress/support/e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// ***********************************************************
1515

1616
// Import commands.js using ES2015 syntax:
17-
import "./commands";
17+
import './commands';
1818

1919
// Alternatively you can use CommonJS syntax:
2020
// require('./commands')

eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { storyblokLintConfig } from '@storyblok/eslint-config';
22

33
export default storyblokLintConfig({
4-
ignores: ['**/node_modules/**', 'cypress/', 'README.md'],
4+
ignores: ['**/node_modules/**', 'README.md'],
55
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"vue": ">=3.4"
4747
},
4848
"dependencies": {
49-
"@storyblok/js": "3.1.9"
49+
"@storyblok/js": "3.2.1"
5050
},
5151
"devDependencies": {
5252
"@commitlint/cli": "^19.6.1",

pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)