11import VCodeBlock from '../VCodeBlock.vue' ;
22import { describe , it , expect } from 'vitest' ;
33import { mount } from '@vue/test-utils' ;
4+ import { pluginName } from '../utils/globals' ;
45
56
67describe ( 'VCodeBlock Component' , ( ) => {
@@ -11,41 +12,27 @@ describe('VCodeBlock Component', () => {
1112 prismjs : true ,
1213 }
1314 } ) ;
15+
1416 const returnedProps = wrapper . getComponent ( VCodeBlock ) . props ( ) ;
1517
16- expect ( returnedProps ) . toMatchInlineSnapshot ( `
17- {
18- "browserWindow": false,
19- "code": "",
20- "codeBlockRadius": "0.5rem",
21- "copyButton": true,
22- "copyFailedText": "Copy failed!",
23- "copyIcons": true,
24- "copySuccessText": "Copied!",
25- "copyTab": true,
26- "copyText": "Copy Code",
27- "cssPath": undefined,
28- "floatingTabs": true,
29- "globalOptions": false,
30- "height": "auto",
31- "highlightjs": false,
32- "indent": 2,
33- "label": "",
34- "lang": "javascript",
35- "languages": undefined,
36- "maxHeight": "auto",
37- "persistentCopyButton": false,
38- "prismPlugin": false,
39- "prismjs": true,
40- "runTab": false,
41- "runText": "Run",
42- "tabGap": "0.25rem",
43- "tabs": false,
44- "theme": "neon-bunny",
18+ expect ( returnedProps ) . toMatchSnapshot ( ) ;
19+ } ) ;
20+
21+ it ( 'should emit run event' , ( ) => {
22+ const wrapper = mount ( VCodeBlock , {
23+ props : {
24+ prismjs : true ,
25+ runTab : true ,
26+ tabs : true ,
4527 }
46- ` ) ;
28+ } ) ;
29+
30+ wrapper . find ( `.${ pluginName } --tab-run` ) . trigger ( 'click' ) ;
31+
32+ expect ( wrapper . emitted ( ) ) . toHaveProperty ( 'run' ) ;
4733 } ) ;
4834
35+
4936 // -------------------------------------------------- Errors //
5037 const throwErrors = {
5138 bothSet : '[vue-code-block]: You cannot have both prismjs and highlightjs props set at the same time.' ,
0 commit comments