@@ -46,77 +46,77 @@ export default tester(
4646 await new Promise ( resolve => setTimeout ( resolve , 30000 ) )
4747 await this . page . click ( 'button' )
4848 expect (
49- await this . page . screenshot ( { fullPage : true } )
49+ await this . page . screenshot ( { fullPage : true } ) ,
5050 ) . toMatchImageSnapshot ( this )
5151 } ,
5252 } ,
5353 click : {
5454 page : endent `
55- <template>
56- <div>
57- <button class="hide-button" @click="hide" />
55+ <template>
5856 <div>
59- <self :class="['diagram', clicked1]" :value="diagram" @node-click="nodeClick1" />
60- <self v-if="visible" :class="['diagram', clicked2]" :value="diagram" @node-click="nodeClick2" />
57+ <button class="hide-button" @click="hide" />
58+ <div>
59+ <self :class="['diagram', clicked1]" :value="diagram" @node-click="nodeClick1" />
60+ <self v-if="visible" :class="['diagram', clicked2]" :value="diagram" @node-click="nodeClick2" />
61+ </div>
6162 </div>
62- </div>
63- </template>
64-
65- <script>
66- import { endent } from '@dword-design/functions'
67-
68- export default {
69- data: () => ({
70- clicked1: 'not-clicked',
71- clicked2: 'not-clicked',
72- visible: true,
73- }),
74- computed: {
75- diagram: () => endent\`
76- graph TD
77- A --> B
78- click A href "https://google.com"
79- click B
80- \`,
81- },
82- methods: {
83- hide() {
84- this.visible = false
85- },
86- nodeClick1(id) {
87- if (id === 'B') {
88- this.clicked1 = 'clicked'
89- }
63+ </template>
64+
65+ <script>
66+ import { endent } from '@dword-design/functions'
67+
68+ export default {
69+ data: () => ({
70+ clicked1: 'not-clicked',
71+ clicked2: 'not-clicked',
72+ visible: true,
73+ }),
74+ computed: {
75+ diagram: () => endent\`
76+ graph TD
77+ A --> B
78+ click A href "https://google.com"
79+ click B
80+ \`,
9081 },
91- nodeClick2(id) {
92- if (id === 'B') {
93- this.clicked2 = 'clicked'
94- }
82+ methods: {
83+ hide() {
84+ this.visible = false
85+ },
86+ nodeClick1(id) {
87+ if (id === 'B') {
88+ this.clicked1 = 'clicked'
89+ }
90+ },
91+ nodeClick2(id) {
92+ if (id === 'B') {
93+ this.clicked2 = 'clicked'
94+ }
95+ },
9596 },
96- },
97- }
98- </script>
99- ` ,
97+ }
98+ </script>
99+ ` ,
100100 async test ( ) {
101101 const callbackPrefix = 'mermaidClick_'
102102 await this . page . goto ( 'http://localhost:3000' )
103103 await this . page . waitForSelector (
104- '.diagram:first-child .node[id^=flowchart-A-] a[href="https://google.com"]'
104+ '.diagram:first-child .node[id^=flowchart-A-] a[href="https://google.com"]' ,
105105 )
106106
107107 const node1 = await this . page . waitForSelector (
108- '.diagram:first-child .node:last-child'
108+ '.diagram:first-child .node:last-child' ,
109109 )
110110
111111 const node2 = await this . page . waitForSelector (
112- '.diagram:last-child .node:last-child'
112+ '.diagram:last-child .node:last-child' ,
113113 )
114114 expect (
115115 (
116116 this . page . evaluate ( ( ) => Object . keys ( window ) )
117117 | > await
118118 | > filter ( key => key . startsWith ( callbackPrefix ) )
119- ) . length
119+ ) . length ,
120120 ) . toEqual ( 2 )
121121 await node1 . click ( )
122122 await this . page . waitForSelector ( '.diagram:first-child.clicked' )
@@ -131,93 +131,93 @@ export default tester(
131131 this . page . evaluate ( ( ) => Object . keys ( window ) )
132132 | > await
133133 | > filter ( key => key . startsWith ( callbackPrefix ) )
134- ) . length
134+ ) . length ,
135135 ) . toEqual ( 1 )
136136 } ,
137137 } ,
138138 'error handling' : {
139139 page : endent `
140- <template>
141- <div v-if="error" class="foo">{{ error }}</div>
142- <self v-else class="foo" value="foo" @parse-error="error = $event" />
143- </template>
144-
145- <script>
146- export default {
147- data: () => ({
148- error: undefined,
149- }),
150- }
151- </script>
152-
153- ` ,
140+ <template>
141+ <div v-if="error" class="foo">{{ error }}</div>
142+ <self v-else class="foo" value="foo" @parse-error="error = $event" />
143+ </template>
144+
145+ <script>
146+ export default {
147+ data: () => ({
148+ error: undefined,
149+ }),
150+ }
151+ </script>
152+
153+ ` ,
154154 async test ( ) {
155155 await this . page . goto ( 'http://localhost:3000' )
156156 await this . page . waitForSelector ( '.foo' )
157157 expect (
158- await this . page . screenshot ( { fullPage : true } )
158+ await this . page . screenshot ( { fullPage : true } ) ,
159159 ) . toMatchImageSnapshot ( this )
160160 } ,
161161 } ,
162162 options : {
163163 page : endent `
164- <template>
165- <self class="foo" :value="diagram" :options="{ maxTextSize: 3 }" />
166- </template>
167-
168- <script>
169- import { endent } from '@dword-design/functions'
170-
171- export default {
172- computed: {
173- diagram: () => endent\`
174- graph TD
175- A --> B
176- \`,
177- },
178- }
179- </script>
180-
181- ` ,
164+ <template>
165+ <self class="foo" :value="diagram" :options="{ maxTextSize: 3 }" />
166+ </template>
167+
168+ <script>
169+ import { endent } from '@dword-design/functions'
170+
171+ export default {
172+ computed: {
173+ diagram: () => endent\`
174+ graph TD
175+ A --> B
176+ \`,
177+ },
178+ }
179+ </script>
180+
181+ ` ,
182182 async test ( ) {
183183 await this . page . goto ( 'http://localhost:3000' )
184184 await this . page . waitForSelector ( '.foo' )
185185 expect (
186- await this . page . screenshot ( { fullPage : true } )
186+ await this . page . screenshot ( { fullPage : true } ) ,
187187 ) . toMatchImageSnapshot ( this )
188188 } ,
189189 } ,
190190 works : {
191191 page : endent `
192- <template>
193- <self class="foo" :value="diagram" />
194- </template>
195-
196- <script>
197- import { endent } from '@dword-design/functions'
198-
199- export default {
200- computed: {
201- diagram: () => endent\`
202- graph TD
203- A --> B
204- \`,
205- },
206- }
207- </script>
208-
209- ` ,
192+ <template>
193+ <self class="foo" :value="diagram" />
194+ </template>
195+
196+ <script>
197+ import { endent } from '@dword-design/functions'
198+
199+ export default {
200+ computed: {
201+ diagram: () => endent\`
202+ graph TD
203+ A --> B
204+ \`,
205+ },
206+ }
207+ </script>
208+
209+ ` ,
210210 async test ( ) {
211211 await this . page . goto ( 'http://localhost:3000' )
212212 await this . page . waitForSelector ( '.foo' )
213213 expect (
214- await this . page . screenshot ( { fullPage : true } )
214+ await this . page . screenshot ( { fullPage : true } ) ,
215215 ) . toMatchImageSnapshot ( this )
216216 } ,
217217 } ,
218218 } ,
219219 [
220220 testerPluginComponent ( { componentPath : _require . resolve ( './index.vue' ) } ) ,
221221 testerPluginPuppeteer ( ) ,
222- ]
222+ ] ,
223223)
0 commit comments