Skip to content

Commit 573aa93

Browse files
Add cypress
1 parent 5989d38 commit 573aa93

File tree

4 files changed

+77
-8
lines changed

4 files changed

+77
-8
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
'vite.config.mts',
1717
'*.bk.vue',
1818
'cypress/**/*',
19+
'**/**/*.cy.ts',
1920
],
2021
overrides: [
2122
{

cypress.config.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { defineConfig } from "cypress";
22

33
export default defineConfig({
4-
component: {
5-
devServer: {
6-
framework: "vue",
7-
bundler: "vite",
8-
},
9-
},
10-
viewportHeight: 768,
11-
viewportWidth: 1024,
4+
component: {
5+
devServer: {
6+
framework: "vue",
7+
bundler: "vite",
8+
},
9+
},
10+
11+
viewportHeight: 768,
12+
viewportWidth: 1024,
13+
14+
e2e: {
15+
setupNodeEvents(on, config) {
16+
// implement node event listeners here
17+
},
18+
},
1219
});

cypress/support/e2e.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

src/plugin/__tests__/VCodeBlock.cy.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { VCodeBlock } from '../index';
2+
import {
3+
mount,
4+
} from 'cypress/vue';
5+
6+
// const errorMessage = '[vue-code-block]: You must set either the prismjs or highlightjs props.';
7+
8+
describe('Highlight.js', () => {
9+
10+
it('should render js', () => {
11+
// see: https://on.cypress.io/mounting-vue
12+
mount(VCodeBlock, {
13+
props: {
14+
code: 'const foo = "bar"\nconsole.log(foo)',
15+
highlightjs: true,
16+
}
17+
});
18+
});
19+
20+
21+
// it('render html', () => {
22+
// mount(VCodeBlock, {
23+
// props: {
24+
// code: `<html>
25+
// <head>
26+
// <title>Document</title>
27+
// </head>
28+
// <body>
29+
// <h1>Hello World</h1>
30+
// </body>
31+
// </html>`,
32+
// highlightjs: true,
33+
// lang: 'html'
34+
// }
35+
// });
36+
// });
37+
38+
});
39+
40+
41+
// const errorMessage = '[vue-code-block]: You must set either the prismjs or highlightjs props.';

0 commit comments

Comments
 (0)