forked from NervJS/taro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(runner): 为 mini/webpack-runner 增加 vue3 测试用例
- Loading branch information
Showing
41 changed files
with
1,823 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
809 changes: 809 additions & 0 deletions
809
packages/taro-mini-runner/__tests__/__snapshots__/vue3.spec.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
packages/taro-mini-runner/__tests__/fixtures/vue3/babel.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// babel-preset-taro 更多选项和默认值: | ||
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md | ||
module.exports = { | ||
presets: [ | ||
['taro', { | ||
framework: 'vue3', | ||
ts: false | ||
}] | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/taro-mini-runner/__tests__/fixtures/vue3/src/app.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
pages: [ | ||
'pages/index/index' | ||
], | ||
window: { | ||
backgroundTextStyle: 'light', | ||
navigationBarBackgroundColor: '#fff', | ||
navigationBarTitleText: 'WeChat', | ||
navigationBarTextStyle: 'black' | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createApp } from 'vue' | ||
import './app.css' | ||
|
||
const App = createApp({ | ||
onShow (options) {}, | ||
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 | ||
}) | ||
|
||
export default App |
19 changes: 19 additions & 0 deletions
19
packages/taro-mini-runner/__tests__/fixtures/vue3/src/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<meta name="apple-touch-fullscreen" content="yes"> | ||
<meta name="format-detection" content="telephone=no,address=no"> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="white"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > | ||
<title></title> | ||
<script> | ||
!function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
</html> |
3 changes: 3 additions & 0 deletions
3
packages/taro-mini-runner/__tests__/fixtures/vue3/src/pages/index/index.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
navigationBarTitleText: '首页' | ||
} |
Empty file.
17 changes: 17 additions & 0 deletions
17
packages/taro-mini-runner/__tests__/fixtures/vue3/src/pages/index/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<view class="index"> | ||
<text>{{ msg }}</text> | ||
</view> | ||
</template> | ||
|
||
<script> | ||
import { ref } from 'vue' | ||
export default { | ||
setup () { | ||
const msg = ref('Hello world') | ||
return { | ||
msg | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { compile, getOutput } from './utils/compiler' | ||
|
||
describe('vue3', () => { | ||
test('should build vue3 app', async () => { | ||
const { stats, config } = await compile('vue3', { | ||
framework: 'vue3' | ||
}) | ||
const assets = stats.toJson().assets | ||
|
||
expect(assets.length).toMatchSnapshot() | ||
|
||
const output = getOutput(stats, config) | ||
expect(output).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.