wxs.spec.ts 1.2 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
import { normalizeWxsCode } from '../src/configResolved/plugins/preVue'

describe('wxs', () => {
  test('normalizeWxsCode', () => {
    expect(
      normalizeWxsCode(`<template><view></view><view></view></template>
      <script>
      export default {}
      </script>
      <script lang="renderjs" module="echarts">
      export default{
          mounted(){
              console.log('mounted')
          }
      }
      </script>
      <style>
      .content {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
      }
      </style>
      `)
    ).toMatchSnapshot()
    expect(
      normalizeWxsCode(`<template><view></view><view></view></template>
        <script>
        export default {}
        </script>
        <script lang="wxs" module="echarts">
        export default{
            mounted(){
                console.log('mounted')
            }
        }
        </script>
        <style>
        .content {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        </style>
        `)
    ).toMatchSnapshot()
  })
})