Testing Template Interpolation Transformation in dcloudio/uni-app
A comprehensive test suite for validating string interpolation transformations in the uni-app UTS framework. This test suite focuses on verifying the correct compilation of template expressions and text content within text elements, ensuring proper transformation of both static and dynamic content.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
dcloudio/uni-app
packages/uni-app-uts/__tests__/android/transforms/transformInterpolation.spec.ts
import { assert } from '../testUtils'
describe('compiler: transform interpolation', () => {
test('transform interpolation', () => {
assert(`<text>foo</text>`, `createElementVNode("text", null, "foo")`)
assert(
`<text>{{ foo }} bar {{ baz }}</text>`,
`createElementVNode("text", null, toDisplayString(_ctx.foo) + " bar " + toDisplayString(_ctx.baz), 1 /* TEXT */)`
)
})
})