├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .gitignore ├── .prettierrc.json ├── CHANGELOG.md ├── README.md ├── babel.config.js ├── examples └── button.vue ├── jest.config.js ├── package.json ├── packages └── button │ ├── README.md │ └── index.vue ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── logo.png │ └── styles │ │ ├── index.scss │ │ ├── reset.scss │ │ ├── utils.scss │ │ └── variable.scss ├── main.js ├── router │ └── index.js ├── tests │ ├── coverage │ │ ├── clover.xml │ │ ├── coverage-final.json │ │ ├── lcov-report │ │ │ ├── base.css │ │ │ ├── block-navigation.js │ │ │ ├── index.html │ │ │ ├── math.js.html │ │ │ ├── prettify.css │ │ │ ├── prettify.js │ │ │ ├── sort-arrow-sprite.png │ │ │ ├── sorter.js │ │ │ └── vue-h5-template │ │ │ │ ├── .env.js.html │ │ │ │ ├── index.html │ │ │ │ └── src │ │ │ │ ├── api │ │ │ │ ├── index.html │ │ │ │ └── user.js.html │ │ │ │ └── utils │ │ │ │ ├── http.js.html │ │ │ │ ├── index.html │ │ │ │ └── math.js.html │ │ └── lcov.info │ ├── demo │ │ ├── config.js │ │ ├── math.js │ │ └── run.js │ └── unit │ │ ├── api │ │ └── __mocks__ │ │ │ └── mock.js │ │ ├── components │ │ └── helloworld.spec.js │ │ └── utils │ │ ├── __snapshots__ │ │ └── snapshot.spec.js.snap │ │ ├── math.spec.js │ │ ├── run.spec.js │ │ └── snapshot.spec.js └── utils │ └── adapt.js ├── vue.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /tests 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ['plugin:vue/essential', 'standard'], 7 | rules: { 8 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 9 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 10 | quotes: ['error', 'single'], 11 | indent: ['error', 2, { MemberExpression: 'off' }], 12 | // allow paren-less arrow functions 13 | 'arrow-parens': 0, 14 | 'no-loop-func': 2 15 | // allow async-await 16 | }, 17 | parserOptions: { 18 | parser: require.resolve('babel-eslint'), 19 | ecmaVersion: 2018, 20 | sourceType: 'module' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=JavaScript 2 | *.css linguist-language=JavaScript 3 | *.html linguist-language=JavaScript 4 | *.c linguist-language=JavaScript 5 | *.c++ linguist-language=JavaScript 6 | *.php linguist-language=JavaScript 7 | *.python linguist-language=JavaScript 8 | *.scss linguist-language=JavaScript 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.js 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | config/debug.js 24 | # *.config.js 25 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 150, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "semi": false, 6 | "tabWidth": 2, 7 | "useTabs": false, 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "arrowParens": "always", 11 | "proseWrap": "preserve", 12 | "overrides": [ 13 | { 14 | "files": ["*.json", ".eslintrc", ".tslintrc", ".prettierrc", ".tern-project"], 15 | "options": { 16 | "parser": "json", 17 | "tabWidth": 2 18 | } 19 | }, 20 | { 21 | "files": "*.{css,sass,scss,less}", 22 | "options": { 23 | "parser": "css", 24 | "tabWidth": 2 25 | } 26 | }, 27 | { 28 | "files": "*.ts", 29 | "options": { 30 | "parser": "typescript" 31 | } 32 | }, 33 | { 34 | "files": "*.vue", 35 | "options": { 36 | "parser": "vue" 37 | } 38 | }, 39 | { 40 | "files": "*.md", 41 | "options": { 42 | "parser": "markdown" 43 | } 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/CHANGELOG.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Suo UI 2 | 3 | ## Installation 4 | ```bash 5 | npm i suo-ui -S 6 | 7 | # for Vue 1.x 8 | npm i suo-ui@1 -S 9 | ``` 10 | 11 | ## Usage 12 | 13 | 14 | 15 | ### Customize configuration 16 | See [Configuration Reference](https://cli.vuejs.org/config/). 17 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@vue/app'], 3 | plugins: [['import', { libraryName: 'vant', libraryDirectory: 'es', style: true }, 'vant']] 4 | } 5 | -------------------------------------------------------------------------------- /examples/button.vue: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/examples/button.vue -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // For a detailed explanation regarding each configuration property, visit: 2 | // https://jestjs.io/docs/en/configuration.html 3 | 4 | module.exports = { 5 | preset: '@vue/cli-plugin-unit-jest', 6 | // All imported modules in your tests should be mocked automatically 7 | automock: false, 8 | 9 | // Stop running tests after `n` failures 10 | // bail: 0, 11 | 12 | // Respect "browser" field in package.json when resolving modules 13 | // browser: false, 14 | 15 | // The directory where Jest should store its cached dependency information 16 | // cacheDirectory: "/private/var/folders/10/bb2hb93j34999j9cqr587ts80000gn/T/jest_dx", 17 | 18 | // Automatically clear mock calls and instances between every test 19 | clearMocks: true, 20 | 21 | // Indicates whether the coverage information should be collected while executing the test 22 | // collectCoverage: false, 23 | 24 | // An array of glob patterns indicating a set of files for which coverage information should be collected 25 | // collectCoverageFrom: null, 26 | 27 | // The directory where Jest should output its coverage files 28 | coverageDirectory: 'tests/coverage' 29 | 30 | // An array of regexp pattern strings used to skip coverage collection 31 | // coveragePathIgnorePatterns: [ 32 | // "/node_modules/" 33 | // ], 34 | 35 | // A list of reporter names that Jest uses when writing coverage reports 36 | // coverageReporters: [ 37 | // "json", 38 | // "text", 39 | // "lcov", 40 | // "clover" 41 | // ], 42 | 43 | // An object that configures minimum threshold enforcement for coverage results 44 | // coverageThreshold: null, 45 | 46 | // A path to a custom dependency extractor 47 | // dependencyExtractor: null, 48 | 49 | // Make calling deprecated APIs throw helpful error messages 50 | // errorOnDeprecated: false, 51 | 52 | // Force coverage collection from ignored files using an array of glob patterns 53 | // forceCoverageMatch: [], 54 | 55 | // A path to a module which exports an async function that is triggered once before all test suites 56 | // globalSetup: null, 57 | 58 | // A path to a module which exports an async function that is triggered once after all test suites 59 | // globalTeardown: null, 60 | 61 | // A set of global variables that need to be available in all test environments 62 | // globals: {}, 63 | 64 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 65 | // maxWorkers: "50%", 66 | 67 | // An array of directory names to be searched recursively up from the requiring module's location 68 | // moduleDirectories: [ 69 | // "node_modules" 70 | // ], 71 | 72 | // An array of file extensions your modules use 73 | // moduleFileExtensions: [ 74 | // "js", 75 | // "json", 76 | // "jsx", 77 | // "ts", 78 | // "tsx", 79 | // "node" 80 | // ], 81 | 82 | // A map from regular expressions to module names that allow to stub out resources with a single module 83 | // moduleNameMapper: {}, 84 | 85 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 86 | // modulePathIgnorePatterns: [], 87 | 88 | // Activates notifications for test results 89 | // notify: false, 90 | 91 | // An enum that specifies notification mode. Requires { notify: true } 92 | // notifyMode: "failure-change", 93 | 94 | // A preset that is used as a base for Jest's configuration 95 | // preset: null, 96 | 97 | // Run tests from one or more projects 98 | // projects: null, 99 | 100 | // Use this configuration option to add custom reporters to Jest 101 | // reporters: undefined, 102 | 103 | // Automatically reset mock state between every test 104 | // resetMocks: false, 105 | 106 | // Reset the module registry before running each individual test 107 | // resetModules: false, 108 | 109 | // A path to a custom resolver 110 | // resolver: null, 111 | 112 | // Automatically restore mock state between every test 113 | // restoreMocks: false, 114 | 115 | // The root directory that Jest should scan for tests and modules within 116 | // rootDir: null, 117 | 118 | // A list of paths to directories that Jest should use to search for files in 119 | // roots: [ 120 | // "" 121 | // ], 122 | 123 | // Allows you to use a custom runner instead of Jest's default test runner 124 | // runner: "jest-runner", 125 | 126 | // The paths to modules that run some code to configure or set up the testing environment before each test 127 | // setupFiles: [], 128 | 129 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 130 | // setupFilesAfterEnv: [], 131 | 132 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 133 | // snapshotSerializers: [], 134 | 135 | // The test environment that will be used for testing 136 | // testEnvironment: 'node' 137 | 138 | // Options that will be passed to the testEnvironment 139 | // testEnvironmentOptions: {}, 140 | 141 | // Adds a location field to test results 142 | // testLocationInResults: false, 143 | 144 | // The glob patterns Jest uses to detect test files 145 | // testMatch: [ 146 | // "**/__tests__/**/*.[jt]s?(x)", 147 | // "**/?(*.)+(spec|test).[tj]s?(x)" 148 | // ], 149 | 150 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 151 | // testPathIgnorePatterns: [ 152 | // "/node_modules/" 153 | // ], 154 | 155 | // The regexp pattern or array of patterns that Jest uses to detect test files 156 | // testRegex: [], 157 | 158 | // This option allows the use of a custom results processor 159 | // testResultsProcessor: null, 160 | 161 | // This option allows use of a custom test runner 162 | // testRunner: "jasmine2", 163 | 164 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href 165 | // testURL: "http://localhost", 166 | 167 | // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" 168 | // timers: "real", 169 | 170 | // A map from regular expressions to paths to transformers 171 | // transform: null, 172 | 173 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 174 | // transformIgnorePatterns: [ 175 | // "/node_modules/" 176 | // ], 177 | 178 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 179 | // unmockedModulePathPatterns: undefined, 180 | 181 | // Indicates whether each individual test should be reported during the run 182 | // verbose: null, 183 | 184 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 185 | // watchPathIgnorePatterns: [], 186 | 187 | // Whether to use watchman for file crawling 188 | // watchman: true, 189 | } 190 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-h5-template", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "cross-env NODE_ENV=development vue-cli-service serve", 7 | "mock": "cross-env NODE_ENV=mock vue-cli-service serve", 8 | "build": "cross-env NODE_ENV=production vue-cli-service build", 9 | "lint": "vue-cli-service lint", 10 | "test": "cross-env NODE_ENV=testing vue-cli-service test:unit", 11 | "coverage": "cross-env NODE_ENV=testing vue-cli-service test:unit --coverage", 12 | "watch": "cross-env NODE_ENV=testing vue-cli-service test:unit --watch" 13 | }, 14 | "dependencies": { 15 | "core-js": "^3.1.2", 16 | "moment": "^2.24.0", 17 | "vue": "^2.6.10", 18 | "vue-router": "^3.0.6", 19 | "vuex": "^3.0.1" 20 | }, 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "^4.0.0", 23 | "@vue/cli-plugin-eslint": "^4.0.0", 24 | "@vue/cli-plugin-unit-jest": "^4.0.5", 25 | "@vue/cli-service": "^4.0.0", 26 | "@vue/test-utils": "1.0.0-beta.29", 27 | "babel-eslint": "^10.0.1", 28 | "babel-plugin-import": "^1.12.2", 29 | "commitizen": "^4.0.3", 30 | "cross-env": "^6.0.3", 31 | "cz-conventional-changelog": "^3.0.2", 32 | "eslint": "^5.16.0", 33 | "eslint-config-standard": "^6.2.1", 34 | "eslint-friendly-formatter": "^2.0.7", 35 | "eslint-loader": "^2.1.2", 36 | "eslint-plugin-html": "^2.0.1", 37 | "eslint-plugin-promise": "^3.5.0", 38 | "eslint-plugin-standard": "^2.3.1", 39 | "eslint-plugin-vue": "^5.0.0", 40 | "jest": "^24.9.0", 41 | "js-cookie": "^2.2.1", 42 | "postcss-pxtorem": "^4.0.1", 43 | "prettier": "^1.18.2", 44 | "pug": "^2.0.4", 45 | "pug-html-loader": "^1.1.5", 46 | "pug-plain-loader": "^1.0.0", 47 | "sass": "^1.23.3", 48 | "sass-loader": "^8.0.0", 49 | "vue-template-compiler": "^2.6.10" 50 | }, 51 | "eslintConfig": { 52 | "root": true, 53 | "env": { 54 | "node": true 55 | }, 56 | "extends": [ 57 | "plugin:vue/essential", 58 | "eslint:recommended" 59 | ], 60 | "rules": {}, 61 | "parserOptions": { 62 | "parser": "babel-eslint" 63 | }, 64 | "overrides": [ 65 | { 66 | "files": [ 67 | "**/__tests__/*.{j,t}s?(x)", 68 | "**/tests/unit/**/*.spec.{j,t}s?(x)" 69 | ], 70 | "env": { 71 | "jest": true 72 | } 73 | } 74 | ] 75 | }, 76 | "postcss": { 77 | "plugins": { 78 | "autoprefixer": {} 79 | } 80 | }, 81 | "browserslist": [ 82 | "> 1%", 83 | "last 2 versions" 84 | ], 85 | "config": { 86 | "commitizen": { 87 | "path": "./node_modules/cz-conventional-changelog" 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /packages/button/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/packages/button/README.md -------------------------------------------------------------------------------- /packages/button/index.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 57 | 58 | 87 | 88 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-h5-template 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import 'reset.scss'; 2 | @import 'utils.scss'; 3 | -------------------------------------------------------------------------------- /src/assets/styles/reset.scss: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | /* HTML5 display-role reset for older browsers */ 27 | article, aside, details, figcaption, figure, 28 | footer, header, hgroup, menu, nav, section { 29 | display: block; 30 | } 31 | body { 32 | line-height: 1; 33 | } 34 | ol, ul { 35 | list-style: none; 36 | } 37 | blockquote, q { 38 | quotes: none; 39 | } 40 | blockquote:before, blockquote:after, 41 | q:before, q:after { 42 | content: ''; 43 | content: none; 44 | } 45 | table { 46 | border-collapse: collapse; 47 | border-spacing: 0; 48 | } 49 | 50 | html, body { 51 | width: 100%; 52 | height: 100%; 53 | } 54 | -------------------------------------------------------------------------------- /src/assets/styles/utils.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/src/assets/styles/utils.scss -------------------------------------------------------------------------------- /src/assets/styles/variable.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/src/assets/styles/variable.scss -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | 6 | // 引入通用scss文件初始化样式 7 | import '@/assets/styles/index.scss' 8 | // 适应屏幕宽度 9 | import '@/utils/adapt.js' 10 | 11 | Vue.config.productionTip = false 12 | 13 | new Vue({ 14 | router, 15 | store, 16 | render: (h) => h(App) 17 | }).$mount('#app') 18 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | 5 | Vue.use(VueRouter) 6 | 7 | const routes = [ 8 | { 9 | path: '/', 10 | name: 'home', 11 | component: Home 12 | }, 13 | { 14 | path: '/about', 15 | name: 'about', 16 | // route level code-splitting 17 | // this generates a separate chunk (about.[hash].js) for this route 18 | // which is lazy-loaded when the route is visited. 19 | component: () => 20 | import(/* webpackChunkName: "about" */ '../views/About.vue') 21 | } 22 | ] 23 | 24 | const router = new VueRouter({ 25 | mode: 'history', 26 | base: process.env.BASE_URL, 27 | routes 28 | }) 29 | 30 | export default router 31 | -------------------------------------------------------------------------------- /src/tests/coverage/clover.xml: -------------------------------------------------------------------------------- 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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/tests/coverage/coverage-final.json: -------------------------------------------------------------------------------- 1 | {"/Users/suosmile/www/project/vue-h5-template/.env.js": {"path":"/Users/suosmile/www/project/vue-h5-template/.env.js","statementMap":{"0":{"start":{"line":2,"column":12},"end":{"line":7,"column":1}},"1":{"start":{"line":9,"column":23},"end":{"line":19,"column":1}},"2":{"start":{"line":10,"column":2},"end":{"line":18,"column":3}},"3":{"start":{"line":11,"column":4},"end":{"line":11,"column":19}},"4":{"start":{"line":12,"column":9},"end":{"line":18,"column":3}},"5":{"start":{"line":13,"column":4},"end":{"line":13,"column":19}},"6":{"start":{"line":14,"column":9},"end":{"line":18,"column":3}},"7":{"start":{"line":15,"column":4},"end":{"line":15,"column":19}},"8":{"start":{"line":17,"column":4},"end":{"line":17,"column":18}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":9,"column":23},"end":{"line":9,"column":24}},"loc":{"start":{"line":9,"column":29},"end":{"line":19,"column":1}},"line":9}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":2},"end":{"line":18,"column":3}},"type":"if","locations":[{"start":{"line":10,"column":2},"end":{"line":18,"column":3}},{"start":{"line":10,"column":2},"end":{"line":18,"column":3}}],"line":10},"1":{"loc":{"start":{"line":12,"column":9},"end":{"line":18,"column":3}},"type":"if","locations":[{"start":{"line":12,"column":9},"end":{"line":18,"column":3}},{"start":{"line":12,"column":9},"end":{"line":18,"column":3}}],"line":12},"2":{"loc":{"start":{"line":14,"column":9},"end":{"line":18,"column":3}},"type":"if","locations":[{"start":{"line":14,"column":9},"end":{"line":18,"column":3}},{"start":{"line":14,"column":9},"end":{"line":18,"column":3}}],"line":14}},"s":{"0":1,"1":1,"2":1,"3":0,"4":1,"5":1,"6":0,"7":0,"8":0},"f":{"0":1},"b":{"0":[0,1],"1":[1,0],"2":[0,0]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"b988808faa7be36d576cd9debdcaa3fbc91462e3"} 2 | ,"/Users/suosmile/www/project/vue-h5-template/src/api/user.js": {"path":"/Users/suosmile/www/project/vue-h5-template/src/api/user.js","statementMap":{"0":{"start":{"line":4,"column":21},"end":{"line":4,"column":56}},"1":{"start":{"line":4,"column":31},"end":{"line":4,"column":56}},"2":{"start":{"line":7,"column":27},"end":{"line":7,"column":66}},"3":{"start":{"line":7,"column":37},"end":{"line":7,"column":66}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":4,"column":21},"end":{"line":4,"column":22}},"loc":{"start":{"line":4,"column":31},"end":{"line":4,"column":56}},"line":4},"1":{"name":"(anonymous_1)","decl":{"start":{"line":7,"column":27},"end":{"line":7,"column":28}},"loc":{"start":{"line":7,"column":37},"end":{"line":7,"column":66}},"line":7}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":0},"f":{"0":1,"1":0},"b":{},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"fef11be7451345555dc3a1ab4a9bbeacb3da2b50"} 3 | ,"/Users/suosmile/www/project/vue-h5-template/src/utils/http.js": {"path":"/Users/suosmile/www/project/vue-h5-template/src/utils/http.js","statementMap":{"0":{"start":{"line":6,"column":23},"end":{"line":6,"column":85}},"1":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"2":{"start":{"line":8,"column":0},"end":{"line":8,"column":52}},"3":{"start":{"line":11,"column":0},"end":{"line":22,"column":1}},"4":{"start":{"line":14,"column":4},"end":{"line":16,"column":5}},"5":{"start":{"line":17,"column":4},"end":{"line":17,"column":17}},"6":{"start":{"line":20,"column":4},"end":{"line":20,"column":30}},"7":{"start":{"line":25,"column":0},"end":{"line":37,"column":1}},"8":{"start":{"line":27,"column":4},"end":{"line":27,"column":19}},"9":{"start":{"line":30,"column":17},"end":{"line":30,"column":36}},"10":{"start":{"line":35,"column":4},"end":{"line":35,"column":40}},"11":{"start":{"line":47,"column":2},"end":{"line":58,"column":4}},"12":{"start":{"line":48,"column":4},"end":{"line":57,"column":8}},"13":{"start":{"line":53,"column":8},"end":{"line":53,"column":30}},"14":{"start":{"line":56,"column":8},"end":{"line":56,"column":19}},"15":{"start":{"line":72,"column":8},"end":{"line":72,"column":52}},"16":{"start":{"line":73,"column":8},"end":{"line":73,"column":36}},"17":{"start":{"line":78,"column":2},"end":{"line":87,"column":4}},"18":{"start":{"line":79,"column":4},"end":{"line":86,"column":5}},"19":{"start":{"line":81,"column":8},"end":{"line":81,"column":30}},"20":{"start":{"line":84,"column":8},"end":{"line":84,"column":19}},"21":{"start":{"line":96,"column":2},"end":{"line":114,"column":4}},"22":{"start":{"line":97,"column":4},"end":{"line":113,"column":7}},"23":{"start":{"line":101,"column":12},"end":{"line":101,"column":56}},"24":{"start":{"line":102,"column":12},"end":{"line":102,"column":40}},"25":{"start":{"line":108,"column":10},"end":{"line":108,"column":32}},"26":{"start":{"line":111,"column":10},"end":{"line":111,"column":21}},"27":{"start":{"line":118,"column":2},"end":{"line":127,"column":4}},"28":{"start":{"line":119,"column":4},"end":{"line":126,"column":5}},"29":{"start":{"line":121,"column":8},"end":{"line":121,"column":30}},"30":{"start":{"line":124,"column":8},"end":{"line":124,"column":19}},"31":{"start":{"line":132,"column":2},"end":{"line":148,"column":4}},"32":{"start":{"line":133,"column":21},"end":{"line":133,"column":35}},"33":{"start":{"line":134,"column":19},"end":{"line":138,"column":5}},"34":{"start":{"line":139,"column":4},"end":{"line":139,"column":33}},"35":{"start":{"line":140,"column":4},"end":{"line":147,"column":5}},"36":{"start":{"line":142,"column":8},"end":{"line":142,"column":30}},"37":{"start":{"line":145,"column":8},"end":{"line":145,"column":19}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":12,"column":2},"end":{"line":12,"column":3}},"loc":{"start":{"line":12,"column":14},"end":{"line":18,"column":3}},"line":12},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":2},"end":{"line":19,"column":3}},"loc":{"start":{"line":19,"column":11},"end":{"line":21,"column":3}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":26,"column":2},"end":{"line":26,"column":3}},"loc":{"start":{"line":26,"column":16},"end":{"line":28,"column":3}},"line":26},"3":{"name":"(anonymous_3)","decl":{"start":{"line":29,"column":2},"end":{"line":29,"column":3}},"loc":{"start":{"line":29,"column":13},"end":{"line":36,"column":3}},"line":29},"4":{"name":"fetch","decl":{"start":{"line":46,"column":16},"end":{"line":46,"column":21}},"loc":{"start":{"line":46,"column":41},"end":{"line":59,"column":1}},"line":46},"5":{"name":"(anonymous_5)","decl":{"start":{"line":47,"column":21},"end":{"line":47,"column":22}},"loc":{"start":{"line":47,"column":42},"end":{"line":58,"column":3}},"line":47},"6":{"name":"(anonymous_6)","decl":{"start":{"line":52,"column":12},"end":{"line":52,"column":13}},"loc":{"start":{"line":52,"column":26},"end":{"line":54,"column":7}},"line":52},"7":{"name":"(anonymous_7)","decl":{"start":{"line":55,"column":13},"end":{"line":55,"column":14}},"loc":{"start":{"line":55,"column":22},"end":{"line":57,"column":7}},"line":55},"8":{"name":"post","decl":{"start":{"line":66,"column":16},"end":{"line":66,"column":20}},"loc":{"start":{"line":77,"column":2},"end":{"line":88,"column":1}},"line":77},"9":{"name":"(anonymous_9)","decl":{"start":{"line":71,"column":6},"end":{"line":71,"column":7}},"loc":{"start":{"line":71,"column":32},"end":{"line":74,"column":7}},"line":71},"10":{"name":"(anonymous_10)","decl":{"start":{"line":78,"column":21},"end":{"line":78,"column":22}},"loc":{"start":{"line":78,"column":42},"end":{"line":87,"column":3}},"line":78},"11":{"name":"(anonymous_11)","decl":{"start":{"line":80,"column":6},"end":{"line":80,"column":7}},"loc":{"start":{"line":80,"column":20},"end":{"line":82,"column":7}},"line":80},"12":{"name":"(anonymous_12)","decl":{"start":{"line":83,"column":6},"end":{"line":83,"column":7}},"loc":{"start":{"line":83,"column":15},"end":{"line":85,"column":7}},"line":83},"13":{"name":"patch","decl":{"start":{"line":95,"column":16},"end":{"line":95,"column":21}},"loc":{"start":{"line":95,"column":39},"end":{"line":115,"column":1}},"line":95},"14":{"name":"(anonymous_14)","decl":{"start":{"line":96,"column":21},"end":{"line":96,"column":22}},"loc":{"start":{"line":96,"column":42},"end":{"line":114,"column":3}},"line":96},"15":{"name":"(anonymous_15)","decl":{"start":{"line":100,"column":10},"end":{"line":100,"column":11}},"loc":{"start":{"line":100,"column":36},"end":{"line":103,"column":11}},"line":100},"16":{"name":"(anonymous_16)","decl":{"start":{"line":107,"column":8},"end":{"line":107,"column":9}},"loc":{"start":{"line":107,"column":22},"end":{"line":109,"column":9}},"line":107},"17":{"name":"(anonymous_17)","decl":{"start":{"line":110,"column":8},"end":{"line":110,"column":9}},"loc":{"start":{"line":110,"column":17},"end":{"line":112,"column":9}},"line":110},"18":{"name":"del","decl":{"start":{"line":117,"column":16},"end":{"line":117,"column":19}},"loc":{"start":{"line":117,"column":32},"end":{"line":128,"column":1}},"line":117},"19":{"name":"(anonymous_19)","decl":{"start":{"line":118,"column":21},"end":{"line":118,"column":22}},"loc":{"start":{"line":118,"column":42},"end":{"line":127,"column":3}},"line":118},"20":{"name":"(anonymous_20)","decl":{"start":{"line":120,"column":6},"end":{"line":120,"column":7}},"loc":{"start":{"line":120,"column":20},"end":{"line":122,"column":7}},"line":120},"21":{"name":"(anonymous_21)","decl":{"start":{"line":123,"column":6},"end":{"line":123,"column":7}},"loc":{"start":{"line":123,"column":15},"end":{"line":125,"column":7}},"line":123},"22":{"name":"postImage","decl":{"start":{"line":131,"column":16},"end":{"line":131,"column":25}},"loc":{"start":{"line":131,"column":38},"end":{"line":149,"column":1}},"line":131},"23":{"name":"(anonymous_23)","decl":{"start":{"line":132,"column":21},"end":{"line":132,"column":22}},"loc":{"start":{"line":132,"column":42},"end":{"line":148,"column":3}},"line":132},"24":{"name":"(anonymous_24)","decl":{"start":{"line":141,"column":6},"end":{"line":141,"column":7}},"loc":{"start":{"line":141,"column":20},"end":{"line":143,"column":7}},"line":141},"25":{"name":"(anonymous_25)","decl":{"start":{"line":144,"column":6},"end":{"line":144,"column":7}},"loc":{"start":{"line":144,"column":15},"end":{"line":146,"column":7}},"line":144}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":25},"end":{"line":8,"column":52}},"type":"binary-expr","locations":[{"start":{"line":8,"column":25},"end":{"line":8,"column":34}},{"start":{"line":8,"column":38},"end":{"line":8,"column":52}}],"line":8},"1":{"loc":{"start":{"line":35,"column":26},"end":{"line":35,"column":39}},"type":"binary-expr","locations":[{"start":{"line":35,"column":26},"end":{"line":35,"column":30}},{"start":{"line":35,"column":34},"end":{"line":35,"column":39}}],"line":35},"2":{"loc":{"start":{"line":46,"column":28},"end":{"line":46,"column":39}},"type":"default-arg","locations":[{"start":{"line":46,"column":37},"end":{"line":46,"column":39}}],"line":46},"3":{"loc":{"start":{"line":68,"column":2},"end":{"line":68,"column":11}},"type":"default-arg","locations":[{"start":{"line":68,"column":9},"end":{"line":68,"column":11}}],"line":68},"4":{"loc":{"start":{"line":69,"column":2},"end":{"line":76,"column":3}},"type":"default-arg","locations":[{"start":{"line":69,"column":11},"end":{"line":76,"column":3}}],"line":69},"5":{"loc":{"start":{"line":95,"column":28},"end":{"line":95,"column":37}},"type":"default-arg","locations":[{"start":{"line":95,"column":35},"end":{"line":95,"column":37}}],"line":95}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":0,"7":1,"8":1,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":1,"16":1,"17":1,"18":1,"19":1,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0},"f":{"0":1,"1":0,"2":1,"3":0,"4":0,"5":0,"6":0,"7":0,"8":1,"9":1,"10":1,"11":1,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0},"b":{"0":[1,0],"1":[0,0],"2":[0],"3":[0],"4":[1],"5":[0]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"c60629644a53e0d83eeda42573878f3d87461239"} 4 | ,"/Users/suosmile/www/project/vue-h5-template/src/utils/math.js": {"path":"/Users/suosmile/www/project/vue-h5-template/src/utils/math.js","statementMap":{"0":{"start":{"line":1,"column":19},"end":{"line":1,"column":34}},"1":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}},"2":{"start":{"line":3,"column":19},"end":{"line":3,"column":34}},"3":{"start":{"line":3,"column":29},"end":{"line":3,"column":34}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}},"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":34}},"line":1},"1":{"name":"(anonymous_1)","decl":{"start":{"line":3,"column":19},"end":{"line":3,"column":20}},"loc":{"start":{"line":3,"column":29},"end":{"line":3,"column":34}},"line":3}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1},"f":{"0":1,"1":1},"b":{},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"19bf4bad9f36ea6dc77aa0b39b8bf085350ee5b2"} 5 | } 6 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | height: 100%; 4 | } 5 | body { 6 | font-family: Helvetica Neue, Helvetica, Arial; 7 | font-size: 14px; 8 | color:#333; 9 | } 10 | .small { font-size: 12px; } 11 | *, *:after, *:before { 12 | -webkit-box-sizing:border-box; 13 | -moz-box-sizing:border-box; 14 | box-sizing:border-box; 15 | } 16 | h1 { font-size: 20px; margin: 0;} 17 | h2 { font-size: 14px; } 18 | pre { 19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; 20 | margin: 0; 21 | padding: 0; 22 | -moz-tab-size: 2; 23 | -o-tab-size: 2; 24 | tab-size: 2; 25 | } 26 | a { color:#0074D9; text-decoration:none; } 27 | a:hover { text-decoration:underline; } 28 | .strong { font-weight: bold; } 29 | .space-top1 { padding: 10px 0 0 0; } 30 | .pad2y { padding: 20px 0; } 31 | .pad1y { padding: 10px 0; } 32 | .pad2x { padding: 0 20px; } 33 | .pad2 { padding: 20px; } 34 | .pad1 { padding: 10px; } 35 | .space-left2 { padding-left:55px; } 36 | .space-right2 { padding-right:20px; } 37 | .center { text-align:center; } 38 | .clearfix { display:block; } 39 | .clearfix:after { 40 | content:''; 41 | display:block; 42 | height:0; 43 | clear:both; 44 | visibility:hidden; 45 | } 46 | .fl { float: left; } 47 | @media only screen and (max-width:640px) { 48 | .col3 { width:100%; max-width:100%; } 49 | .hide-mobile { display:none!important; } 50 | } 51 | 52 | .quiet { 53 | color: #7f7f7f; 54 | color: rgba(0,0,0,0.5); 55 | } 56 | .quiet a { opacity: 0.7; } 57 | 58 | .fraction { 59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; 60 | font-size: 10px; 61 | color: #555; 62 | background: #E8E8E8; 63 | padding: 4px 5px; 64 | border-radius: 3px; 65 | vertical-align: middle; 66 | } 67 | 68 | div.path a:link, div.path a:visited { color: #333; } 69 | table.coverage { 70 | border-collapse: collapse; 71 | margin: 10px 0 0 0; 72 | padding: 0; 73 | } 74 | 75 | table.coverage td { 76 | margin: 0; 77 | padding: 0; 78 | vertical-align: top; 79 | } 80 | table.coverage td.line-count { 81 | text-align: right; 82 | padding: 0 5px 0 20px; 83 | } 84 | table.coverage td.line-coverage { 85 | text-align: right; 86 | padding-right: 10px; 87 | min-width:20px; 88 | } 89 | 90 | table.coverage td span.cline-any { 91 | display: inline-block; 92 | padding: 0 5px; 93 | width: 100%; 94 | } 95 | .missing-if-branch { 96 | display: inline-block; 97 | margin-right: 5px; 98 | border-radius: 3px; 99 | position: relative; 100 | padding: 0 4px; 101 | background: #333; 102 | color: yellow; 103 | } 104 | 105 | .skip-if-branch { 106 | display: none; 107 | margin-right: 10px; 108 | position: relative; 109 | padding: 0 4px; 110 | background: #ccc; 111 | color: white; 112 | } 113 | .missing-if-branch .typ, .skip-if-branch .typ { 114 | color: inherit !important; 115 | } 116 | .coverage-summary { 117 | border-collapse: collapse; 118 | width: 100%; 119 | } 120 | .coverage-summary tr { border-bottom: 1px solid #bbb; } 121 | .keyline-all { border: 1px solid #ddd; } 122 | .coverage-summary td, .coverage-summary th { padding: 10px; } 123 | .coverage-summary tbody { border: 1px solid #bbb; } 124 | .coverage-summary td { border-right: 1px solid #bbb; } 125 | .coverage-summary td:last-child { border-right: none; } 126 | .coverage-summary th { 127 | text-align: left; 128 | font-weight: normal; 129 | white-space: nowrap; 130 | } 131 | .coverage-summary th.file { border-right: none !important; } 132 | .coverage-summary th.pct { } 133 | .coverage-summary th.pic, 134 | .coverage-summary th.abs, 135 | .coverage-summary td.pct, 136 | .coverage-summary td.abs { text-align: right; } 137 | .coverage-summary td.file { white-space: nowrap; } 138 | .coverage-summary td.pic { min-width: 120px !important; } 139 | .coverage-summary tfoot td { } 140 | 141 | .coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | .coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | .coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | .status-line { height: 10px; } 155 | /* yellow */ 156 | .cbranch-no { background: yellow !important; color: #111; } 157 | /* dark red */ 158 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } 159 | .low .chart { border:1px solid #C21F39 } 160 | .highlighted, 161 | .highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ 162 | background: #C21F39 !important; 163 | } 164 | /* medium red */ 165 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } 166 | /* light red */ 167 | .low, .cline-no { background:#FCE1E5 } 168 | /* light green */ 169 | .high, .cline-yes { background:rgb(230,245,208) } 170 | /* medium green */ 171 | .cstat-yes { background:rgb(161,215,106) } 172 | /* dark green */ 173 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) } 174 | .high .chart { border:1px solid rgb(77,146,33) } 175 | /* dark yellow (gold) */ 176 | .status-line.medium, .medium .cover-fill { background: #f9cd0b; } 177 | .medium .chart { border:1px solid #f9cd0b; } 178 | /* light yellow */ 179 | .medium { background: #fff4c2; } 180 | 181 | .cstat-skip { background: #ddd; color: #111; } 182 | .fstat-skip { background: #ddd; color: #111 !important; } 183 | .cbranch-skip { background: #ddd !important; color: #111; } 184 | 185 | span.cline-neutral { background: #eaeaea; } 186 | 187 | .coverage-summary td.empty { 188 | opacity: .5; 189 | padding-top: 4px; 190 | padding-bottom: 4px; 191 | line-height: 1; 192 | color: #888; 193 | } 194 | 195 | .cover-fill, .cover-empty { 196 | display:inline-block; 197 | height: 12px; 198 | } 199 | .chart { 200 | line-height: 0; 201 | } 202 | .cover-empty { 203 | background: white; 204 | } 205 | .cover-full { 206 | border-right: none !important; 207 | } 208 | pre.prettyprint { 209 | border: none !important; 210 | padding: 0 !important; 211 | margin: 0 !important; 212 | } 213 | .com { color: #999 !important; } 214 | .ignore-none { color: #999; font-weight: normal; } 215 | 216 | .wrapper { 217 | min-height: 100%; 218 | height: auto !important; 219 | height: 100%; 220 | margin: 0 auto -48px; 221 | } 222 | .footer, .push { 223 | height: 48px; 224 | } 225 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/block-navigation.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | var jumpToCode = (function init() { 3 | // Classes of code we would like to highlight in the file view 4 | var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; 5 | 6 | // Elements to highlight in the file listing view 7 | var fileListingElements = ['td.pct.low']; 8 | 9 | // We don't want to select elements that are direct descendants of another match 10 | var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` 11 | 12 | // Selecter that finds elements on the page to which we can jump 13 | var selector = 14 | fileListingElements.join(', ') + 15 | ', ' + 16 | notSelector + 17 | missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` 18 | 19 | // The NodeList of matching elements 20 | var missingCoverageElements = document.querySelectorAll(selector); 21 | 22 | var currentIndex; 23 | 24 | function toggleClass(index) { 25 | missingCoverageElements 26 | .item(currentIndex) 27 | .classList.remove('highlighted'); 28 | missingCoverageElements.item(index).classList.add('highlighted'); 29 | } 30 | 31 | function makeCurrent(index) { 32 | toggleClass(index); 33 | currentIndex = index; 34 | missingCoverageElements.item(index).scrollIntoView({ 35 | behavior: 'smooth', 36 | block: 'center', 37 | inline: 'center' 38 | }); 39 | } 40 | 41 | function goToPrevious() { 42 | var nextIndex = 0; 43 | if (typeof currentIndex !== 'number' || currentIndex === 0) { 44 | nextIndex = missingCoverageElements.length - 1; 45 | } else if (missingCoverageElements.length > 1) { 46 | nextIndex = currentIndex - 1; 47 | } 48 | 49 | makeCurrent(nextIndex); 50 | } 51 | 52 | function goToNext() { 53 | var nextIndex = 0; 54 | 55 | if ( 56 | typeof currentIndex === 'number' && 57 | currentIndex < missingCoverageElements.length - 1 58 | ) { 59 | nextIndex = currentIndex + 1; 60 | } 61 | 62 | makeCurrent(nextIndex); 63 | } 64 | 65 | return function jump(event) { 66 | switch (event.which) { 67 | case 78: // n 68 | case 74: // j 69 | goToNext(); 70 | break; 71 | case 66: // b 72 | case 75: // k 73 | case 80: // p 74 | goToPrevious(); 75 | break; 76 | } 77 | }; 78 | })(); 79 | window.addEventListener('keydown', jumpToCode); 80 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for All files 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files 20 |

21 |
22 |
23 | 45.45% 24 | Statements 25 | 25/55 26 |
27 |
28 | 28.57% 29 | Branches 30 | 4/14 31 |
32 |
33 | 32.26% 34 | Functions 35 | 10/31 36 |
37 |
38 | 43.14% 39 | Lines 40 | 22/51 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
FileStatementsBranchesFunctionsLines
vue-h5-template
55.56%5/933.33%2/6100%1/155.56%5/9
vue-h5-template/src/api
75%3/4100%0/050%1/2100%2/2
vue-h5-template/src/utils
40.48%17/4225%2/828.57%8/2837.5%15/40
105 |
106 |
107 | 111 | 112 | 113 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/math.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for math.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files math.js 20 |

21 |
22 |
23 | 100% 24 | Statements 25 | 4/4 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 100% 34 | Functions 35 | 2/2 36 |
37 |
38 | 100% 39 | Lines 40 | 2/2 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |

49 | 
59 | 
1 50 | 2 51 | 3 52 | 41x 53 |   54 | 1x 55 |  
export const add = (a, b) => a + b
56 |  
57 | export const min = (a, b) => a - b
58 |  
60 |
61 |
62 | 66 | 67 | 68 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/prettify.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suoyuesmile/vue-mobile-components/cc0d150fd4063d231fb4aab46dbb7b51288c450d/src/tests/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/sorter.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | var addSorting = (function() { 3 | 'use strict'; 4 | var cols, 5 | currentSort = { 6 | index: 0, 7 | desc: false 8 | }; 9 | 10 | // returns the summary table element 11 | function getTable() { 12 | return document.querySelector('.coverage-summary'); 13 | } 14 | // returns the thead element of the summary table 15 | function getTableHeader() { 16 | return getTable().querySelector('thead tr'); 17 | } 18 | // returns the tbody element of the summary table 19 | function getTableBody() { 20 | return getTable().querySelector('tbody'); 21 | } 22 | // returns the th element for nth column 23 | function getNthColumn(n) { 24 | return getTableHeader().querySelectorAll('th')[n]; 25 | } 26 | 27 | // loads all columns 28 | function loadColumns() { 29 | var colNodes = getTableHeader().querySelectorAll('th'), 30 | colNode, 31 | cols = [], 32 | col, 33 | i; 34 | 35 | for (i = 0; i < colNodes.length; i += 1) { 36 | colNode = colNodes[i]; 37 | col = { 38 | key: colNode.getAttribute('data-col'), 39 | sortable: !colNode.getAttribute('data-nosort'), 40 | type: colNode.getAttribute('data-type') || 'string' 41 | }; 42 | cols.push(col); 43 | if (col.sortable) { 44 | col.defaultDescSort = col.type === 'number'; 45 | colNode.innerHTML = 46 | colNode.innerHTML + ''; 47 | } 48 | } 49 | return cols; 50 | } 51 | // attaches a data attribute to every tr element with an object 52 | // of data values keyed by column name 53 | function loadRowData(tableRow) { 54 | var tableCols = tableRow.querySelectorAll('td'), 55 | colNode, 56 | col, 57 | data = {}, 58 | i, 59 | val; 60 | for (i = 0; i < tableCols.length; i += 1) { 61 | colNode = tableCols[i]; 62 | col = cols[i]; 63 | val = colNode.getAttribute('data-value'); 64 | if (col.type === 'number') { 65 | val = Number(val); 66 | } 67 | data[col.key] = val; 68 | } 69 | return data; 70 | } 71 | // loads all row data 72 | function loadData() { 73 | var rows = getTableBody().querySelectorAll('tr'), 74 | i; 75 | 76 | for (i = 0; i < rows.length; i += 1) { 77 | rows[i].data = loadRowData(rows[i]); 78 | } 79 | } 80 | // sorts the table using the data for the ith column 81 | function sortByIndex(index, desc) { 82 | var key = cols[index].key, 83 | sorter = function(a, b) { 84 | a = a.data[key]; 85 | b = b.data[key]; 86 | return a < b ? -1 : a > b ? 1 : 0; 87 | }, 88 | finalSorter = sorter, 89 | tableBody = document.querySelector('.coverage-summary tbody'), 90 | rowNodes = tableBody.querySelectorAll('tr'), 91 | rows = [], 92 | i; 93 | 94 | if (desc) { 95 | finalSorter = function(a, b) { 96 | return -1 * sorter(a, b); 97 | }; 98 | } 99 | 100 | for (i = 0; i < rowNodes.length; i += 1) { 101 | rows.push(rowNodes[i]); 102 | tableBody.removeChild(rowNodes[i]); 103 | } 104 | 105 | rows.sort(finalSorter); 106 | 107 | for (i = 0; i < rows.length; i += 1) { 108 | tableBody.appendChild(rows[i]); 109 | } 110 | } 111 | // removes sort indicators for current column being sorted 112 | function removeSortIndicators() { 113 | var col = getNthColumn(currentSort.index), 114 | cls = col.className; 115 | 116 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 117 | col.className = cls; 118 | } 119 | // adds sort indicators for current column being sorted 120 | function addSortIndicators() { 121 | getNthColumn(currentSort.index).className += currentSort.desc 122 | ? ' sorted-desc' 123 | : ' sorted'; 124 | } 125 | // adds event listeners for all sorter widgets 126 | function enableUI() { 127 | var i, 128 | el, 129 | ithSorter = function ithSorter(i) { 130 | var col = cols[i]; 131 | 132 | return function() { 133 | var desc = col.defaultDescSort; 134 | 135 | if (currentSort.index === i) { 136 | desc = !currentSort.desc; 137 | } 138 | sortByIndex(i, desc); 139 | removeSortIndicators(); 140 | currentSort.index = i; 141 | currentSort.desc = desc; 142 | addSortIndicators(); 143 | }; 144 | }; 145 | for (i = 0; i < cols.length; i += 1) { 146 | if (cols[i].sortable) { 147 | // add the click event handler on the th so users 148 | // dont have to click on those tiny arrows 149 | el = getNthColumn(i).querySelector('.sorter').parentElement; 150 | if (el.addEventListener) { 151 | el.addEventListener('click', ithSorter(i)); 152 | } else { 153 | el.attachEvent('onclick', ithSorter(i)); 154 | } 155 | } 156 | } 157 | } 158 | // adds sorting functionality to the UI 159 | return function() { 160 | if (!getTable()) { 161 | return; 162 | } 163 | cols = loadColumns(); 164 | loadData(); 165 | addSortIndicators(); 166 | enableUI(); 167 | }; 168 | })(); 169 | 170 | window.addEventListener('load', addSorting); 171 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/.env.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/.env.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / vue-h5-template .env.js 20 |

21 |
22 |
23 | 55.56% 24 | Statements 25 | 5/9 26 |
27 |
28 | 33.33% 29 | Branches 30 | 2/6 31 |
32 |
33 | 100% 34 | Functions 35 | 1/1 36 |
37 |
38 | 55.56% 39 | Lines 40 | 5/9 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |

 49 | 
107 | 
1 50 | 2 51 | 3 52 | 4 53 | 5 54 | 6 55 | 7 56 | 8 57 | 9 58 | 10 59 | 11 60 | 12 61 | 13 62 | 14 63 | 15 64 | 16 65 | 17 66 | 18 67 | 19 68 | 20  69 | 1x 70 |   71 |   72 |   73 |   74 |   75 |   76 | 1x 77 | 1x 78 |   79 | 1x 80 | 1x 81 |   82 |   83 |   84 |   85 |   86 |   87 |  
// 不同环境访问不同的路径
 88 | const api = {
 89 |   dev: '',
 90 |   mock: 'http://rest.apizza.net/mock/779766c36ecc0737b94deafee204a88e',
 91 |   test: 'http://rest.apizza.net/mock/779766c36ecc0737b94deafee204a88e',
 92 |   prod: ''
 93 | }
 94 |  
 95 | export const baseURL = () => {
 96 |   Iif (process.env.NODE_ENV === 'production') {
 97 |     return api.prod
 98 |   } else Eif (process.env.NODE_ENV === 'testing') {
 99 |     return api.test
100 |   } else if (process.env.NODE_ENV === 'mock') {
101 |     return api.mock
102 |   } else {
103 |     return api.dev
104 |   }
105 | }
106 |  
108 |
109 |
110 | 114 | 115 | 116 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files vue-h5-template 20 |

21 |
22 |
23 | 55.56% 24 | Statements 25 | 5/9 26 |
27 |
28 | 33.33% 29 | Branches 30 | 2/6 31 |
32 |
33 | 100% 34 | Functions 35 | 1/1 36 |
37 |
38 | 55.56% 39 | Lines 40 | 5/9 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
FileStatementsBranchesFunctionsLines
.env.js
55.56%5/933.33%2/6100%1/155.56%5/9
79 |
80 |
81 | 85 | 86 | 87 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/src/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/src/api 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files vue-h5-template/src/api 20 |

21 |
22 |
23 | 75% 24 | Statements 25 | 3/4 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 50% 34 | Functions 35 | 1/2 36 |
37 |
38 | 100% 39 | Lines 40 | 2/2 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
FileStatementsBranchesFunctionsLines
user.js
75%3/4100%0/050%1/2100%2/2
79 |
80 |
81 | 85 | 86 | 87 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/src/api/user.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/src/api/user.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / vue-h5-template/src/api user.js 20 |

21 |
22 |
23 | 75% 24 | Statements 25 | 3/4 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 50% 34 | Functions 35 | 1/2 36 |
37 |
38 | 100% 39 | Lines 40 | 2/2 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |

49 | 
71 | 
1 50 | 2 51 | 3 52 | 4 53 | 5 54 | 6 55 | 7 56 | 8  57 |   58 |   59 | 1x 60 |   61 |   62 | 1x 63 |  
import { fetch, post } from '@/utils/http'
64 |  
65 | // 用户登陆
66 | export const login = (data) => post('/user/login', data)
67 |  
68 | // 获取用户信息
69 | export const getUserInfo = (data) => fetch('/api/user/info', data)
70 |  
72 |
73 |
74 | 78 | 79 | 80 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/src/utils/http.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/src/utils/http.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / vue-h5-template/src/utils http.js 20 |

21 |
22 |
23 | 34.21% 24 | Statements 25 | 13/38 26 |
27 |
28 | 25% 29 | Branches 30 | 2/8 31 |
32 |
33 | 23.08% 34 | Functions 35 | 6/26 36 |
37 |
38 | 34.21% 39 | Lines 40 | 13/38 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |

 49 | 
497 | 
1 50 | 2 51 | 3 52 | 4 53 | 5 54 | 6 55 | 7 56 | 8 57 | 9 58 | 10 59 | 11 60 | 12 61 | 13 62 | 14 63 | 15 64 | 16 65 | 17 66 | 18 67 | 19 68 | 20 69 | 21 70 | 22 71 | 23 72 | 24 73 | 25 74 | 26 75 | 27 76 | 28 77 | 29 78 | 30 79 | 31 80 | 32 81 | 33 82 | 34 83 | 35 84 | 36 85 | 37 86 | 38 87 | 39 88 | 40 89 | 41 90 | 42 91 | 43 92 | 44 93 | 45 94 | 46 95 | 47 96 | 48 97 | 49 98 | 50 99 | 51 100 | 52 101 | 53 102 | 54 103 | 55 104 | 56 105 | 57 106 | 58 107 | 59 108 | 60 109 | 61 110 | 62 111 | 63 112 | 64 113 | 65 114 | 66 115 | 67 116 | 68 117 | 69 118 | 70 119 | 71 120 | 72 121 | 73 122 | 74 123 | 75 124 | 76 125 | 77 126 | 78 127 | 79 128 | 80 129 | 81 130 | 82 131 | 83 132 | 84 133 | 85 134 | 86 135 | 87 136 | 88 137 | 89 138 | 90 139 | 91 140 | 92 141 | 93 142 | 94 143 | 95 144 | 96 145 | 97 146 | 98 147 | 99 148 | 100 149 | 101 150 | 102 151 | 103 152 | 104 153 | 105 154 | 106 155 | 107 156 | 108 157 | 109 158 | 110 159 | 111 160 | 112 161 | 113 162 | 114 163 | 115 164 | 116 165 | 117 166 | 118 167 | 119 168 | 120 169 | 121 170 | 122 171 | 123 172 | 124 173 | 125 174 | 126 175 | 127 176 | 128 177 | 129 178 | 130 179 | 131 180 | 132 181 | 133 182 | 134 183 | 135 184 | 136 185 | 137 186 | 138 187 | 139 188 | 140 189 | 141 190 | 142 191 | 143 192 | 144 193 | 145 194 | 146 195 | 147 196 | 148 197 | 149 198 | 150  199 |   200 |   201 |   202 |   203 | 1x 204 | 1x 205 | 1x 206 |   207 |   208 | 1x 209 |   210 |   211 | 1x 212 |   213 |   214 | 1x 215 |   216 |   217 |   218 |   219 |   220 |   221 |   222 | 1x 223 |   224 | 1x 225 |   226 |   227 |   228 |   229 |   230 |   231 |   232 |   233 |   234 |   235 |   236 |   237 |   238 |   239 |   240 |   241 |   242 |   243 |   244 |   245 |   246 |   247 |   248 |   249 |   250 |   251 |   252 |   253 |   254 |   255 |   256 |   257 |   258 |   259 |   260 |   261 |   262 |   263 |   264 |   265 |   266 |   267 |   268 |   269 | 1x 270 | 1x 271 |   272 |   273 |   274 |   275 | 1x 276 | 1x 277 |   278 | 1x 279 |   280 |   281 |   282 |   283 |   284 |   285 |   286 |   287 |   288 |   289 |   290 |   291 |   292 |   293 |   294 |   295 |   296 |   297 |   298 |   299 |   300 |   301 |   302 |   303 |   304 |   305 |   306 |   307 |   308 |   309 |   310 |   311 |   312 |   313 |   314 |   315 |   316 |   317 |   318 |   319 |   320 |   321 |   322 |   323 |   324 |   325 |   326 |   327 |   328 |   329 |   330 |   331 |   332 |   333 |   334 |   335 |   336 |   337 |   338 |   339 |   340 |   341 |   342 |   343 |   344 |   345 |   346 |   347 |  
import axios from 'axios'
348 | import { baseURL } from '../../.env.js'
349 | // import { getToken, removeToken, ssoLogin } from './sso'
350 |  
351 | // axios 配置
352 | const defaultBaseUrl = 'http://rest.apizza.net/mock/779766c36ecc0737b94deafee204a88e'
353 | axios.defaults.timeout = 15000
354 | axios.defaults.baseURL = baseURL() || defaultBaseUrl // 数据接口域名统一配置.env
355 |  
356 | // http request 拦截器
357 | axios.interceptors.request.use(
358 |   (config) => {
359 |     // const token = getToken()
360 |     config.headers = {
361 |       // Authorization: token
362 |     }
363 |     return config
364 |   },
365 |   (err) => {
366 |     return Promise.reject(err)
367 |   }
368 | )
369 |  
370 | // http response 拦截器
371 | axios.interceptors.response.use(
372 |   (response) => {
373 |     return response
374 |   },
375 |   (error) => {
376 |     const data = error.response.data
377 |     // if (error.response.status === 403 && data && data.code === 1) {
378 |     //   removeToken()
379 |     //   ssoLogin()
380 |     // }
381 |     return Promise.reject(data || error)
382 |   }
383 | )
384 |  
385 | export default axios
386 |  
387 | /**
388 |  * fetch 请求方法
389 |  * @param {*} url
390 |  * @param {*} params
391 |  */
392 | export function fetch (url, params = {}) {
393 |   return new Promise((resolve, reject) => {
394 |     axios
395 |       .get(url, {
396 |         params: params
397 |       })
398 |       .then((response) => {
399 |         resolve(response.data)
400 |       })
401 |       .catch((err) => {
402 |         reject(err)
403 |       })
404 |   })
405 | }
406 |  
407 | /**
408 |  * post 请求方法,发送数据格式 json
409 |  * @param {*} url
410 |  * @param {*} data
411 |  */
412 | export function post (
413 |   url,
414 |   data = {},
415 |   config = {
416 |     transformRequest: [
417 |       function (fData, headers) {
418 |         headers['Content-Type'] = 'application/json'
419 |         return JSON.stringify(fData)
420 |       }
421 |     ]
422 |   }
423 | ) {
424 |   return new Promise((resolve, reject) => {
425 |     axios.post(url, data, config).then(
426 |       (response) => {
427 |         resolve(response.data)
428 |       },
429 |       (err) => {
430 |         reject(err)
431 |       }
432 |     )
433 |   })
434 | }
435 |  
436 | /**
437 |  * patch 请求方法,发送数据格式 json
438 |  * @param {*} url
439 |  * @param {*} data
440 |  */
441 | export function patch (url, data = {}) {
442 |   return new Promise((resolve, reject) => {
443 |     axios
444 |       .patch(url, data, {
445 |         transformRequest: [
446 |           function (fData, headers) {
447 |             headers['Content-Type'] = 'application/json'
448 |             return JSON.stringify(fData)
449 |           }
450 |         ]
451 |       })
452 |       .then(
453 |         (response) => {
454 |           resolve(response.data)
455 |         },
456 |         (err) => {
457 |           reject(err)
458 |         }
459 |       )
460 |   })
461 | }
462 |  
463 | export function del (url, data) {
464 |   return new Promise((resolve, reject) => {
465 |     axios.delete(url, { data }).then(
466 |       (response) => {
467 |         resolve(response.data)
468 |       },
469 |       (err) => {
470 |         reject(err)
471 |       }
472 |     )
473 |   })
474 | }
475 |  
476 | // 上传图片
477 | export function postImage (url, data) {
478 |   return new Promise((resolve, reject) => {
479 |     const formData = new FormData()
480 |     const config = {
481 |       headers: {
482 |         'Content-Type': 'multipart/form-data'
483 |       }
484 |     }
485 |     formData.append('file', data)
486 |     axios.post(url, formData, config).then(
487 |       (response) => {
488 |         resolve(response.data)
489 |       },
490 |       (err) => {
491 |         reject(err)
492 |       }
493 |     )
494 |   })
495 | }
496 |  
498 |
499 |
500 | 504 | 505 | 506 | 513 | 514 | 515 | 516 | 517 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/src/utils/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/src/utils 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files vue-h5-template/src/utils 20 |

21 |
22 |
23 | 40.48% 24 | Statements 25 | 17/42 26 |
27 |
28 | 25% 29 | Branches 30 | 2/8 31 |
32 |
33 | 28.57% 34 | Functions 35 | 8/28 36 |
37 |
38 | 37.5% 39 | Lines 40 | 15/40 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
FileStatementsBranchesFunctionsLines
http.js
34.21%13/3825%2/823.08%6/2634.21%13/38
math.js
100%4/4100%0/0100%2/2100%2/2
92 |
93 |
94 | 98 | 99 | 100 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov-report/vue-h5-template/src/utils/math.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for vue-h5-template/src/utils/math.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / vue-h5-template/src/utils math.js 20 |

21 |
22 |
23 | 100% 24 | Statements 25 | 4/4 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 100% 34 | Functions 35 | 2/2 36 |
37 |
38 | 100% 39 | Lines 40 | 2/2 41 |
42 |
43 |

44 | Press n or j to go to the next uncovered block, b, p or k for the previous block. 45 |

46 |
47 |
48 |

49 | 
59 | 
1 50 | 2 51 | 3 52 | 41x 53 |   54 | 1x 55 |  
export const add = (a, b) => a + b
56 |  
57 | export const min = (a, b) => a - b
58 |  
60 |
61 |
62 | 66 | 67 | 68 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/tests/coverage/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:/Users/suosmile/www/project/vue-h5-template/.env.js 3 | FN:9,(anonymous_0) 4 | FNF:1 5 | FNH:1 6 | FNDA:1,(anonymous_0) 7 | DA:2,1 8 | DA:9,1 9 | DA:10,1 10 | DA:11,0 11 | DA:12,1 12 | DA:13,1 13 | DA:14,0 14 | DA:15,0 15 | DA:17,0 16 | LF:9 17 | LH:5 18 | BRDA:10,0,0,0 19 | BRDA:10,0,1,1 20 | BRDA:12,1,0,1 21 | BRDA:12,1,1,0 22 | BRDA:14,2,0,0 23 | BRDA:14,2,1,0 24 | BRF:6 25 | BRH:2 26 | end_of_record 27 | TN: 28 | SF:/Users/suosmile/www/project/vue-h5-template/src/api/user.js 29 | FN:4,(anonymous_0) 30 | FN:7,(anonymous_1) 31 | FNF:2 32 | FNH:1 33 | FNDA:1,(anonymous_0) 34 | FNDA:0,(anonymous_1) 35 | DA:4,1 36 | DA:7,1 37 | LF:2 38 | LH:2 39 | BRF:0 40 | BRH:0 41 | end_of_record 42 | TN: 43 | SF:/Users/suosmile/www/project/vue-h5-template/src/utils/http.js 44 | FN:12,(anonymous_0) 45 | FN:19,(anonymous_1) 46 | FN:26,(anonymous_2) 47 | FN:29,(anonymous_3) 48 | FN:46,fetch 49 | FN:47,(anonymous_5) 50 | FN:52,(anonymous_6) 51 | FN:55,(anonymous_7) 52 | FN:66,post 53 | FN:71,(anonymous_9) 54 | FN:78,(anonymous_10) 55 | FN:80,(anonymous_11) 56 | FN:83,(anonymous_12) 57 | FN:95,patch 58 | FN:96,(anonymous_14) 59 | FN:100,(anonymous_15) 60 | FN:107,(anonymous_16) 61 | FN:110,(anonymous_17) 62 | FN:117,del 63 | FN:118,(anonymous_19) 64 | FN:120,(anonymous_20) 65 | FN:123,(anonymous_21) 66 | FN:131,postImage 67 | FN:132,(anonymous_23) 68 | FN:141,(anonymous_24) 69 | FN:144,(anonymous_25) 70 | FNF:26 71 | FNH:6 72 | FNDA:1,(anonymous_0) 73 | FNDA:0,(anonymous_1) 74 | FNDA:1,(anonymous_2) 75 | FNDA:0,(anonymous_3) 76 | FNDA:0,fetch 77 | FNDA:0,(anonymous_5) 78 | FNDA:0,(anonymous_6) 79 | FNDA:0,(anonymous_7) 80 | FNDA:1,post 81 | FNDA:1,(anonymous_9) 82 | FNDA:1,(anonymous_10) 83 | FNDA:1,(anonymous_11) 84 | FNDA:0,(anonymous_12) 85 | FNDA:0,patch 86 | FNDA:0,(anonymous_14) 87 | FNDA:0,(anonymous_15) 88 | FNDA:0,(anonymous_16) 89 | FNDA:0,(anonymous_17) 90 | FNDA:0,del 91 | FNDA:0,(anonymous_19) 92 | FNDA:0,(anonymous_20) 93 | FNDA:0,(anonymous_21) 94 | FNDA:0,postImage 95 | FNDA:0,(anonymous_23) 96 | FNDA:0,(anonymous_24) 97 | FNDA:0,(anonymous_25) 98 | DA:6,1 99 | DA:7,1 100 | DA:8,1 101 | DA:11,1 102 | DA:14,1 103 | DA:17,1 104 | DA:20,0 105 | DA:25,1 106 | DA:27,1 107 | DA:30,0 108 | DA:35,0 109 | DA:47,0 110 | DA:48,0 111 | DA:53,0 112 | DA:56,0 113 | DA:72,1 114 | DA:73,1 115 | DA:78,1 116 | DA:79,1 117 | DA:81,1 118 | DA:84,0 119 | DA:96,0 120 | DA:97,0 121 | DA:101,0 122 | DA:102,0 123 | DA:108,0 124 | DA:111,0 125 | DA:118,0 126 | DA:119,0 127 | DA:121,0 128 | DA:124,0 129 | DA:132,0 130 | DA:133,0 131 | DA:134,0 132 | DA:139,0 133 | DA:140,0 134 | DA:142,0 135 | DA:145,0 136 | LF:38 137 | LH:13 138 | BRDA:8,0,0,1 139 | BRDA:8,0,1,0 140 | BRDA:35,1,0,0 141 | BRDA:35,1,1,0 142 | BRDA:46,2,0,0 143 | BRDA:68,3,0,0 144 | BRDA:69,4,0,1 145 | BRDA:95,5,0,0 146 | BRF:8 147 | BRH:2 148 | end_of_record 149 | TN: 150 | SF:/Users/suosmile/www/project/vue-h5-template/src/utils/math.js 151 | FN:1,(anonymous_0) 152 | FN:3,(anonymous_1) 153 | FNF:2 154 | FNH:2 155 | FNDA:1,(anonymous_0) 156 | FNDA:1,(anonymous_1) 157 | DA:1,1 158 | DA:3,1 159 | LF:2 160 | LH:2 161 | BRF:0 162 | BRH:0 163 | end_of_record 164 | -------------------------------------------------------------------------------- /src/tests/demo/config.js: -------------------------------------------------------------------------------- 1 | export const genConfig = () => { 2 | return { 3 | port: 80, 4 | target: 'www.test-api.com', 5 | time: new Date() 6 | } 7 | } 8 | 9 | export const genConfig2 = () => { 10 | return { 11 | port: 80, 12 | target: 'www.test-api.com', 13 | time: '2019' 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/tests/demo/math.js: -------------------------------------------------------------------------------- 1 | export const add = (a, b) => a + b 2 | 3 | export const min = (a, b) => a - b 4 | -------------------------------------------------------------------------------- /src/tests/demo/run.js: -------------------------------------------------------------------------------- 1 | export const runCallback = (callback) => { 2 | callback() 3 | } 4 | -------------------------------------------------------------------------------- /src/tests/unit/api/__mocks__/mock.js: -------------------------------------------------------------------------------- 1 | export const login = () => { 2 | return new Promise((resolve, reject) => { 3 | resolve({ 4 | code: '0000', 5 | data: {} 6 | }) 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /src/tests/unit/components/helloworld.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import HelloWorld from '@/components/HelloWorld.vue' 3 | 4 | describe('HelloWorld.vue', () => { 5 | it('renders props.msg when passed', () => { 6 | const msg = 'new message' 7 | const wrapper = shallowMount(HelloWorld, { 8 | propsData: { msg } 9 | }) 10 | expect(wrapper.text()).toMatch(msg) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /src/tests/unit/utils/__snapshots__/snapshot.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`测试快照 测试config 1`] = ` 4 | Object { 5 | "port": 80, 6 | "target": "www.test-api.com", 7 | "time": Any, 8 | } 9 | `; 10 | 11 | exports[`测试快照 测试config2 1`] = ` 12 | Object { 13 | "port": 80, 14 | "target": "www.test-api.com", 15 | "time": "2019", 16 | } 17 | `; 18 | -------------------------------------------------------------------------------- /src/tests/unit/utils/math.spec.js: -------------------------------------------------------------------------------- 1 | import { add, min } from '../../demo/math' 2 | 3 | // beforeAll(() => { 4 | // console.log('beforeAll 1') 5 | // }) 6 | // beforeEach(() => { 7 | // console.log('beforeEach 1') 8 | // }) 9 | describe('测试math方法', () => { 10 | // beforeAll(() => { 11 | // console.log('beforeAll 2') 12 | // }) 13 | // beforeEach(() => { 14 | // console.log('beforeEach 2') 15 | // }) 16 | // toBe 17 | it('测试加法', () => { 18 | expect(add(1, 3)).toBe(4) 19 | }) 20 | 21 | it('测试减法', () => { 22 | expect(min(2, 1)).toBe(1) 23 | }) 24 | // toEqual 25 | it('测试内容', () => { 26 | expect('demo').toEqual('demo') 27 | }) 28 | // toBeNull 29 | it('测试是否为null', () => { 30 | expect(null).toBeNull() 31 | }) 32 | // toBeUndefined 33 | it('测试是否为undefined', () => { 34 | expect(undefined).toBeUndefined() 35 | }) 36 | // toBeTruthy 37 | it('测试是否为真', () => { 38 | expect(1).toBeTruthy() 39 | }) 40 | // toBeFalsy 41 | it('测试是否为假', () => { 42 | expect(0).toBeFalsy() 43 | expect(0).not.toBeTruthy() 44 | }) 45 | // toBeGreaterThen > 46 | it('测试大于', () => { 47 | expect(10).toBeGreaterThan(2) 48 | }) 49 | // toBeLessThan 50 | it('测试小于', () => { 51 | expect(3).toBeLessThan(5) 52 | }) 53 | // toBeGreaterThenOrEqual 54 | it('测试大于等于', () => { 55 | expect(2).toBeGreaterThanOrEqual(2) 56 | }) 57 | // toBeCloseTo 58 | it('测试相近', () => { 59 | // expect(0.1 + 0.2).toBe(0.3) 60 | expect(0.1 + 0.2).toBeCloseTo(0.3) 61 | }) 62 | // toMatch 63 | it('测试匹配', () => { 64 | expect('hello world').toMatch('hello') 65 | }) 66 | // toContain (set, array) 67 | it('测试包含', () => { 68 | expect([1, 2, 3]).toContain(1) 69 | }) 70 | // toThrow 71 | const throwNewErrorFunc = () => { 72 | throw new Error('123') 73 | } 74 | it('测试异常', () => { 75 | expect(throwNewErrorFunc).toThrow() 76 | }) 77 | }) 78 | -------------------------------------------------------------------------------- /src/tests/unit/utils/run.spec.js: -------------------------------------------------------------------------------- 1 | import { runCallback } from '../../demo/run' 2 | 3 | describe('mock', () => { 4 | it('测试函数是否运行', () => { 5 | const func = jest.fn() 6 | runCallback(func) 7 | runCallback(func) 8 | expect(func).toBeCalled() 9 | expect(func.mock.calls.length).toBe(2) 10 | // console.log(func.mock) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /src/tests/unit/utils/snapshot.spec.js: -------------------------------------------------------------------------------- 1 | import { genConfig, genConfig2 } from '../../demo/config' 2 | 3 | describe('测试快照', () => { 4 | it('测试config', () => { 5 | expect(genConfig()).toMatchSnapshot({ 6 | time: expect.any(Date) 7 | }) 8 | }) 9 | it('测试config2', () => { 10 | expect(genConfig2()).toMatchSnapshot() 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /src/utils/adapt.js: -------------------------------------------------------------------------------- 1 | const MAX_FONT_SIZE = 420 2 | 3 | // 定义最大的屏幕宽度 4 | document.addEventListener('DOMContentLoaded', () => { 5 | const html = document.querySelector('html') 6 | let fontSize = window.innerWidth / 10 7 | fontSize = fontSize > MAX_FONT_SIZE ? MAX_FONT_SIZE : fontSize 8 | html.style.fontSize = fontSize + 'px' 9 | }) 10 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | const autoprefixer = require('autoprefixer') 2 | const pxtorem = require('postcss-pxtorem') 3 | 4 | module.exports = { 5 | publicPath: '', 6 | outputDir: 'dist', 7 | assetsDir: 'static', 8 | filenameHashing: true, 9 | lintOnSave: true, 10 | runtimeCompiler: false, 11 | transpileDependencies: [/\/node_modules\/vue-echarts\//, /\/node_modules\/resize-detector\//], 12 | productionSourceMap: false, 13 | chainWebpack: (config) => { 14 | config.module 15 | .rule('pug') 16 | .test(/\.pug$/) 17 | .use('pug-html-loader') 18 | .loader('pug-html-loader') 19 | .end() 20 | }, 21 | css: { 22 | sourceMap: true, 23 | loaderOptions: { 24 | postcss: { 25 | plugins: [ 26 | autoprefixer(), 27 | pxtorem({ 28 | rootValue: 37.5, 29 | propList: ['*'] 30 | }) 31 | ] 32 | } 33 | } 34 | } 35 | } 36 | --------------------------------------------------------------------------------