Skip to content

Commit

Permalink
feat(transformer): 清理无用代码,开始重构新组件化功能
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Jul 16, 2018
1 parent 34ed952 commit 71f8de8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 611 deletions.
4 changes: 2 additions & 2 deletions packages/taro-transformer-wx/__tests__/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import transform from '../src'
import { buildComponent, baseCode, baseOptions, evalClass, Custom } from './utils'
import { isObject } from 'lodash'

describe('$props', () => {
describe.skip('$props', () => {

test('$usedState 加入被引用第三方组件的名字', () => {
const { ast } = transform({
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('$props', () => {
})
})

describe.only('$components', () => {
describe.skip('$components', () => {
test('$components 一直存在并且是一个 Object', () => {
const { ast, code } = transform({
...baseOptions,
Expand Down
7 changes: 2 additions & 5 deletions packages/taro-transformer-wx/__tests__/template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,7 @@ describe('Template', () => {
// const props = instance.$props.Custom()
// expect(props.$name).toBe('Custom')
// expect(props.hidden).toBe(true)
expect(template).toMatch(`data=\"{{...item}}\"`)
expect(template).toMatch(`wx:for-item=\"item\"`)
expect(template).toMatch(`wx:for=\"{{$$Custom}}\"`)
expect(template).toMatch(`wx:key=`)
expect(template).toMatch(`<custom hidden=\"{{true}}\"></custom>`)
})

test('自定义组件循环', () => {
Expand All @@ -479,7 +476,7 @@ describe('Template', () => {
// const props = instance.$props.Custom()
// expect(props.$name).toBe('Custom')
// expect(props.hidden).toBe(true)
expect(template).toMatch(`<template is=\"Custom\" data=\"{{...a1}}\" wx:for=\"{{array}}\" wx:for-item=\"a1\"></template>`)
expect(template).toMatch(`<custom wx:for=\"{{array}}\" wx:for-item=\"a1\"></custom>`)
})
})

Expand Down
Loading

0 comments on commit 71f8de8

Please sign in to comment.