|
| 1 | +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html |
| 2 | + |
| 3 | +exports[`babel-plugin-transform-taroapi > should canIUse support scheme with numeric attributes! 1`] = ` |
| 4 | +"import { canIUse as _canUse } from '@tarojs/taro-h5'; |
| 5 | +// 入参带有数字属性的对象路径 |
| 6 | +true; |
| 7 | +true;" |
| 8 | +`; |
| 9 | + |
| 10 | +exports[`babel-plugin-transform-taroapi > should canIUse support! 1`] = ` |
| 11 | +"import { canIUse as _canUse } from '@tarojs/taro-h5'; |
| 12 | +// 对象的属性或方法 |
| 13 | +false; |
| 14 | +false; |
| 15 | +false; |
| 16 | +false; |
| 17 | +
|
| 18 | +// 接口参数、回调或者返回值 |
| 19 | +true; |
| 20 | +false; |
| 21 | +false; |
| 22 | +false; |
| 23 | +false; |
| 24 | +true; |
| 25 | +
|
| 26 | +// 组件的属性 |
| 27 | +true; |
| 28 | +true; |
| 29 | +true;" |
| 30 | +`; |
| 31 | + |
| 32 | +exports[`babel-plugin-transform-taroapi > should canIUse work or skip! 1`] = ` |
| 33 | +"import Taro from '@tarojs/taro-h5'; |
| 34 | +function canIUse() {} |
| 35 | +false; |
| 36 | +false; |
| 37 | +canIUse('showToast.object.image');" |
| 38 | +`; |
| 39 | + |
| 40 | +exports[`babel-plugin-transform-taroapi > should leave other apis untouched 1`] = ` |
| 41 | +"import Taro from '@tarojs/taro-h5'; |
| 42 | +Taro.noop;" |
| 43 | +`; |
| 44 | + |
| 45 | +exports[`babel-plugin-transform-taroapi > should move static apis under "Taro" 1`] = ` |
| 46 | +"import Taro from '@tarojs/taro-h5'; |
| 47 | +Taro.noop; |
| 48 | +Taro.noop();" |
| 49 | +`; |
| 50 | + |
| 51 | +exports[`babel-plugin-transform-taroapi > should not go wrong when using an api twice 1`] = ` |
| 52 | +"import Taro, { createAnimation as _createAnimation } from '@tarojs/taro-h5'; |
| 53 | +const animation = _createAnimation({ |
| 54 | + duration: dura * 1000, |
| 55 | + timingFunction: 'linear' |
| 56 | +}); |
| 57 | +const resetAnimation = _createAnimation({ |
| 58 | + duration: 0, |
| 59 | + timingFunction: 'linear' |
| 60 | +});" |
| 61 | +`; |
| 62 | + |
| 63 | +exports[`babel-plugin-transform-taroapi > should not import taro duplicity 1`] = ` |
| 64 | +"import Taro, { createAnimation as _createAnimation, initPxTransform as _initPxTransform } from '@tarojs/taro-h5'; |
| 65 | +Taro.Component; |
| 66 | +_createAnimation(); |
| 67 | +_initPxTransform();" |
| 68 | +`; |
| 69 | + |
| 70 | +exports[`babel-plugin-transform-taroapi > should preserve assignments in left hands 1`] = ` |
| 71 | +"import Taro, { createAnimation as _createAnimation, request as _request } from '@tarojs/taro-h5'; |
| 72 | +let animation; |
| 73 | +animation = _createAnimation({ |
| 74 | + transformOrigin: "50% 50%", |
| 75 | + duration: 1000, |
| 76 | + timingFunction: "ease", |
| 77 | + delay: 0 |
| 78 | +}); |
| 79 | +_request(); |
| 80 | +Taro.request = ''; |
| 81 | +Taro['request'] = '';" |
| 82 | +`; |
| 83 | + |
| 84 | +exports[`babel-plugin-transform-taroapi > should preserve default imports 1`] = ` |
| 85 | +"import Taro from '@tarojs/taro-h5'; |
| 86 | +console.log(Taro);" |
| 87 | +`; |
| 88 | + |
| 89 | +exports[`babel-plugin-transform-taroapi > should support rename of imported names 1`] = ` |
| 90 | +"// import { inject as mobxInject, observer as mobxObserver } from '@tarojs/mobx' |
| 91 | +import Taro from '@tarojs/taro-h5'; |
| 92 | +export class Connected extends Taro.Component {}" |
| 93 | +`; |
| 94 | + |
| 95 | +exports[`babel-plugin-transform-taroapi > should work! 1`] = ` |
| 96 | +"import Taro, { setStorage as _setStorage, initPxTransform as _initPxTransform, getStorage as _getStorage } from '@tarojs/taro-h5'; |
| 97 | +_initPxTransform(Taro.param); |
| 98 | +_initPxTransform(); |
| 99 | +_initPxTransform(); |
| 100 | +_getStorage(); |
| 101 | +_setStorage(); |
| 102 | +export { Taro };" |
| 103 | +`; |
| 104 | + |
| 105 | +exports[`babel-plugin-transform-taroapi should canIUse support scheme with numeric attributes! 1`] = ` |
| 106 | +"import { canIUse as _canUse } from '@tarojs/taro-h5'; |
| 107 | +// 入参带有数字属性的对象路径 |
| 108 | +true; |
| 109 | +true;" |
| 110 | +`; |
| 111 | + |
| 112 | +exports[`babel-plugin-transform-taroapi should canIUse support! 1`] = ` |
| 113 | +"import { canIUse as _canUse } from '@tarojs/taro-h5'; |
| 114 | +// 对象的属性或方法 |
| 115 | +false; |
| 116 | +false; |
| 117 | +false; |
| 118 | +false; |
| 119 | +
|
| 120 | +// 接口参数、回调或者返回值 |
| 121 | +true; |
| 122 | +false; |
| 123 | +false; |
| 124 | +false; |
| 125 | +false; |
| 126 | +true; |
| 127 | +
|
| 128 | +// 组件的属性 |
| 129 | +true; |
| 130 | +true; |
| 131 | +true;" |
| 132 | +`; |
| 133 | + |
| 134 | +exports[`babel-plugin-transform-taroapi should canIUse work or skip! 1`] = ` |
| 135 | +"import Taro from '@tarojs/taro-h5'; |
| 136 | +function canIUse() {} |
| 137 | +false; |
| 138 | +false; |
| 139 | +canIUse('showToast.object.image');" |
| 140 | +`; |
| 141 | + |
| 142 | +exports[`babel-plugin-transform-taroapi should leave other apis untouched 1`] = ` |
| 143 | +"import Taro from '@tarojs/taro-h5'; |
| 144 | +Taro.noop;" |
| 145 | +`; |
| 146 | + |
| 147 | +exports[`babel-plugin-transform-taroapi should move static apis under "Taro" 1`] = ` |
| 148 | +"import Taro from '@tarojs/taro-h5'; |
| 149 | +Taro.noop; |
| 150 | +Taro.noop();" |
| 151 | +`; |
| 152 | + |
| 153 | +exports[`babel-plugin-transform-taroapi should not go wrong when using an api twice 1`] = ` |
| 154 | +"import Taro, { createAnimation as _createAnimation } from '@tarojs/taro-h5'; |
| 155 | +const animation = _createAnimation({ |
| 156 | + duration: dura * 1000, |
| 157 | + timingFunction: 'linear' |
| 158 | +}); |
| 159 | +const resetAnimation = _createAnimation({ |
| 160 | + duration: 0, |
| 161 | + timingFunction: 'linear' |
| 162 | +});" |
| 163 | +`; |
| 164 | + |
| 165 | +exports[`babel-plugin-transform-taroapi should not import taro duplicity 1`] = ` |
| 166 | +"import Taro, { createAnimation as _createAnimation, initPxTransform as _initPxTransform } from '@tarojs/taro-h5'; |
| 167 | +Taro.Component; |
| 168 | +_createAnimation(); |
| 169 | +_initPxTransform();" |
| 170 | +`; |
| 171 | + |
| 172 | +exports[`babel-plugin-transform-taroapi should preserve assignments in left hands 1`] = ` |
| 173 | +"import Taro, { createAnimation as _createAnimation, request as _request } from '@tarojs/taro-h5'; |
| 174 | +let animation; |
| 175 | +animation = _createAnimation({ |
| 176 | + transformOrigin: "50% 50%", |
| 177 | + duration: 1000, |
| 178 | + timingFunction: "ease", |
| 179 | + delay: 0 |
| 180 | +}); |
| 181 | +_request(); |
| 182 | +Taro.request = ''; |
| 183 | +Taro['request'] = '';" |
| 184 | +`; |
| 185 | + |
| 186 | +exports[`babel-plugin-transform-taroapi should preserve default imports 1`] = ` |
| 187 | +"import Taro from '@tarojs/taro-h5'; |
| 188 | +console.log(Taro);" |
| 189 | +`; |
| 190 | + |
| 191 | +exports[`babel-plugin-transform-taroapi should support rename of imported names 1`] = ` |
| 192 | +"// import { inject as mobxInject, observer as mobxObserver } from '@tarojs/mobx' |
| 193 | +import Taro from '@tarojs/taro-h5'; |
| 194 | +export class Connected extends Taro.Component {}" |
| 195 | +`; |
| 196 | + |
| 197 | +exports[`babel-plugin-transform-taroapi should work! 1`] = ` |
| 198 | +"import Taro, { setStorage as _setStorage, initPxTransform as _initPxTransform, getStorage as _getStorage } from '@tarojs/taro-h5'; |
| 199 | +_initPxTransform(Taro.param); |
| 200 | +_initPxTransform(); |
| 201 | +_initPxTransform(); |
| 202 | +_getStorage(); |
| 203 | +_setStorage(); |
| 204 | +export { Taro };" |
| 205 | +`; |
0 commit comments