├── public ├── robots.txt ├── favicon.ico ├── img │ └── icons │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── mstile-150x150.png │ │ ├── apple-touch-icon.png │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon-120x120.png │ │ ├── apple-touch-icon-152x152.png │ │ ├── apple-touch-icon-180x180.png │ │ ├── apple-touch-icon-60x60.png │ │ ├── apple-touch-icon-76x76.png │ │ ├── msapplication-icon-144x144.png │ │ ├── android-chrome-maskable-192x192.png │ │ ├── android-chrome-maskable-512x512.png │ │ └── safari-pinned-tab.svg └── index.html ├── .browserslistrc ├── .eslintignore ├── tests └── unit │ ├── .eslintrc │ ├── setup.js │ ├── specs │ ├── setup.js │ ├── Data.spec.js │ ├── Init.spec.js │ └── Props.spec.js │ ├── coverage │ ├── lcov-report │ │ ├── sort-arrow-sprite.png │ │ ├── prettify.css │ │ ├── index.html │ │ ├── sorter.js │ │ ├── base.css │ │ ├── index.js.html │ │ ├── helper.js.html │ │ └── prettify.js │ ├── lcov.info │ └── clover.xml │ └── jest.conf.js ├── babel.config.js ├── example ├── assets │ └── logo.png ├── views │ ├── AboutView.vue │ └── HomeView.vue ├── store │ └── index.js ├── App.vue ├── router │ └── index.js ├── registerServiceWorker.js ├── main.js ├── components │ ├── HelloWorld.vue │ ├── Page1.vue │ ├── Page2.vue │ ├── Page3.vue │ └── Home.vue └── countrycode.json ├── .editorconfig ├── jest.config.js ├── .npmignore ├── vue.config.js ├── jsconfig.json ├── .gitignore ├── .github └── workflows │ ├── test-and-build.yml │ └── release.yml ├── .eslintrc.js ├── LICENSE.md ├── src ├── index.js └── helper.js ├── package.json ├── CODE_OF_CONDUCT.md └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /tests/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /example/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/example/assets/logo.png -------------------------------------------------------------------------------- /example/views/AboutView.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /public/img/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/favicon-16x16.png -------------------------------------------------------------------------------- /public/img/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/favicon-32x32.png -------------------------------------------------------------------------------- /public/img/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/mstile-150x150.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /tests/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuetify from 'vuetify'; 3 | 4 | Vue.use(Vuetify); 5 | 6 | Vue.config.productionTip = false; 7 | -------------------------------------------------------------------------------- /tests/unit/specs/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuetify from 'vuetify'; 3 | 4 | Vue.use(Vuetify); 5 | 6 | Vue.config.productionTip = false; 7 | -------------------------------------------------------------------------------- /public/img/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /public/img/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-maskable-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/android-chrome-maskable-192x192.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-maskable-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/public/img/icons/android-chrome-maskable-512x512.png -------------------------------------------------------------------------------- /tests/unit/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MadimetjaShika/vuetify-google-autocomplete/HEAD/tests/unit/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | end_of_line = lf 5 | trim_trailing_whitespace = true 6 | insert_final_newline = true 7 | max_line_length = 130 8 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: '@vue/cli-plugin-unit-jest', 3 | testEnvironment: 'jsdom', 4 | transformIgnorePatterns: [ 5 | '/node_modules/(?!vuetify)/lib/' 6 | ], 7 | }; 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .eslintignore 3 | .eslintrc.js 4 | .travis.yml 5 | CODE_OF_CONDUCT.md 6 | mix-manifest.json 7 | webpack.config.js 8 | webpack.mix.js 9 | test/ 10 | .github/ 11 | example/ 12 | node_modules/ 13 | src/ 14 | dist/*.html 15 | -------------------------------------------------------------------------------- /public/img/icons/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('@vue/cli-service'); 2 | 3 | module.exports = defineConfig({ 4 | configureWebpack: { 5 | output: { 6 | libraryExport: 'default', 7 | }, 8 | }, 9 | runtimeCompiler: true, 10 | transpileDependencies: true, 11 | }); 12 | -------------------------------------------------------------------------------- /example/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | getters: { 10 | }, 11 | mutations: { 12 | }, 13 | actions: { 14 | }, 15 | modules: { 16 | }, 17 | }); 18 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "esnext", 5 | "baseUrl": "./", 6 | "moduleResolution": "node", 7 | "paths": { 8 | "@/*": [ 9 | "src/*" 10 | ] 11 | }, 12 | "lib": [ 13 | "esnext", 14 | "dom", 15 | "dom.iterable", 16 | "scripthost" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /example/views/HomeView.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | /example-dist 5 | 6 | /tests/e2e/reports/ 7 | selenium-debug.log 8 | chromedriver.log 9 | geckodriver.log 10 | 11 | # local env files 12 | .env.local 13 | .env.*.local 14 | 15 | # Log files 16 | npm-debug.log* 17 | yarn-debug.log* 18 | yarn-error.log* 19 | pnpm-debug.log* 20 | 21 | # Editor directories and files 22 | .idea 23 | .vscode 24 | *.suo 25 | *.ntvs* 26 | *.njsproj 27 | *.sln 28 | *.sw? 29 | -------------------------------------------------------------------------------- /example/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 19 | 20 | 30 | -------------------------------------------------------------------------------- /.github/workflows/test-and-build.yml: -------------------------------------------------------------------------------- 1 | name: Test and build code 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - dev 7 | workflow_dispatch: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | # Setup .npmrc file to publish to npm 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: '16.x' 18 | registry-url: 'https://registry.npmjs.org' 19 | - run: npm ci 20 | - run: npm run test:unit 21 | - run: npm run build:lib 22 | - run: npm run build:example 23 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Publish Package to npmjs 2 | on: 3 | release: 4 | types: [created] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | # Setup .npmrc file to publish to npm 13 | - uses: actions/setup-node@v3 14 | with: 15 | node-version: '16.x' 16 | registry-url: 'https://registry.npmjs.org' 17 | - run: npm ci 18 | - run: npm run test:unit 19 | - run: npm run build:lib 20 | - run: npm publish 21 | env: 22 | NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} 23 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/unit/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 | -------------------------------------------------------------------------------- /example/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | import Home from '../components/Home'; 4 | import Page1 from '../components/Page1'; 5 | import Page2 from '../components/Page2'; 6 | import Page3 from '../components/Page3'; 7 | 8 | Vue.use(Router); 9 | 10 | export default new Router({ 11 | mode: 'history', 12 | routes: [ 13 | { 14 | path: '/', 15 | name: 'home', 16 | component: Home, 17 | }, 18 | { 19 | path: '/page-1', 20 | name: 'page1', 21 | component: Page1, 22 | }, 23 | { 24 | path: '/page-2', 25 | name: 'page2', 26 | component: Page2, 27 | }, 28 | { 29 | path: '/page-3', 30 | name: 'page3', 31 | component: Page3, 32 | }, 33 | ], 34 | }); 35 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | '@vue/airbnb', 9 | ], 10 | parserOptions: { 11 | parser: '@babel/eslint-parser', 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 16 | 'max-len': ['error', { code: 130 }], 17 | }, 18 | overrides: [ 19 | { 20 | files: [ 21 | '**/__tests__/*.{j,t}s?(x)', 22 | '**/tests/unit/**/*.spec.{j,t}s?(x)', 23 | ], 24 | env: { 25 | jest: true, 26 | }, 27 | }, 28 | ], 29 | ignorePatterns: ['example/*.js', 'example/*.vue', 'example/*/*.js', 'example/*/*.vue', 'dist/*'], 30 | }; 31 | -------------------------------------------------------------------------------- /tests/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue', 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1', 12 | '^vuetify/lib$': 'vuetify/es5/entry-lib', 13 | '^vuetify/lib/(.*)': 'vuetify/es5/$1', 14 | }, 15 | transform: { 16 | '^.+\\.js$': '/node_modules/babel-jest', 17 | '.*\\.(vue)$': '/node_modules/vue-jest', 18 | }, 19 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 20 | setupFiles: ['/test/unit/setup'], 21 | coverageDirectory: '/test/unit/coverage', 22 | collectCoverageFrom: [ 23 | 'src/*.{js,vue}', 24 | '!src/main.js', 25 | '!src/router/index.js', 26 | '!**/node_modules/**', 27 | ], 28 | testEnvironment: 'jsdom', 29 | transformIgnorePatterns: ['node_modules/(?!(vuetify)/)'], 30 | }; 31 | -------------------------------------------------------------------------------- /example/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | 3 | import { register } from 'register-service-worker'; 4 | 5 | if (process.env.NODE_ENV === 'production') { 6 | register(`${process.env.BASE_URL}service-worker.js`, { 7 | ready() { 8 | console.log( 9 | 'App is being served from cache by a service worker.\n' 10 | + 'For more details, visit https://goo.gl/AFskqB', 11 | ); 12 | }, 13 | registered() { 14 | console.log('Service worker has been registered.'); 15 | }, 16 | cached() { 17 | console.log('Content has been cached for offline use.'); 18 | }, 19 | updatefound() { 20 | console.log('New content is downloading.'); 21 | }, 22 | updated() { 23 | console.log('New content is available; please refresh.'); 24 | }, 25 | offline() { 26 | console.log('No internet connection found. App is running in offline mode.'); 27 | }, 28 | error(error) { 29 | console.error('Error during service worker registration:', error); 30 | }, 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Dmitriy Olefyrenko 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue'; 4 | import VueClipboards from 'vue-clipboards'; 5 | import Vuetify from 'vuetify'; 6 | import 'vuetify/dist/vuetify.min.css'; 7 | import "@mdi/font/css/materialdesignicons.css"; 8 | import App from './App'; 9 | import router from './router'; 10 | import VuetifyGoogleAutocomplete from '../src/index'; 11 | // import VuetifyGoogleAutocomplete from '../lib/index'; 12 | 13 | Vue.use(VueClipboards); 14 | 15 | const vuetifyOptions = {}; 16 | Vue.use(Vuetify); 17 | 18 | Vue.use(VuetifyGoogleAutocomplete, { 19 | apiKey: 'AIzaSyCGqUR7l5lUulm3d0Dwo7seYi9Fi03LeXI', 20 | }); 21 | 22 | Vue.config.productionTip = false; 23 | 24 | Vue.mixin({ 25 | methods: { 26 | navigatePreviousPage() { 27 | switch (this.$route.path) { 28 | case '/': { 29 | this.$router.push('/page-3'); 30 | break; 31 | } 32 | case '/page-2': { 33 | this.$router.push('/page-1'); 34 | break; 35 | } case '/page-3': { 36 | this.$router.push('/page-2'); 37 | break; 38 | } default: { 39 | this.$router.push('/'); 40 | break; 41 | } 42 | } 43 | }, 44 | 45 | navigateNextPage() { 46 | switch (this.$route.path) { 47 | case '/': { 48 | this.$router.push('/page-1'); 49 | break; 50 | } case '/page-1': { 51 | this.$router.push('/page-2'); 52 | break; 53 | } case '/page-2': { 54 | this.$router.push('/page-3'); 55 | break; 56 | } default: { 57 | this.$router.push('/'); 58 | break; 59 | } 60 | } 61 | }, 62 | }, 63 | }); 64 | 65 | /* eslint-disable no-new */ 66 | new Vue({ 67 | el: '#app', 68 | router, 69 | components: { App }, 70 | template: '', 71 | vuetify: new Vuetify(vuetifyOptions), 72 | }); 73 | -------------------------------------------------------------------------------- /tests/unit/specs/Data.spec.js: -------------------------------------------------------------------------------- 1 | import { createLocalVue, mount } from 'vue-test-utils'; 2 | import Vuetify from 'vuetify'; 3 | import Vga from '@/index'; 4 | 5 | const localVue = createLocalVue(); 6 | let vuetify; 7 | let mandatoryProps; 8 | 9 | beforeEach(() => { 10 | vuetify = new Vuetify(); 11 | mandatoryProps = { 12 | id: 'hellowWorld', 13 | }; 14 | }); 15 | 16 | describe('Ensure component data properties behave as expected', () => { 17 | describe('autocomplete', () => { 18 | test('Should have "null" as default', () => { 19 | const wrapper = mount(Vga, { 20 | localVue, 21 | vuetify, 22 | propsData: mandatoryProps, 23 | }); 24 | expect(wrapper.vm.autocomplete).toBeNull(); 25 | }); 26 | }); 27 | 28 | describe('autocompleteText', () => { 29 | test('Should have "" as default', () => { 30 | const wrapper = mount(Vga, { 31 | localVue, 32 | vuetify, 33 | propsData: mandatoryProps, 34 | }); 35 | expect(wrapper.vm.autocompleteText).toBe(''); 36 | }); 37 | }); 38 | 39 | describe('geolocateSet', () => { 40 | test('Should have "" as default', () => { 41 | const wrapper = mount(Vga, { 42 | localVue, 43 | vuetify, 44 | propsData: mandatoryProps, 45 | }); 46 | expect(wrapper.vm.geolocateSet).toBe(false); 47 | }); 48 | }); 49 | 50 | describe('loadInterval', () => { 51 | test('Should have "null" as default', () => { 52 | const wrapper = mount(Vga, { 53 | localVue, 54 | vuetify, 55 | propsData: mandatoryProps, 56 | }); 57 | expect(wrapper.vm.loadInterval).toBeNull(); 58 | }); 59 | }); 60 | 61 | describe('vgaMapState', () => { 62 | test('Should have {"initMap": false} as default', () => { 63 | const wrapper = mount(Vga, { 64 | localVue, 65 | vuetify, 66 | propsData: mandatoryProps, 67 | }); 68 | expect(wrapper.vm.vgaMapState).toEqual({ initMap: false }); 69 | }); 70 | }); 71 | }); 72 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import loadGoogleMaps from './helper'; 2 | import VuetifyGoogleAutocomplete from './VuetifyGoogleAutocomplete'; 3 | 4 | // Prevent window from being accessed within non-browser context. 5 | if (typeof window !== 'undefined') { 6 | window.vgaMapState = { 7 | initMap: false, 8 | }; 9 | 10 | window.initVGAMaps = () => { 11 | window.vgaMapState.initMap = true; 12 | }; 13 | } 14 | 15 | VuetifyGoogleAutocomplete.install = (Vue, options) => { 16 | // Set defaults 17 | // eslint-disable-next-line 18 | options = { 19 | /* 20 | * If you want to manually install components, e.g. 21 | * import VuetifyGoogleAutoComplete from 'vuetify-google-autocomplete'; 22 | * 23 | * Vue.component('VuetifyGoogleAutoComplete', VuetifyGoogleAutoComplete) 24 | * 25 | * or locally: 26 | * then set installComponents to 'false'. 27 | * 28 | * If you want to automatically install all the components this property must be set to 'true': 29 | * 30 | * Note: Typescript will require a declaration 31 | * 32 | * index.d.ts 33 | * declare module 'vuetify-google-autocomplete'; 34 | * 35 | */ 36 | installComponents: true, 37 | /* 38 | * Allow this component to be used in conjunction with vue2-google-maps and loads maps API 39 | * via the other component. 40 | * 41 | * @see https://github.com/MadimetjaShika/vuetify-google-autocomplete/issues/60 42 | */ 43 | vueGoogleMapsCompatibility: false, 44 | ...options, 45 | }; 46 | 47 | // add Vue.$vueGoogleMapsCompatibility flag to be used for deferred loading via vue2-google-maps lazy loader 48 | Vue.mixin({ 49 | created() { 50 | this.$vueGoogleMapsCompatibility = options.vueGoogleMapsCompatibility; 51 | }, 52 | }); 53 | 54 | if (options.apiKey) { 55 | if (!options.vueGoogleMapsCompatibility) { 56 | loadGoogleMaps(options.apiKey, options.version, options.language); 57 | } // else use vue2-google-maps to load maps via loading mechanism on Vue.$gmapApiPromiseLazy 58 | } 59 | 60 | if (options.installComponents) { 61 | Vue.component(VuetifyGoogleAutocomplete.name, VuetifyGoogleAutocomplete); 62 | } 63 | }; 64 | 65 | export default VuetifyGoogleAutocomplete; 66 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuetify-google-autocomplete", 3 | "version": "2.1.2", 4 | "description": "A Vuetify ready Vue.jS component to Google Places Autocomplete", 5 | "author": "Madi Shika ", 6 | "keywords": [ 7 | "vue", 8 | "vuetify", 9 | "google", 10 | "autocomplete" 11 | ], 12 | "main": "dist/vuetify-google-autocomplete.common.js", 13 | "files": [ 14 | "dist/*" 15 | ], 16 | "license": "MIT", 17 | "homepage": "git@github.com:MadimetjaShika/vuetify-google-autocomplete", 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/MadimetjaShika/vuetify-google-autocomplete.git" 21 | }, 22 | "private": false, 23 | "scripts": { 24 | "serve": "vue-cli-service serve ./example/main.js", 25 | "build:example": "vue-cli-service build --name vuetify-google-autocomplete --dest example-dist/ ./example/main.js", 26 | "build:lib": "vue-cli-service build --target lib --name vuetify-google-autocomplete ./src/index.js --dest dist/", 27 | "test:unit": "vue-cli-service test:unit", 28 | "lint": "vue-cli-service lint" 29 | }, 30 | "dependencies": { 31 | "vuetify": "^2.6.12" 32 | }, 33 | "devDependencies": { 34 | "@babel/core": "^7.19.6", 35 | "@babel/eslint-parser": "^7.19.1", 36 | "@babel/preset-env": "^7.19.4", 37 | "@mdi/font": "^7.0.96", 38 | "@vue/cli-plugin-babel": "~5.0.8", 39 | "@vue/cli-plugin-e2e-nightwatch": "~5.0.8", 40 | "@vue/cli-plugin-eslint": "~5.0.8", 41 | "@vue/cli-plugin-pwa": "~5.0.8", 42 | "@vue/cli-plugin-router": "~5.0.8", 43 | "@vue/cli-plugin-unit-jest": "~5.0.8", 44 | "@vue/cli-service": "~5.0.8", 45 | "@vue/eslint-config-airbnb": "^6.0.0", 46 | "@vue/test-utils": "^1.1.3", 47 | "@vue/vue2-jest": "^27.0.0-alpha.2", 48 | "babel-jest": "^27.0.6", 49 | "chromedriver": "106", 50 | "core-js": "^3.8.3", 51 | "eslint": "^7.32.0", 52 | "eslint-plugin-import": "^2.25.3", 53 | "eslint-plugin-vue": "^8.0.3", 54 | "eslint-plugin-vuejs-accessibility": "^1.1.0", 55 | "geckodriver": "^3.0.1", 56 | "jest": "^27.0.5", 57 | "register-service-worker": "^1.7.2", 58 | "sass": "~1.32.0", 59 | "sass-loader": "^10.0.0", 60 | "sinon": "^14.0.1", 61 | "stylus": "^0.55.0", 62 | "stylus-loader": "^6.1.0", 63 | "vue": "^2.6.14", 64 | "vue-clipboards": "^1.3.0", 65 | "vue-router": "^3.5.1", 66 | "vue-template-compiler": "^2.6.14", 67 | "vue-test-utils": "^1.0.0-beta.11" 68 | }, 69 | "sideEffects": false 70 | } 71 | -------------------------------------------------------------------------------- /example/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 85 | 86 | 96 | 97 | 98 | 114 | -------------------------------------------------------------------------------- /example/components/Page1.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 53 | 54 | 64 | -------------------------------------------------------------------------------- /src/helper.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Loads the Google Map API. Code adopted from {@link https://github.com/xkjyeah/vue-google-maps} 3 | * 4 | * @param {string|object} apiKey API Key, or object with the URL parameters. For example to use 5 | * the Google Maps Premium API, pass { client: }. You may pass the 6 | * ersion (as 'v) as a property on this parameter. 7 | * @param {string} version Google Maps SDK Version. 8 | * 9 | * Adapted from {@link https://github.com/xkjyeah/vue-google-maps} 10 | * @see {@link https://github.com/xkjyeah/vue-google-maps} 11 | * @access private 12 | */ 13 | const loadGoogleMaps = (apiKey, version, language) => { 14 | try { 15 | // If not within browser context, do not continue processing. 16 | if (typeof window === 'undefined' || typeof document === 'undefined') { 17 | return; 18 | } 19 | 20 | if (typeof window.google === 'object' && typeof window.google.maps === 'object') { 21 | if (typeof window.google.maps.places === 'object') { 22 | return; // google is already loaded, don't try to load it again to prevent errors 23 | } 24 | 25 | throw new Error('Google is already loaded, but does not contain the places API.'); 26 | } 27 | 28 | if (!window.vgaMapState.initMap) { 29 | const googleMapScript = document.createElement('SCRIPT'); 30 | 31 | // Allow apiKey to be an object. 32 | // This is to support more esoteric means of loading Google Maps, 33 | // such as Google for business 34 | // https://developers.google.com/maps/documentation/javascript/get-api-key#premium-auth 35 | const options = {}; 36 | if (typeof apiKey === 'string') { 37 | options.key = apiKey; 38 | } else if (typeof apiKey === 'object') { 39 | Object.keys(apiKey).forEach((key) => { 40 | options[key] = apiKey[key]; 41 | }); 42 | } else { 43 | throw new Error('apiKey should either be a string or an object'); 44 | } 45 | 46 | options.libraries = 'places'; 47 | options.callback = 'initVGAMaps'; 48 | 49 | const parameters = Object.keys(options).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(options[key])}`) 50 | .join('&'); 51 | 52 | let url = `https://maps.googleapis.com/maps/api/js?${parameters}`; 53 | 54 | if (version) { 55 | url = `${url}&v=${version}`; 56 | } 57 | 58 | if (language) { 59 | url = `${url}&language=${language}`; 60 | } 61 | 62 | googleMapScript.setAttribute('src', url); 63 | googleMapScript.setAttribute('async', ''); 64 | googleMapScript.setAttribute('defer', ''); 65 | document.body.appendChild(googleMapScript); 66 | } else { 67 | throw new Error('Vuetify google autocomplete loaded multiple times.'); 68 | } 69 | } catch (exception) { 70 | throw new Error('Vuetify google autocomplete load error: ', exception); 71 | } 72 | }; 73 | 74 | export default loadGoogleMaps; 75 | -------------------------------------------------------------------------------- /tests/unit/specs/Init.spec.js: -------------------------------------------------------------------------------- 1 | import { createLocalVue, mount } from 'vue-test-utils'; 2 | import Vuetify from 'vuetify'; 3 | import sinon from 'sinon'; 4 | import Vga from '@/index'; 5 | 6 | const localVue = createLocalVue(); 7 | let vuetify; 8 | 9 | const propData = { 10 | id: 'input-field-id', 11 | }; 12 | let wrapper = null; 13 | beforeEach(() => { 14 | jest.resetModules(); 15 | delete window.google; 16 | delete window.maps; 17 | vuetify = new Vuetify(); 18 | wrapper = mount(Vga, { 19 | localVue, 20 | vuetify, 21 | propsData: propData, 22 | }); 23 | }); 24 | 25 | describe('Ensure Has correct init meta data', () => { 26 | test('Is a Vue instance', () => { 27 | expect(wrapper.isVueInstance()).toBeTruthy(); 28 | }); 29 | 30 | test('Component should have correct name', () => { 31 | expect(wrapper.name()).toBe('vuetify-google-autocomplete'); 32 | }); 33 | }); 34 | 35 | describe('Ensure Lifecycle hooks behave as expected', () => { 36 | describe('Created', () => { 37 | test('Should set autocompleteText propertly if v-model provided', () => { 38 | const props = { 39 | id: 'a prop', 40 | value: 'Default v-model value', 41 | }; 42 | wrapper = mount(Vga, { 43 | localVue, 44 | vuetify, 45 | propsData: props, 46 | }); 47 | expect(wrapper.vm.autocompleteText).toBe('Default v-model value'); 48 | }); 49 | 50 | test('Should set autocompleteText propertly if v-model NOT provided', () => { 51 | expect(wrapper.vm.autocompleteText).toBe(''); 52 | }); 53 | }); 54 | 55 | describe('Mounted', () => { 56 | test('Should not call setupGoogle() when window.google and window.maps are not set', () => { 57 | const setupGoogleSpy = sinon.spy(); 58 | wrapper = mount(Vga, { 59 | localVue, 60 | vuetify, 61 | propsData: propData, 62 | methods: { 63 | setupGoogle: setupGoogleSpy, 64 | }, 65 | }); 66 | 67 | expect(setupGoogleSpy.called).toBe(false); 68 | }); 69 | 70 | test('Should not call setupGoogle() when window.google is set but window.maps is not', () => { 71 | window.google = {}; 72 | const setupGoogleSpy = sinon.spy(); 73 | wrapper = mount(Vga, { 74 | localVue, 75 | vuetify, 76 | propsData: propData, 77 | methods: { 78 | setupGoogle: setupGoogleSpy, 79 | }, 80 | }); 81 | 82 | expect(setupGoogleSpy.called).toBe(true); 83 | }); 84 | 85 | test('Should call setupGoogle() when window.google is set and window.maps is set', () => { 86 | window.google = {}; 87 | window.maps = {}; 88 | const setupGoogleSpy = sinon.spy(); 89 | wrapper = mount(Vga, { 90 | localVue, 91 | vuetify, 92 | propsData: propData, 93 | methods: { 94 | setupGoogle: setupGoogleSpy, 95 | }, 96 | }); 97 | 98 | expect(setupGoogleSpy.called).toBe(true); 99 | }); 100 | }); 101 | }); 102 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Mainter Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mmjshika@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/). -------------------------------------------------------------------------------- /tests/unit/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 | 0% 24 | Statements 25 | 0/172 26 |
27 |
28 | 0% 29 | Branches 30 | 0/97 31 |
32 |
33 | 0% 34 | Functions 35 | 0/60 36 |
37 |
38 | 0% 39 | Lines 40 | 0/171 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 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 |
FileStatementsBranchesFunctionsLines
VuetifyGoogleAutocomplete.js
0%0/1250%0/670%0/540%0/125
helper.js
0%0/320%0/220%0/30%0/31
index.js
0%0/150%0/80%0/30%0/15
102 |
103 |
104 | 108 | 109 | 110 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /tests/unit/coverage/lcov-report/sorter.js: -------------------------------------------------------------------------------- 1 | var addSorting = (function () { 2 | "use strict"; 3 | var cols, 4 | currentSort = { 5 | index: 0, 6 | desc: false 7 | }; 8 | 9 | // returns the summary table element 10 | function getTable() { return document.querySelector('.coverage-summary'); } 11 | // returns the thead element of the summary table 12 | function getTableHeader() { return getTable().querySelector('thead tr'); } 13 | // returns the tbody element of the summary table 14 | function getTableBody() { return getTable().querySelector('tbody'); } 15 | // returns the th element for nth column 16 | function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } 17 | 18 | // loads all columns 19 | function loadColumns() { 20 | var colNodes = getTableHeader().querySelectorAll('th'), 21 | colNode, 22 | cols = [], 23 | col, 24 | i; 25 | 26 | for (i = 0; i < colNodes.length; i += 1) { 27 | colNode = colNodes[i]; 28 | col = { 29 | key: colNode.getAttribute('data-col'), 30 | sortable: !colNode.getAttribute('data-nosort'), 31 | type: colNode.getAttribute('data-type') || 'string' 32 | }; 33 | cols.push(col); 34 | if (col.sortable) { 35 | col.defaultDescSort = col.type === 'number'; 36 | colNode.innerHTML = colNode.innerHTML + ''; 37 | } 38 | } 39 | return cols; 40 | } 41 | // attaches a data attribute to every tr element with an object 42 | // of data values keyed by column name 43 | function loadRowData(tableRow) { 44 | var tableCols = tableRow.querySelectorAll('td'), 45 | colNode, 46 | col, 47 | data = {}, 48 | i, 49 | val; 50 | for (i = 0; i < tableCols.length; i += 1) { 51 | colNode = tableCols[i]; 52 | col = cols[i]; 53 | val = colNode.getAttribute('data-value'); 54 | if (col.type === 'number') { 55 | val = Number(val); 56 | } 57 | data[col.key] = val; 58 | } 59 | return data; 60 | } 61 | // loads all row data 62 | function loadData() { 63 | var rows = getTableBody().querySelectorAll('tr'), 64 | i; 65 | 66 | for (i = 0; i < rows.length; i += 1) { 67 | rows[i].data = loadRowData(rows[i]); 68 | } 69 | } 70 | // sorts the table using the data for the ith column 71 | function sortByIndex(index, desc) { 72 | var key = cols[index].key, 73 | sorter = function (a, b) { 74 | a = a.data[key]; 75 | b = b.data[key]; 76 | return a < b ? -1 : a > b ? 1 : 0; 77 | }, 78 | finalSorter = sorter, 79 | tableBody = document.querySelector('.coverage-summary tbody'), 80 | rowNodes = tableBody.querySelectorAll('tr'), 81 | rows = [], 82 | i; 83 | 84 | if (desc) { 85 | finalSorter = function (a, b) { 86 | return -1 * sorter(a, b); 87 | }; 88 | } 89 | 90 | for (i = 0; i < rowNodes.length; i += 1) { 91 | rows.push(rowNodes[i]); 92 | tableBody.removeChild(rowNodes[i]); 93 | } 94 | 95 | rows.sort(finalSorter); 96 | 97 | for (i = 0; i < rows.length; i += 1) { 98 | tableBody.appendChild(rows[i]); 99 | } 100 | } 101 | // removes sort indicators for current column being sorted 102 | function removeSortIndicators() { 103 | var col = getNthColumn(currentSort.index), 104 | cls = col.className; 105 | 106 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 107 | col.className = cls; 108 | } 109 | // adds sort indicators for current column being sorted 110 | function addSortIndicators() { 111 | getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; 112 | } 113 | // adds event listeners for all sorter widgets 114 | function enableUI() { 115 | var i, 116 | el, 117 | ithSorter = function ithSorter(i) { 118 | var col = cols[i]; 119 | 120 | return function () { 121 | var desc = col.defaultDescSort; 122 | 123 | if (currentSort.index === i) { 124 | desc = !currentSort.desc; 125 | } 126 | sortByIndex(i, desc); 127 | removeSortIndicators(); 128 | currentSort.index = i; 129 | currentSort.desc = desc; 130 | addSortIndicators(); 131 | }; 132 | }; 133 | for (i =0 ; i < cols.length; i += 1) { 134 | if (cols[i].sortable) { 135 | // add the click event handler on the th so users 136 | // dont have to click on those tiny arrows 137 | el = getNthColumn(i).querySelector('.sorter').parentElement; 138 | if (el.addEventListener) { 139 | el.addEventListener('click', ithSorter(i)); 140 | } else { 141 | el.attachEvent('onclick', ithSorter(i)); 142 | } 143 | } 144 | } 145 | } 146 | // adds sorting functionality to the UI 147 | return function () { 148 | if (!getTable()) { 149 | return; 150 | } 151 | cols = loadColumns(); 152 | loadData(cols); 153 | addSortIndicators(); 154 | enableUI(); 155 | }; 156 | })(); 157 | 158 | window.addEventListener('load', addSorting); 159 | -------------------------------------------------------------------------------- /tests/unit/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 | /* dark red */ 156 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } 157 | .low .chart { border:1px solid #C21F39 } 158 | /* medium red */ 159 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } 160 | /* light red */ 161 | .low, .cline-no { background:#FCE1E5 } 162 | /* light green */ 163 | .high, .cline-yes { background:rgb(230,245,208) } 164 | /* medium green */ 165 | .cstat-yes { background:rgb(161,215,106) } 166 | /* dark green */ 167 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) } 168 | .high .chart { border:1px solid rgb(77,146,33) } 169 | 170 | 171 | .medium .chart { border:1px solid #666; } 172 | .medium .cover-fill { background: #666; } 173 | 174 | .cbranch-no { background: yellow !important; color: #111; } 175 | 176 | .cstat-skip { background: #ddd; color: #111; } 177 | .fstat-skip { background: #ddd; color: #111 !important; } 178 | .cbranch-skip { background: #ddd !important; color: #111; } 179 | 180 | span.cline-neutral { background: #eaeaea; } 181 | .medium { background: #eaeaea; } 182 | 183 | .cover-fill, .cover-empty { 184 | display:inline-block; 185 | height: 12px; 186 | } 187 | .chart { 188 | line-height: 0; 189 | } 190 | .cover-empty { 191 | background: white; 192 | } 193 | .cover-full { 194 | border-right: none !important; 195 | } 196 | pre.prettyprint { 197 | border: none !important; 198 | padding: 0 !important; 199 | margin: 0 !important; 200 | } 201 | .com { color: #999 !important; } 202 | .ignore-none { color: #999; font-weight: normal; } 203 | 204 | .wrapper { 205 | min-height: 100%; 206 | height: auto !important; 207 | height: 100%; 208 | margin: 0 auto -48px; 209 | } 210 | .footer, .push { 211 | height: 48px; 212 | } 213 | -------------------------------------------------------------------------------- /tests/unit/coverage/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:/Users/madimetjashika/Documents/Documents – Madimetja’s MacBook Pro (2)/personal-projects/personal/vuetify-google-autocomplete-webpack/src/vga/VuetifyGoogleAutocomplete.js 3 | FN:23,_default 4 | FN:240,_default 5 | FN:370,_default 6 | FN:547,_default 7 | FN:653,_default 8 | FN:685,_default 9 | FN:741,data 10 | FN:782,rulesPlusInternalRules 11 | FN:800,onFocus 12 | FN:800,onBlur 13 | FN:800,onChange 14 | FN:800,onClickAppend 15 | FN:800,onClickAppendOuter 16 | FN:800,onClickClear 17 | FN:800,onClickPrepend 18 | FN:800,onClickPrependInner 19 | FN:800,onUpdateError 20 | FN:800,onKeyPress 21 | FN:800,clear 22 | FN:800,focus 23 | FN:800,blur 24 | FN:800,update 25 | FN:800,geolocate 26 | FN:925,(anonymous_24) 27 | FN:932,(anonymous_25) 28 | FN:800,setupGoogle 29 | FN:967,(anonymous_27) 30 | FN:974,(anonymous_28) 31 | FN:800,setupGmapApi 32 | FN:1056,(anonymous_30) 33 | FN:7,created 34 | FN:7,mounted 35 | FN:7,destroyed 36 | FN:7,render 37 | FN:1175,focus 38 | FN:1178,blur 39 | FN:1181,change 40 | FN:1184,clickAppend 41 | FN:1187,clickAppendOuter 42 | FN:1190,clickClear 43 | FN:1193,clickPrepend 44 | FN:1196,clickPrependInner 45 | FN:1199,updateError 46 | FN:1202,keypress 47 | FN:1205,input 48 | FN:1220,(anonymous_46) 49 | FN:1229,autocompleteText 50 | FN:1236,value 51 | FN:1245,country 52 | FN:1254,fields 53 | FN:1267,enableGeolocation 54 | FN:1280,vgaMapStateInitMap 55 | FN:1286,vgaMapStateInitMap 56 | FN:1293,types 57 | FNF:54 58 | FNH:0 59 | FNDA:0,_default 60 | FNDA:0,_default 61 | FNDA:0,_default 62 | FNDA:0,_default 63 | FNDA:0,_default 64 | FNDA:0,_default 65 | FNDA:0,data 66 | FNDA:0,rulesPlusInternalRules 67 | FNDA:0,onFocus 68 | FNDA:0,onBlur 69 | FNDA:0,onChange 70 | FNDA:0,onClickAppend 71 | FNDA:0,onClickAppendOuter 72 | FNDA:0,onClickClear 73 | FNDA:0,onClickPrepend 74 | FNDA:0,onClickPrependInner 75 | FNDA:0,onUpdateError 76 | FNDA:0,onKeyPress 77 | FNDA:0,clear 78 | FNDA:0,focus 79 | FNDA:0,blur 80 | FNDA:0,update 81 | FNDA:0,geolocate 82 | FNDA:0,(anonymous_24) 83 | FNDA:0,(anonymous_25) 84 | FNDA:0,setupGoogle 85 | FNDA:0,(anonymous_27) 86 | FNDA:0,(anonymous_28) 87 | FNDA:0,setupGmapApi 88 | FNDA:0,(anonymous_30) 89 | FNDA:0,created 90 | FNDA:0,mounted 91 | FNDA:0,destroyed 92 | FNDA:0,render 93 | FNDA:0,focus 94 | FNDA:0,blur 95 | FNDA:0,change 96 | FNDA:0,clickAppend 97 | FNDA:0,clickAppendOuter 98 | FNDA:0,clickClear 99 | FNDA:0,clickPrepend 100 | FNDA:0,clickPrependInner 101 | FNDA:0,updateError 102 | FNDA:0,keypress 103 | FNDA:0,input 104 | FNDA:0,(anonymous_46) 105 | FNDA:0,autocompleteText 106 | FNDA:0,value 107 | FNDA:0,country 108 | FNDA:0,fields 109 | FNDA:0,enableGeolocation 110 | FNDA:0,vgaMapStateInitMap 111 | FNDA:0,vgaMapStateInitMap 112 | FNDA:0,types 113 | DA:1,0 114 | DA:23,0 115 | DA:240,0 116 | DA:370,0 117 | DA:547,0 118 | DA:653,0 119 | DA:685,0 120 | DA:741,0 121 | DA:784,0 122 | DA:786,0 123 | DA:788,0 124 | DA:790,0 125 | DA:793,0 126 | DA:806,0 127 | DA:807,0 128 | DA:815,0 129 | DA:823,0 130 | DA:831,0 131 | DA:839,0 132 | DA:847,0 133 | DA:855,0 134 | DA:863,0 135 | DA:871,0 136 | DA:880,0 137 | DA:888,0 138 | DA:889,0 139 | DA:897,0 140 | DA:905,0 141 | DA:914,0 142 | DA:922,0 143 | DA:923,0 144 | DA:924,0 145 | DA:925,0 146 | DA:926,0 147 | DA:932,0 148 | DA:933,0 149 | DA:937,0 150 | DA:938,0 151 | DA:945,0 152 | DA:946,0 153 | DA:948,0 154 | DA:949,0 155 | DA:952,0 156 | DA:953,0 157 | DA:958,0 158 | DA:959,0 159 | DA:960,0 160 | DA:962,0 161 | DA:967,0 162 | DA:968,0 163 | DA:974,0 164 | DA:975,0 165 | DA:978,0 166 | DA:981,0 167 | DA:982,0 168 | DA:985,0 169 | DA:987,0 170 | DA:988,0 171 | DA:989,0 172 | DA:990,0 173 | DA:993,0 174 | DA:995,0 175 | DA:996,0 176 | DA:998,0 177 | DA:999,0 178 | DA:1000,0 179 | DA:1003,0 180 | DA:1004,0 181 | DA:1005,0 182 | DA:1009,0 183 | DA:1010,0 184 | DA:1012,0 185 | DA:1013,0 186 | DA:1015,0 187 | DA:1016,0 188 | DA:1020,0 189 | DA:1023,0 190 | DA:1024,0 191 | DA:1025,0 192 | DA:1030,0 193 | DA:1040,0 194 | DA:1053,0 195 | DA:1054,0 196 | DA:1055,0 197 | DA:1056,0 198 | DA:1058,0 199 | DA:1059,0 200 | DA:1071,0 201 | DA:1072,0 202 | DA:1079,0 203 | DA:1080,0 204 | DA:1088,0 205 | DA:1094,0 206 | DA:1095,0 207 | DA:1096,0 208 | DA:1176,0 209 | DA:1179,0 210 | DA:1182,0 211 | DA:1185,0 212 | DA:1188,0 213 | DA:1191,0 214 | DA:1194,0 215 | DA:1197,0 216 | DA:1200,0 217 | DA:1203,0 218 | DA:1207,0 219 | DA:1220,0 220 | DA:1230,0 221 | DA:1237,0 222 | DA:1238,0 223 | DA:1239,0 224 | DA:1246,0 225 | DA:1247,0 226 | DA:1255,0 227 | DA:1256,0 228 | DA:1257,0 229 | DA:1259,0 230 | DA:1268,0 231 | DA:1269,0 232 | DA:1272,0 233 | DA:1281,0 234 | DA:1282,0 235 | DA:1287,0 236 | DA:1294,0 237 | DA:1295,0 238 | LF:125 239 | LH:0 240 | BRDA:786,0,0,0 241 | BRDA:786,0,1,0 242 | BRDA:786,1,0,0 243 | BRDA:786,1,1,0 244 | BRDA:786,1,2,0 245 | BRDA:923,2,0,0 246 | BRDA:923,2,1,0 247 | BRDA:923,3,0,0 248 | BRDA:923,3,1,0 249 | BRDA:924,4,0,0 250 | BRDA:924,4,1,0 251 | BRDA:948,5,0,0 252 | BRDA:948,5,1,0 253 | BRDA:952,6,0,0 254 | BRDA:952,6,1,0 255 | BRDA:958,7,0,0 256 | BRDA:958,7,1,0 257 | BRDA:959,8,0,0 258 | BRDA:959,8,1,0 259 | BRDA:978,9,0,0 260 | BRDA:978,9,1,0 261 | BRDA:987,10,0,0 262 | BRDA:987,10,1,0 263 | BRDA:987,11,0,0 264 | BRDA:987,11,1,0 265 | BRDA:989,12,0,0 266 | BRDA:989,12,1,0 267 | BRDA:993,13,0,0 268 | BRDA:993,13,1,0 269 | BRDA:998,14,0,0 270 | BRDA:998,14,1,0 271 | BRDA:1003,15,0,0 272 | BRDA:1003,15,1,0 273 | BRDA:1009,16,0,0 274 | BRDA:1009,16,1,0 275 | BRDA:1012,17,0,0 276 | BRDA:1012,17,1,0 277 | BRDA:1015,18,0,0 278 | BRDA:1015,18,1,0 279 | BRDA:1025,19,0,0 280 | BRDA:1025,19,1,0 281 | BRDA:1041,20,0,0 282 | BRDA:1041,20,1,0 283 | BRDA:1053,21,0,0 284 | BRDA:1053,21,1,0 285 | BRDA:1054,22,0,0 286 | BRDA:1054,22,1,0 287 | BRDA:1058,23,0,0 288 | BRDA:1058,23,1,0 289 | BRDA:1071,24,0,0 290 | BRDA:1071,24,1,0 291 | BRDA:1230,25,0,0 292 | BRDA:1230,25,1,0 293 | BRDA:1237,26,0,0 294 | BRDA:1237,26,1,0 295 | BRDA:1246,27,0,0 296 | BRDA:1246,27,1,0 297 | BRDA:1255,28,0,0 298 | BRDA:1255,28,1,0 299 | BRDA:1256,29,0,0 300 | BRDA:1256,29,1,0 301 | BRDA:1268,30,0,0 302 | BRDA:1268,30,1,0 303 | BRDA:1281,31,0,0 304 | BRDA:1281,31,1,0 305 | BRDA:1294,32,0,0 306 | BRDA:1294,32,1,0 307 | BRF:67 308 | BRH:0 309 | end_of_record 310 | TN: 311 | SF:/Users/madimetjashika/Documents/Documents – Madimetja’s MacBook Pro (2)/personal-projects/personal/vuetify-google-autocomplete-webpack/src/vga/helper.js 312 | FN:13,loadGoogleMaps 313 | FN:39,(anonymous_3) 314 | FN:49,(anonymous_4) 315 | FNF:3 316 | FNH:0 317 | FNDA:0,loadGoogleMaps 318 | FNDA:0,(anonymous_3) 319 | FNDA:0,(anonymous_4) 320 | DA:13,0 321 | DA:14,0 322 | DA:16,0 323 | DA:17,0 324 | DA:20,0 325 | DA:21,0 326 | DA:22,0 327 | DA:25,0 328 | DA:28,0 329 | DA:29,0 330 | DA:35,0 331 | DA:36,0 332 | DA:37,0 333 | DA:38,0 334 | DA:39,0 335 | DA:40,0 336 | DA:43,0 337 | DA:46,0 338 | DA:47,0 339 | DA:49,0 340 | DA:52,0 341 | DA:54,0 342 | DA:55,0 343 | DA:58,0 344 | DA:59,0 345 | DA:62,0 346 | DA:63,0 347 | DA:64,0 348 | DA:65,0 349 | DA:67,0 350 | DA:70,0 351 | LF:31 352 | LH:0 353 | BRDA:16,0,0,0 354 | BRDA:16,0,1,0 355 | BRDA:16,1,0,0 356 | BRDA:16,1,1,0 357 | BRDA:20,2,0,0 358 | BRDA:20,2,1,0 359 | BRDA:20,3,0,0 360 | BRDA:20,3,1,0 361 | BRDA:21,4,0,0 362 | BRDA:21,4,1,0 363 | BRDA:28,5,0,0 364 | BRDA:28,5,1,0 365 | BRDA:36,6,0,0 366 | BRDA:36,6,1,0 367 | BRDA:38,7,0,0 368 | BRDA:38,7,1,0 369 | BRDA:38,8,0,0 370 | BRDA:38,8,1,0 371 | BRDA:54,9,0,0 372 | BRDA:54,9,1,0 373 | BRDA:58,10,0,0 374 | BRDA:58,10,1,0 375 | BRF:22 376 | BRH:0 377 | end_of_record 378 | TN: 379 | SF:/Users/madimetjashika/Documents/Documents – Madimetja’s MacBook Pro (2)/personal-projects/personal/vuetify-google-autocomplete-webpack/src/vga/index.js 380 | FN:10,(anonymous_2) 381 | FN:15,(anonymous_3) 382 | FN:47,created 383 | FNF:3 384 | FNH:0 385 | FNDA:0,(anonymous_2) 386 | FNDA:0,(anonymous_3) 387 | FNDA:0,created 388 | DA:1,0 389 | DA:2,0 390 | DA:5,0 391 | DA:6,0 392 | DA:10,0 393 | DA:11,0 394 | DA:15,0 395 | DA:17,0 396 | DA:47,0 397 | DA:49,0 398 | DA:53,0 399 | DA:54,0 400 | DA:55,0 401 | DA:59,0 402 | DA:60,0 403 | LF:15 404 | LH:0 405 | BRDA:5,0,0,0 406 | BRDA:5,0,1,0 407 | BRDA:53,1,0,0 408 | BRDA:53,1,1,0 409 | BRDA:54,2,0,0 410 | BRDA:54,2,1,0 411 | BRDA:59,3,0,0 412 | BRDA:59,3,1,0 413 | BRF:8 414 | BRH:0 415 | end_of_record 416 | -------------------------------------------------------------------------------- /example/countrycode.json: -------------------------------------------------------------------------------- 1 | [{"Name":"Afghanistan","Code":"AF"},{"Name":"Åland Islands","Code":"AX"},{"Name":"Albania","Code":"AL"},{"Name":"Algeria","Code":"DZ"},{"Name":"American Samoa","Code":"AS"},{"Name":"Andorra","Code":"AD"},{"Name":"Angola","Code":"AO"},{"Name":"Anguilla","Code":"AI"},{"Name":"Antarctica","Code":"AQ"},{"Name":"Antigua and Barbuda","Code":"AG"},{"Name":"Argentina","Code":"AR"},{"Name":"Armenia","Code":"AM"},{"Name":"Aruba","Code":"AW"},{"Name":"Australia","Code":"AU"},{"Name":"Austria","Code":"AT"},{"Name":"Azerbaijan","Code":"AZ"},{"Name":"Bahamas","Code":"BS"},{"Name":"Bahrain","Code":"BH"},{"Name":"Bangladesh","Code":"BD"},{"Name":"Barbados","Code":"BB"},{"Name":"Belarus","Code":"BY"},{"Name":"Belgium","Code":"BE"},{"Name":"Belize","Code":"BZ"},{"Name":"Benin","Code":"BJ"},{"Name":"Bermuda","Code":"BM"},{"Name":"Bhutan","Code":"BT"},{"Name":"Bolivia, Plurinational State of","Code":"BO"},{"Name":"Bonaire, Sint Eustatius and Saba","Code":"BQ"},{"Name":"Bosnia and Herzegovina","Code":"BA"},{"Name":"Botswana","Code":"BW"},{"Name":"Bouvet Island","Code":"BV"},{"Name":"Brazil","Code":"BR"},{"Name":"British Indian Ocean Territory","Code":"IO"},{"Name":"Brunei Darussalam","Code":"BN"},{"Name":"Bulgaria","Code":"BG"},{"Name":"Burkina Faso","Code":"BF"},{"Name":"Burundi","Code":"BI"},{"Name":"Cambodia","Code":"KH"},{"Name":"Cameroon","Code":"CM"},{"Name":"Canada","Code":"CA"},{"Name":"Cape Verde","Code":"CV"},{"Name":"Cayman Islands","Code":"KY"},{"Name":"Central African Republic","Code":"CF"},{"Name":"Chad","Code":"TD"},{"Name":"Chile","Code":"CL"},{"Name":"China","Code":"CN"},{"Name":"Christmas Island","Code":"CX"},{"Name":"Cocos (Keeling) Islands","Code":"CC"},{"Name":"Colombia","Code":"CO"},{"Name":"Comoros","Code":"KM"},{"Name":"Congo","Code":"CG"},{"Name":"Congo, the Democratic Republic of the","Code":"CD"},{"Name":"Cook Islands","Code":"CK"},{"Name":"Costa Rica","Code":"CR"},{"Name":"Côte d'Ivoire","Code":"CI"},{"Name":"Croatia","Code":"HR"},{"Name":"Cuba","Code":"CU"},{"Name":"Curaçao","Code":"CW"},{"Name":"Cyprus","Code":"CY"},{"Name":"Czech Republic","Code":"CZ"},{"Name":"Denmark","Code":"DK"},{"Name":"Djibouti","Code":"DJ"},{"Name":"Dominica","Code":"DM"},{"Name":"Dominican Republic","Code":"DO"},{"Name":"Ecuador","Code":"EC"},{"Name":"Egypt","Code":"EG"},{"Name":"El Salvador","Code":"SV"},{"Name":"Equatorial Guinea","Code":"GQ"},{"Name":"Eritrea","Code":"ER"},{"Name":"Estonia","Code":"EE"},{"Name":"Ethiopia","Code":"ET"},{"Name":"Falkland Islands (Malvinas)","Code":"FK"},{"Name":"Faroe Islands","Code":"FO"},{"Name":"Fiji","Code":"FJ"},{"Name":"Finland","Code":"FI"},{"Name":"France","Code":"FR"},{"Name":"French Guiana","Code":"GF"},{"Name":"French Polynesia","Code":"PF"},{"Name":"French Southern Territories","Code":"TF"},{"Name":"Gabon","Code":"GA"},{"Name":"Gambia","Code":"GM"},{"Name":"Georgia","Code":"GE"},{"Name":"Germany","Code":"DE"},{"Name":"Ghana","Code":"GH"},{"Name":"Gibraltar","Code":"GI"},{"Name":"Greece","Code":"GR"},{"Name":"Greenland","Code":"GL"},{"Name":"Grenada","Code":"GD"},{"Name":"Guadeloupe","Code":"GP"},{"Name":"Guam","Code":"GU"},{"Name":"Guatemala","Code":"GT"},{"Name":"Guernsey","Code":"GG"},{"Name":"Guinea","Code":"GN"},{"Name":"Guinea-Bissau","Code":"GW"},{"Name":"Guyana","Code":"GY"},{"Name":"Haiti","Code":"HT"},{"Name":"Heard Island and McDonald Islands","Code":"HM"},{"Name":"Holy See (Vatican City State)","Code":"VA"},{"Name":"Honduras","Code":"HN"},{"Name":"Hong Kong","Code":"HK"},{"Name":"Hungary","Code":"HU"},{"Name":"Iceland","Code":"IS"},{"Name":"India","Code":"IN"},{"Name":"Indonesia","Code":"ID"},{"Name":"Iran, Islamic Republic of","Code":"IR"},{"Name":"Iraq","Code":"IQ"},{"Name":"Ireland","Code":"IE"},{"Name":"Isle of Man","Code":"IM"},{"Name":"Israel","Code":"IL"},{"Name":"Italy","Code":"IT"},{"Name":"Jamaica","Code":"JM"},{"Name":"Japan","Code":"JP"},{"Name":"Jersey","Code":"JE"},{"Name":"Jordan","Code":"JO"},{"Name":"Kazakhstan","Code":"KZ"},{"Name":"Kenya","Code":"KE"},{"Name":"Kiribati","Code":"KI"},{"Name":"Korea, Democratic People's Republic of","Code":"KP"},{"Name":"Korea, Republic of","Code":"KR"},{"Name":"Kuwait","Code":"KW"},{"Name":"Kyrgyzstan","Code":"KG"},{"Name":"Lao People's Democratic Republic","Code":"LA"},{"Name":"Latvia","Code":"LV"},{"Name":"Lebanon","Code":"LB"},{"Name":"Lesotho","Code":"LS"},{"Name":"Liberia","Code":"LR"},{"Name":"Libya","Code":"LY"},{"Name":"Liechtenstein","Code":"LI"},{"Name":"Lithuania","Code":"LT"},{"Name":"Luxembourg","Code":"LU"},{"Name":"Macao","Code":"MO"},{"Name":"Macedonia, the Former Yugoslav Republic of","Code":"MK"},{"Name":"Madagascar","Code":"MG"},{"Name":"Malawi","Code":"MW"},{"Name":"Malaysia","Code":"MY"},{"Name":"Maldives","Code":"MV"},{"Name":"Mali","Code":"ML"},{"Name":"Malta","Code":"MT"},{"Name":"Marshall Islands","Code":"MH"},{"Name":"Martinique","Code":"MQ"},{"Name":"Mauritania","Code":"MR"},{"Name":"Mauritius","Code":"MU"},{"Name":"Mayotte","Code":"YT"},{"Name":"Mexico","Code":"MX"},{"Name":"Micronesia, Federated States of","Code":"FM"},{"Name":"Moldova, Republic of","Code":"MD"},{"Name":"Monaco","Code":"MC"},{"Name":"Mongolia","Code":"MN"},{"Name":"Montenegro","Code":"ME"},{"Name":"Montserrat","Code":"MS"},{"Name":"Morocco","Code":"MA"},{"Name":"Mozambique","Code":"MZ"},{"Name":"Myanmar","Code":"MM"},{"Name":"Namibia","Code":"NA"},{"Name":"Nauru","Code":"NR"},{"Name":"Nepal","Code":"NP"},{"Name":"Netherlands","Code":"NL"},{"Name":"New Caledonia","Code":"NC"},{"Name":"New Zealand","Code":"NZ"},{"Name":"Nicaragua","Code":"NI"},{"Name":"Niger","Code":"NE"},{"Name":"Nigeria","Code":"NG"},{"Name":"Niue","Code":"NU"},{"Name":"Norfolk Island","Code":"NF"},{"Name":"Northern Mariana Islands","Code":"MP"},{"Name":"Norway","Code":"NO"},{"Name":"Oman","Code":"OM"},{"Name":"Pakistan","Code":"PK"},{"Name":"Palau","Code":"PW"},{"Name":"Palestine, State of","Code":"PS"},{"Name":"Panama","Code":"PA"},{"Name":"Papua New Guinea","Code":"PG"},{"Name":"Paraguay","Code":"PY"},{"Name":"Peru","Code":"PE"},{"Name":"Philippines","Code":"PH"},{"Name":"Pitcairn","Code":"PN"},{"Name":"Poland","Code":"PL"},{"Name":"Portugal","Code":"PT"},{"Name":"Puerto Rico","Code":"PR"},{"Name":"Qatar","Code":"QA"},{"Name":"Réunion","Code":"RE"},{"Name":"Romania","Code":"RO"},{"Name":"Russian Federation","Code":"RU"},{"Name":"Rwanda","Code":"RW"},{"Name":"Saint Barthélemy","Code":"BL"},{"Name":"Saint Helena, Ascension and Tristan da Cunha","Code":"SH"},{"Name":"Saint Kitts and Nevis","Code":"KN"},{"Name":"Saint Lucia","Code":"LC"},{"Name":"Saint Martin (French part)","Code":"MF"},{"Name":"Saint Pierre and Miquelon","Code":"PM"},{"Name":"Saint Vincent and the Grenadines","Code":"VC"},{"Name":"Samoa","Code":"WS"},{"Name":"San Marino","Code":"SM"},{"Name":"Sao Tome and Principe","Code":"ST"},{"Name":"Saudi Arabia","Code":"SA"},{"Name":"Senegal","Code":"SN"},{"Name":"Serbia","Code":"RS"},{"Name":"Seychelles","Code":"SC"},{"Name":"Sierra Leone","Code":"SL"},{"Name":"Singapore","Code":"SG"},{"Name":"Sint Maarten (Dutch part)","Code":"SX"},{"Name":"Slovakia","Code":"SK"},{"Name":"Slovenia","Code":"SI"},{"Name":"Solomon Islands","Code":"SB"},{"Name":"Somalia","Code":"SO"},{"Name":"South Africa","Code":"ZA"},{"Name":"South Georgia and the South Sandwich Islands","Code":"GS"},{"Name":"South Sudan","Code":"SS"},{"Name":"Spain","Code":"ES"},{"Name":"Sri Lanka","Code":"LK"},{"Name":"Sudan","Code":"SD"},{"Name":"Suriname","Code":"SR"},{"Name":"Svalbard and Jan Mayen","Code":"SJ"},{"Name":"Swaziland","Code":"SZ"},{"Name":"Sweden","Code":"SE"},{"Name":"Switzerland","Code":"CH"},{"Name":"Syrian Arab Republic","Code":"SY"},{"Name":"Taiwan, Province of China","Code":"TW"},{"Name":"Tajikistan","Code":"TJ"},{"Name":"Tanzania, United Republic of","Code":"TZ"},{"Name":"Thailand","Code":"TH"},{"Name":"Timor-Leste","Code":"TL"},{"Name":"Togo","Code":"TG"},{"Name":"Tokelau","Code":"TK"},{"Name":"Tonga","Code":"TO"},{"Name":"Trinidad and Tobago","Code":"TT"},{"Name":"Tunisia","Code":"TN"},{"Name":"Turkey","Code":"TR"},{"Name":"Turkmenistan","Code":"TM"},{"Name":"Turks and Caicos Islands","Code":"TC"},{"Name":"Tuvalu","Code":"TV"},{"Name":"Uganda","Code":"UG"},{"Name":"Ukraine","Code":"UA"},{"Name":"United Arab Emirates","Code":"AE"},{"Name":"United Kingdom","Code":"GB"},{"Name":"United States","Code":"US"},{"Name":"United States Minor Outlying Islands","Code":"UM"},{"Name":"Uruguay","Code":"UY"},{"Name":"Uzbekistan","Code":"UZ"},{"Name":"Vanuatu","Code":"VU"},{"Name":"Venezuela, Bolivarian Republic of","Code":"VE"},{"Name":"Viet Nam","Code":"VN"},{"Name":"Virgin Islands, British","Code":"VG"},{"Name":"Virgin Islands, U.S.","Code":"VI"},{"Name":"Wallis and Futuna","Code":"WF"},{"Name":"Western Sahara","Code":"EH"},{"Name":"Yemen","Code":"YE"},{"Name":"Zambia","Code":"ZM"},{"Name":"Zimbabwe","Code":"ZW"}] -------------------------------------------------------------------------------- /tests/unit/coverage/lcov-report/index.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for index.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files index.js 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/15 26 |
27 |
28 | 0% 29 | Branches 30 | 0/8 31 |
32 |
33 | 0% 34 | Functions 35 | 0/3 36 |
37 |
38 | 0% 39 | Lines 40 | 0/15 41 |
42 |
43 |
44 |
45 |

 46 | 
239 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 73 | 28 74 | 29 75 | 30 76 | 31 77 | 32 78 | 33 79 | 34 80 | 35 81 | 36 82 | 37 83 | 38 84 | 39 85 | 40 86 | 41 87 | 42 88 | 43 89 | 44 90 | 45 91 | 46 92 | 47 93 | 48 94 | 49 95 | 50 96 | 51 97 | 52 98 | 53 99 | 54 100 | 55 101 | 56 102 | 57 103 | 58 104 | 59 105 | 60 106 | 61 107 | 62 108 | 63 109 | 64 110 | 65  111 |   112 |   113 |   114 |   115 |   116 |   117 |   118 |   119 |   120 |   121 |   122 |   123 |   124 |   125 |   126 |   127 |   128 |   129 |   130 |   131 |   132 |   133 |   134 |   135 |   136 |   137 |   138 |   139 |   140 |   141 |   142 |   143 |   144 |   145 |   146 |   147 |   148 |   149 |   150 |   151 |   152 |   153 |   154 |   155 |   156 |   157 |   158 |   159 |   160 |   161 |   162 |   163 |   164 |   165 |   166 |   167 |   168 |   169 |   170 |   171 |   172 |   173 |   174 |  
import loadGoogleMaps from './helper';
175 | import VuetifyGoogleAutocomplete from './VuetifyGoogleAutocomplete';
176 |  
177 | // Prevent window from being accessed within non-browser context.
178 | if (typeof window !== 'undefined') {
179 |   window.vgaMapState = {
180 |     initMap: false,
181 |   };
182 |  
183 |   window.initVGAMaps = () => {
184 |     window.vgaMapState.initMap = true;
185 |   };
186 | }
187 |  
188 | VuetifyGoogleAutocomplete.install = (Vue, options) => {
189 |   // Set defaults
190 |   options = {
191 |     /*
192 |      *  If you want to manually install components, e.g.
193 |      *       import VuetifyGoogleAutoComplete from 'vuetify-google-autocomplete';
194 |      *
195 |      *   Vue.component('VuetifyGoogleAutoComplete', VuetifyGoogleAutoComplete)
196 |      *
197 |      *  or locally:
198 |      *   then set installComponents to 'false'.
199 |      *
200 |      *  If you want to automatically install all the components this property must be set to 'true':
201 |      *
202 |      * Note: Typescript will require a declaration
203 |      *
204 |      * index.d.ts
205 |      * declare module 'vuetify-google-autocomplete';
206 |      *
207 |      */
208 |     installComponents: true,
209 |     /*
210 |      * Allow this component to be used in conjunction with vue2-google-maps and loads maps API
211 |      * via the other component.
212 |      *
213 |      * @see https://github.com/MadimetjaShika/vuetify-google-autocomplete/issues/60
214 |      */
215 |     vueGoogleMapsCompatibility: false,
216 |     ...options,
217 |   };
218 |  
219 |   // add Vue.$vueGoogleMapsCompatibility flag to be used for deferred loading via vue2-google-maps lazy loader
220 |   Vue.mixin({
221 |     created() {
222 |       this.$vueGoogleMapsCompatibility = options.vueGoogleMapsCompatibility;
223 |     },
224 |   });
225 |  
226 |   if (options.apiKey) {
227 |     if (!options.vueGoogleMapsCompatibility) {
228 |       loadGoogleMaps(options.apiKey, options.version, options.language);
229 |     } // else use vue2-google-maps to load maps via loading mechanism on Vue.$gmapApiPromiseLazy
230 |   }
231 |  
232 |   if (options.installComponents) {
233 |     Vue.component(VuetifyGoogleAutocomplete.name, VuetifyGoogleAutocomplete);
234 |   }
235 | };
236 |  
237 | export default VuetifyGoogleAutocomplete;
238 |  
240 |
241 |
242 | 246 | 247 | 248 | 255 | 256 | 257 | 258 | -------------------------------------------------------------------------------- /tests/unit/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 | 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 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vuetify Google Autocomplete 2 | 3 | A Vuetify ready Vue.js (2.x) autosuggest component for the Google Maps Places API. 4 | 5 | ![release](https://github.com/MadimetjaShika/vuetify-google-autocomplete/actions/workflows/release.yml/badge.svg) 6 | 7 | ## Versions 8 | 9 | Latest Beta: 2.0.0-beta.8 10 | 11 | Latest Stable: 2.1.2 12 | 13 | See [releases](https://github.com/MadimetjaShika/vuetify-google-autocomplete/releases) for details. 14 | 15 | ## Thanks 16 | 17 | Huge thanks and credit goes to [@olefirenko](https://github.com/olefirenko) and contributors for creating [Vue Google Autocomplete](https://github.com/olefirenko/vue-google-autocomplete) from which this Vuetify ready version was inspired. 18 | 19 | ## Demo 20 | 21 | Live Interactive demo: [madimetjashika.github.io/vuetify-google-autocomplete](https://madimetjashika.github.io/vuetify-google-autocomplete/) 22 | 23 | ## Installation 24 | 25 | The easiest way to use Vuetify Google Autocomplete is to install it from **npm** or **yarn**. 26 | 27 | ```sh 28 | npm i vuetify-google-autocomplete 29 | ``` 30 | 31 | Or 32 | 33 | ```sh 34 | yarn add vuetify-google-autocomplete 35 | ``` 36 | 37 | ### For version >= 2.0.0-alpha.2 38 | 39 | Within your main.js or Vue entry point, import and initialise the component. 40 | 41 | ```javascript 42 | import Vue from 'vue'; 43 | import VuetifyGoogleAutocomplete from 'vuetify-google-autocomplete'; 44 | 45 | Vue.use(VuetifyGoogleAutocomplete, { 46 | apiKey: '...', // Can also be an object. E.g, for Google Maps Premium API, pass `{ client: }` 47 | version: '...', // Optional 48 | language: '...', // Optional 49 | installComponents: true, // Optional (default: true) - false, if you want to locally install components 50 | vueGoogleMapsCompatibility: false, // Optional (default: false) - true, requires vue2-google-maps to be configured see https://github.com/xkjyeah/vue-google-maps 51 | }); 52 | ``` 53 | 54 | For use with `vue2-google-maps` 55 | ```javascript 56 | import Vue from 'vue'; 57 | import * as VueGoogleMaps from 'vue2-google-maps'; 58 | import VuetifyGoogleAutocomplete from 'vuetify-google-autocomplete'; 59 | 60 | // @see https://www.npmjs.com/package/vue2-google-maps 61 | Vue.use(VueGoogleMaps, { 62 | load: { 63 | key: 'xxxxxxxxs', 64 | // This is required to use the Autocomplete plugin 65 | libraries: 'places', // 'places,drawing,visualization' 66 | }, 67 | }); 68 | 69 | Vue.use(VuetifyGoogleAutocomplete, { 70 | /* 71 | not used as loaded with component 72 | apiKey: key, 73 | */ 74 | vueGoogleMapsCompatibility: true, 75 | }); 76 | 77 | 78 | ``` 79 | ### For version <= 1.1.0 80 | 81 | This component uses Google Maps Places API to get geo suggests for autocompletion, so you have to include the Google Maps Places API in the `` of your HTML: 82 | 83 | ```html 84 | 85 | 86 | 87 | … 88 | 89 | 90 | 91 | … 92 | 93 | 94 | ``` 95 | 96 | To obtain API key please visit the [Google Developer Console](https://console.developers.google.com). The API's that you have to enable in your Google API Manager Dashboard are [Google Maps Geocoding API](https://developers.google.com/maps/documentation/geocoding/start), [Google Places API Web Service](https://developers.google.com/places/web-service/) and [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/). 97 | 98 | ## Usage and API 99 | 100 | ### For version >= 2.0.0-alpha.1 101 | 102 | Simply start using the component in your HTML. 103 | 104 | ```html 105 | 112 | 113 | ``` 114 | 115 | ### For version <= 1.1.0 116 | 117 | The Vuetify Google Autocomplete works out of the box by just including it. 118 | 119 | ```js 120 | import VuetifyGoogleAutocomplete from 'vuetify-google-autocomplete' 121 | 122 | ``` 123 | 124 | In your template you can use this syntax: 125 | 126 | ```html 127 | 135 | 136 | ``` 137 | 138 | ### Properties 139 | 140 | **Please refer to the following for a list of all the properties supported by this library:** 141 | 142 | * [Vuetify text fields](https://vuetifyjs.com/en/components/text-fields), for all vuetify props supported. 143 | * [Props API Docs](https://madimetjashika.github.io/vuetify-google-autocomplete/docs/module-vuetify-google-autocomplete.props.html) or [JSDOCS.md file](https://github.com/MadimetjaShika/vuetify-google-autocomplete/blob/dev/JSDOCS.md), for living code documentation on props defined in this library. 144 | 145 | ### Events 146 | The component emits the following events, which you can listen in your application: 147 | 148 | #### placechanged 149 | Gets triggered when the address data got obtained. This data is available on the returned objects: 150 | * `street_number`, `route`, `locality`, `administrative_area_level_1`, `country`, `postal_code`, `latitude`, `longitude`. 151 | * `place` - [PlaceResult object](https://developers.google.com/maps/documentation/javascript/reference#PlaceResult) is available as second parameter. 152 | 153 | #### no-results-found 154 | Gets triggered when a user entered the name of a Place that was not suggested and pressed the Enter key, or the Place Details request failed. 155 | 156 | Pleae refer to [Vuetify text field events](https://vuetifyjs.com/en/components/text-fields) for all vuetify supported events. 157 | 158 | ### Exposed component functions 159 | 160 | These functions are accessible by setting "ref" on the component ([Refs documentation](https://vuejs.org/v2/guide/components.html#Child-Component-Refs)). See example below how to use these functions. 161 | 162 | #### clear() 163 | 164 | Call to clear the value of the user input. 165 | 166 | #### focus() 167 | 168 | Call focus to focus on the element 169 | 170 | #### blur() 171 | 172 | Call blur to blur (unfocus) the element 173 | 174 | #### update(value) 175 | 176 | Call to update the user input with a new value 177 | 178 | 179 | ### Example 180 | 181 | Please note that you need to provide the method that will listen (`v-on:placechanged`) to for an event when the address data is obtained. In the example below, the method is ``getAddressData``. 182 | 183 | ```html 184 | 198 | 199 | 224 | ``` 225 | 226 | ### Exposed component slots 227 | 228 | The slots available are proxied [`v-text-field`](https://vuetifyjs.com/en/components/text-fields/) slots. 229 | 230 | #### append 231 | 232 | Adds an item inside the input and after input content. (Note in underlying `v-text-field` this slot overrides `append-icon` prop.) 233 | 234 | #### append-outer 235 | 236 | Adds an item inside the input and after input content. (Note in underlying `v-text-field` this slot overrides `append-outer-icon` prop.) 237 | 238 | #### label 239 | 240 | Replaces the default label 241 | 242 | #### prepend 243 | 244 | Adds an item outside the input and before input content. (Note in underlying `v-text-field` this slot overrides `prepend-icon` prop.) 245 | 246 | #### prepend-inner 247 | 248 | Adds an item inside the input and before input content. (Note in underlying `v-text-field` this slot overrides `prepend-inner-icon` prop.) 249 | 250 | #### progress 251 | 252 | Slot for custom progress linear (displayed when **loading** prop is not equal to Boolean False) 253 | 254 | ### Example 255 | 256 | Use slots as you would any other component. Example below uses `append` which uses a component rather than the `append-icon` 257 | props (note: this defers slot behaviour back to the `v-text-field` implementation). 258 | 259 | ```html 260 | 278 | ``` 279 | 280 | ## Contributing 281 | 282 | Let's make this an awesome vuetify component! Collaborations and contributions are welcome! 283 | 284 | [code of conduct]: https://thoughtbot.com/open-source-code-of-conduct 285 | 286 | ### Contribution Guidlines 287 | 288 | Have a read through the [Contributor Code of Conduct](https://github.com/MadimetjaShika/vuetify-google-autocomplete/blob/master/CODE_OF_CONDUCT.md). Pretty standard, nothing hectic. 289 | 290 | Fork, then clone the repo: 291 | 292 | git clone git@github.com:your-username/vuetify-google-autocomplete.git 293 | 294 | Install dependencies with **npm** 295 | 296 | npm install 297 | 298 | or **yarn** 299 | 300 | yarn 301 | 302 | 303 | Make your changes, and observe them at dev-time by running 304 | 305 | npm run dev 306 | 307 | and going to the displayed URL to see your changes. 308 | 309 | Then, ensure tests are written for your changes. Ensure that your changes pass all the tests: 310 | 311 | npm run test 312 | 313 | Ensure that your changes are documented via JSDocs standard, then run 314 | 315 | npm run docs 316 | 317 | to update the JSDocs. 318 | 319 | If relevant, please ensure that you update the README and demo/example accordingly. 320 | 321 | Push to your fork and [submit a pull request](https://github.com/MadimetjaShika/vuetify-google-autocomplete/compare/). 322 | 323 | If all is well, your changes will be merged timeously! 324 | 325 | Feel free to also post issues for bug fixes or enhancements or anything. 326 | 327 | ### Roadmap 328 | 329 | I'm planning on updating this library to support the most latest version of vuetify during the month of December 2019. This would include potentially having this library as a vue cli 3.* supported plugin. 330 | 331 | If you've got any requests, please post them via issues and i'll look into them. 332 | 333 | PS - I am looking for people to help me maintain this library. The demand has grown since creation and unfortunately i'm unable to support it regularly at an acceptable rate. If you're keen, please drop me a mail me at madi@mjshika.xyz. 334 | -------------------------------------------------------------------------------- /tests/unit/coverage/lcov-report/helper.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for helper.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files helper.js 20 |

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

 46 | 
269 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 73 | 28 74 | 29 75 | 30 76 | 31 77 | 32 78 | 33 79 | 34 80 | 35 81 | 36 82 | 37 83 | 38 84 | 39 85 | 40 86 | 41 87 | 42 88 | 43 89 | 44 90 | 45 91 | 46 92 | 47 93 | 48 94 | 49 95 | 50 96 | 51 97 | 52 98 | 53 99 | 54 100 | 55 101 | 56 102 | 57 103 | 58 104 | 59 105 | 60 106 | 61 107 | 62 108 | 63 109 | 64 110 | 65 111 | 66 112 | 67 113 | 68 114 | 69 115 | 70 116 | 71 117 | 72 118 | 73 119 | 74 120 | 75  121 |   122 |   123 |   124 |   125 |   126 |   127 |   128 |   129 |   130 |   131 |   132 |   133 |   134 |   135 |   136 |   137 |   138 |   139 |   140 |   141 |   142 |   143 |   144 |   145 |   146 |   147 |   148 |   149 |   150 |   151 |   152 |   153 |   154 |   155 |   156 |   157 |   158 |   159 |   160 |   161 |   162 |   163 |   164 |   165 |   166 |   167 |   168 |   169 |   170 |   171 |   172 |   173 |   174 |   175 |   176 |   177 |   178 |   179 |   180 |   181 |   182 |   183 |   184 |   185 |   186 |   187 |   188 |   189 |   190 |   191 |   192 |   193 |   194 |  
/**
195 |  * Loads the Google Map API. Code adopted from {@link https://github.com/xkjyeah/vue-google-maps}
196 |  *
197 |  * @param {string|object} apiKey API Key, or object with the URL parameters. For example to use
198 |  * the Google Maps Premium API, pass { client: <YOUR-CLIENT-ID> }. You may pass the
199 |  * ersion (as 'v) as a property on this parameter.
200 |  * @param {string} version Google Maps SDK Version.
201 |  *
202 |  * Adapted from {@link https://github.com/xkjyeah/vue-google-maps}
203 |  * @see {@link https://github.com/xkjyeah/vue-google-maps}
204 |  * @access private
205 |  */
206 | const loadGoogleMaps = (apiKey, version, language) => {
207 |   try {
208 |     // If not within browser context, do not continue processing.
209 |     if (typeof window === 'undefined' || typeof document === 'undefined') {
210 |       return;
211 |     }
212 |  
213 |     if (typeof window.google === 'object' && typeof window.google.maps === 'object') {
214 |       if (typeof window.google.maps.places === 'object') {
215 |         return; // google is already loaded, don't try to load it again to prevent errors
216 |       }
217 |  
218 |       throw new Error('Google is already loaded, but does not contain the places API.');
219 |     }
220 |  
221 |     if (!window.vgaMapState.initMap) {
222 |       const googleMapScript = document.createElement('SCRIPT');
223 |  
224 |       // Allow apiKey to be an object.
225 |       // This is to support more esoteric means of loading Google Maps,
226 |       // such as Google for business
227 |       // https://developers.google.com/maps/documentation/javascript/get-api-key#premium-auth
228 |       const options = {};
229 |       if (typeof apiKey === 'string') {
230 |         options.key = apiKey;
231 |       } else if (typeof apiKey === 'object') {
232 |         Object.keys(apiKey).forEach((key) => {
233 |           options[key] = apiKey[key];
234 |         });
235 |       } else {
236 |         throw new Error('apiKey should either be a string or an object');
237 |       }
238 |  
239 |       options.libraries = 'places';
240 |       options.callback = 'initVGAMaps';
241 |  
242 |       const parameters = Object.keys(options).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(options[key])}`)
243 |         .join('&');
244 |  
245 |       let url = `https://maps.googleapis.com/maps/api/js?${parameters}`;
246 |  
247 |       if (version) {
248 |         url = `${url}&v=${version}`;
249 |       }
250 |  
251 |       if (language) {
252 |         url = `${url}&language=${language}`;
253 |       }
254 |  
255 |       googleMapScript.setAttribute('src', url);
256 |       googleMapScript.setAttribute('async', '');
257 |       googleMapScript.setAttribute('defer', '');
258 |       document.body.appendChild(googleMapScript);
259 |     } else {
260 |       throw new Error('Vuetify google autocomplete loaded multiple times.');
261 |     }
262 |   } catch (exception) {
263 |     throw new Error('Vuetify google autocomplete load error: ', exception);
264 |   }
265 | };
266 |  
267 | export default loadGoogleMaps;
268 |  
270 |
271 |
272 | 276 | 277 | 278 | 285 | 286 | 287 | 288 | -------------------------------------------------------------------------------- /example/components/Page2.vue: -------------------------------------------------------------------------------- 1 | 205 | 206 | 407 | 408 | 418 | -------------------------------------------------------------------------------- /example/components/Page3.vue: -------------------------------------------------------------------------------- 1 | 205 | 206 | 407 | 408 | 418 | -------------------------------------------------------------------------------- /example/components/Home.vue: -------------------------------------------------------------------------------- 1 | 205 | 206 | 407 | 408 | 418 | -------------------------------------------------------------------------------- /tests/unit/coverage/lcov-report/prettify.js: -------------------------------------------------------------------------------- 1 | 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"]); 2 | -------------------------------------------------------------------------------- /tests/unit/specs/Props.spec.js: -------------------------------------------------------------------------------- 1 | import { createLocalVue, mount } from 'vue-test-utils'; 2 | import Vuetify from 'vuetify'; 3 | import Vga from '@/index'; 4 | 5 | const localVue = createLocalVue(); 6 | let vuetify; 7 | let mandatoryProps; 8 | 9 | beforeEach(() => { 10 | vuetify = new Vuetify(); 11 | localVue.use(vuetify); 12 | mandatoryProps = { 13 | id: 'hellowWorld', 14 | }; 15 | }); 16 | 17 | describe('Ensure component props behave as expected', () => { 18 | describe('addressComponents', () => { 19 | test('Should have default value if not provided', () => { 20 | const defaultAddressCompoentValue = { 21 | street_number: 'short_name', 22 | route: 'long_name', 23 | locality: 'long_name', 24 | administrative_area_level_1: 'short_name', 25 | administrative_area_level_2: 'short_name', 26 | country: 'long_name', 27 | postal_code: 'short_name', 28 | }; 29 | const wrapper = mount(Vga, { 30 | localVue, 31 | vuetify, 32 | propsData: mandatoryProps, 33 | }); 34 | expect(wrapper.vm.$props.addressComponents).toEqual(defaultAddressCompoentValue); 35 | }); 36 | 37 | test('Should accept Object input', () => { 38 | mandatoryProps.addressComponents = { 39 | street_number: 'short_name', 40 | route: 'long_name', 41 | locality: 'long_name', 42 | administrative_area_level_1: 'long_name', 43 | administrative_area_level_2: 'long_name', 44 | country: 'long_name', 45 | postal_code: 'short_name', 46 | }; 47 | const wrapper = mount(Vga, { 48 | localVue, 49 | vuetify, 50 | propsData: mandatoryProps, 51 | }); 52 | expect(wrapper.vm.$props.addressComponents).toBe(mandatoryProps.addressComponents); 53 | }); 54 | }); 55 | 56 | // describe('append-icon', () => { 57 | // test('Should have "undefined" as default if not provided', () => { 58 | // const wrapper = mount(Vga, { 59 | // localVue, 60 | // vuetify, 61 | // propsData: mandatoryProps, 62 | // }); 63 | // expect(wrapper.vm.$props.appendIcon).toBeUndefined(); 64 | // }); 65 | 66 | // test('Should accept string input', () => { 67 | // mandatoryProps.appendIcon = 'search'; 68 | // const wrapper = mount(Vga, { 69 | // localVue, 70 | // vuetify, 71 | // propsData: mandatoryProps, 72 | // }); 73 | // expect(wrapper.vm.$props.appendIcon).toBe('search'); 74 | // }); 75 | // }); 76 | 77 | // describe('append-outer-icon', () => { 78 | // test('Should have "undefined" as default if not provided', () => { 79 | // const wrapper = mount(Vga, { 80 | // localVue, 81 | // vuetify, 82 | // propsData: mandatoryProps, 83 | // }); 84 | // expect(wrapper.vm.$props.appendOuterIcon).toBeUndefined(); 85 | // }); 86 | 87 | // test('Should accept string input', () => { 88 | // mandatoryProps.appendOuterIcon = 'search'; 89 | // const wrapper = mount(Vga, { 90 | // localVue, 91 | // vuetify, 92 | // propsData: mandatoryProps, 93 | // }); 94 | // expect(wrapper.vm.$props.appendOuterIcon).toBe('search'); 95 | // }); 96 | // }); 97 | 98 | describe('autofocus', () => { 99 | test('Should have false as default if not provided', () => { 100 | const wrapper = mount(Vga, { 101 | localVue, 102 | vuetify, 103 | propsData: mandatoryProps, 104 | }); 105 | expect(wrapper.vm.$props.autofocus).toBe(false); 106 | }); 107 | 108 | test('Should accept boolean input', () => { 109 | mandatoryProps.autofocus = true; 110 | const wrapper = mount(Vga, { 111 | localVue, 112 | vuetify, 113 | propsData: mandatoryProps, 114 | }); 115 | expect(wrapper.vm.$props.autofocus).toBe(true); 116 | }); 117 | }); 118 | 119 | describe('selection-required', () => { 120 | test('Should have false as default if not provided', () => { 121 | const wrapper = mount(Vga, { 122 | localVue, 123 | vuetify, 124 | propsData: mandatoryProps, 125 | }); 126 | expect(wrapper.vm.$props.selectionRequired).toBe(false); 127 | }); 128 | 129 | test('Should accept boolean input', () => { 130 | mandatoryProps.selectionRequired = true; 131 | const wrapper = mount(Vga, { 132 | localVue, 133 | vuetify, 134 | propsData: mandatoryProps, 135 | }); 136 | expect(wrapper.vm.$props.selectionRequired).toBe(true); 137 | }); 138 | }); 139 | 140 | describe('background-color', () => { 141 | test('Should have false as default if not provided', () => { 142 | const wrapper = mount(Vga, { 143 | localVue, 144 | vuetify, 145 | propsData: mandatoryProps, 146 | }); 147 | expect(wrapper.vm.$props.backgroundColor).toBe(undefined); 148 | }); 149 | 150 | test('Should accept boolean input', () => { 151 | mandatoryProps.backgroundColor = 'pink'; 152 | const wrapper = mount(Vga, { 153 | localVue, 154 | vuetify, 155 | propsData: mandatoryProps, 156 | }); 157 | expect(wrapper.vm.$props.backgroundColor).toBe('pink'); 158 | }); 159 | }); 160 | 161 | describe('clearable', () => { 162 | test('Should have false as default if not provided', () => { 163 | const wrapper = mount(Vga, { 164 | localVue, 165 | vuetify, 166 | propsData: mandatoryProps, 167 | }); 168 | expect(wrapper.vm.$props.clearable).toBe(false); 169 | }); 170 | 171 | test('Should accept boolean input', () => { 172 | mandatoryProps.clearable = true; 173 | const wrapper = mount(Vga, { 174 | localVue, 175 | vuetify, 176 | propsData: mandatoryProps, 177 | }); 178 | expect(wrapper.vm.$props.clearable).toBe(true); 179 | }); 180 | }); 181 | 182 | describe('color', () => { 183 | test('Should have "primary" as default if not provided', () => { 184 | const wrapper = mount(Vga, { 185 | localVue, 186 | vuetify, 187 | propsData: mandatoryProps, 188 | }); 189 | expect(wrapper.vm.$props.color).toBe(undefined); 190 | }); 191 | 192 | test('Should accept string input', () => { 193 | mandatoryProps.color = 'green'; 194 | const wrapper = mount(Vga, { 195 | localVue, 196 | vuetify, 197 | propsData: mandatoryProps, 198 | }); 199 | expect(wrapper.vm.$props.color).toBe('green'); 200 | }); 201 | }); 202 | 203 | describe('counter', () => { 204 | test('Should have "primary" as default if not provided', () => { 205 | const wrapper = mount(Vga, { 206 | localVue, 207 | vuetify, 208 | propsData: mandatoryProps, 209 | }); 210 | expect(wrapper.vm.$props.counter).toBeUndefined(); 211 | }); 212 | 213 | test('Should accept number input', () => { 214 | mandatoryProps.counter = 33; 215 | const wrapper = mount(Vga, { 216 | localVue, 217 | vuetify, 218 | propsData: mandatoryProps, 219 | }); 220 | expect(wrapper.vm.$props.counter).toBe(33); 221 | }); 222 | }); 223 | 224 | describe('country', () => { 225 | test('Should have "null" as default if not provided', () => { 226 | const wrapper = mount(Vga, { 227 | localVue, 228 | vuetify, 229 | propsData: mandatoryProps, 230 | }); 231 | expect(wrapper.vm.$props.country).toBeNull(); 232 | }); 233 | 234 | test('Should accept string input', () => { 235 | mandatoryProps.country = 'ZA'; 236 | const wrapper = mount(Vga, { 237 | localVue, 238 | vuetify, 239 | propsData: mandatoryProps, 240 | }); 241 | expect(wrapper.vm.$props.country).toBe('ZA'); 242 | }); 243 | 244 | test('Should accept array input', () => { 245 | mandatoryProps.country = ['ZA']; 246 | const wrapper = mount(Vga, { 247 | localVue, 248 | vuetify, 249 | propsData: mandatoryProps, 250 | }); 251 | expect(wrapper.vm.$props.country).toEqual(['ZA']); 252 | }); 253 | }); 254 | 255 | describe('dark', () => { 256 | test('Should have "false" as default if not provided', () => { 257 | const wrapper = mount(Vga, { 258 | localVue, 259 | vuetify, 260 | propsData: mandatoryProps, 261 | }); 262 | expect(wrapper.vm.$props.dark).toBe(false); 263 | }); 264 | 265 | test('Should accept boolean input', () => { 266 | mandatoryProps.dark = true; 267 | const wrapper = mount(Vga, { 268 | localVue, 269 | vuetify, 270 | propsData: mandatoryProps, 271 | }); 272 | expect(wrapper.vm.$props.dark).toBe(true); 273 | }); 274 | }); 275 | 276 | describe('disabled', () => { 277 | test('Should have "false" as default if not provided', () => { 278 | const wrapper = mount(Vga, { 279 | localVue, 280 | vuetify, 281 | propsData: mandatoryProps, 282 | }); 283 | expect(wrapper.vm.$props.disabled).toBe(false); 284 | }); 285 | 286 | test('Should accept boolean input', () => { 287 | mandatoryProps.disabled = true; 288 | const wrapper = mount(Vga, { 289 | localVue, 290 | vuetify, 291 | propsData: mandatoryProps, 292 | }); 293 | expect(wrapper.vm.$props.disabled).toBe(true); 294 | }); 295 | }); 296 | 297 | describe('enable-geolocation', () => { 298 | test('Should have "false" as default if not provided', () => { 299 | const wrapper = mount(Vga, { 300 | localVue, 301 | vuetify, 302 | propsData: mandatoryProps, 303 | }); 304 | expect(wrapper.vm.$props.enableGeolocation).toBe(false); 305 | }); 306 | 307 | test('Should accept boolean input', () => { 308 | mandatoryProps.enableGeolocation = true; 309 | const wrapper = mount(Vga, { 310 | localVue, 311 | vuetify, 312 | propsData: mandatoryProps, 313 | }); 314 | expect(wrapper.vm.$props.enableGeolocation).toBe(true); 315 | }); 316 | }); 317 | 318 | describe('error', () => { 319 | test('Should have "false" as default if not provided', () => { 320 | const wrapper = mount(Vga, { 321 | localVue, 322 | vuetify, 323 | propsData: mandatoryProps, 324 | }); 325 | expect(wrapper.vm.$props.error).toBe(false); 326 | }); 327 | 328 | test('Should accept boolean input', () => { 329 | mandatoryProps.error = true; 330 | const wrapper = mount(Vga, { 331 | localVue, 332 | vuetify, 333 | propsData: mandatoryProps, 334 | }); 335 | expect(wrapper.vm.$props.error).toBe(true); 336 | }); 337 | }); 338 | 339 | describe('error-messages', () => { 340 | test('Should have "[]" as default if not provided', () => { 341 | const wrapper = mount(Vga, { 342 | localVue, 343 | vuetify, 344 | propsData: mandatoryProps, 345 | }); 346 | expect(wrapper.vm.$props.errorMessages).toEqual([]); 347 | }); 348 | 349 | test('Should accept string input', () => { 350 | mandatoryProps.errorMessages = ['Hello World Error Message']; 351 | const wrapper = mount(Vga, { 352 | localVue, 353 | vuetify, 354 | propsData: mandatoryProps, 355 | }); 356 | expect(wrapper.vm.$props.errorMessages).toEqual(['Hello World Error Message']); 357 | }); 358 | }); 359 | 360 | describe('flat', () => { 361 | test('Should have "false" as default if not provided', () => { 362 | const wrapper = mount(Vga, { 363 | localVue, 364 | vuetify, 365 | propsData: mandatoryProps, 366 | }); 367 | expect(wrapper.vm.$props.flat).toBe(false); 368 | }); 369 | 370 | test('Should accept boolean input', () => { 371 | mandatoryProps.flat = true; 372 | const wrapper = mount(Vga, { 373 | localVue, 374 | vuetify, 375 | propsData: mandatoryProps, 376 | }); 377 | expect(wrapper.vm.$props.flat).toBe(true); 378 | }); 379 | }); 380 | 381 | describe('full-width', () => { 382 | test('Should have "false" as default if not provided', () => { 383 | const wrapper = mount(Vga, { 384 | localVue, 385 | vuetify, 386 | propsData: mandatoryProps, 387 | }); 388 | expect(wrapper.vm.$props.fullWidth).toBe(false); 389 | }); 390 | 391 | test('Should accept boolean input', () => { 392 | mandatoryProps.fullWidth = true; 393 | const wrapper = mount(Vga, { 394 | localVue, 395 | vuetify, 396 | propsData: mandatoryProps, 397 | }); 398 | expect(wrapper.vm.$props.fullWidth).toBe(true); 399 | }); 400 | }); 401 | 402 | describe('hide-details', () => { 403 | test('Should have "false" as default if not provided', () => { 404 | const wrapper = mount(Vga, { 405 | localVue, 406 | vuetify, 407 | propsData: mandatoryProps, 408 | }); 409 | expect(wrapper.vm.$props.hideDetails).toBe(false); 410 | }); 411 | 412 | test('Should accept boolean input', () => { 413 | mandatoryProps.hideDetails = true; 414 | const wrapper = mount(Vga, { 415 | localVue, 416 | vuetify, 417 | propsData: mandatoryProps, 418 | }); 419 | expect(wrapper.vm.$props.hideDetails).toBe(true); 420 | }); 421 | }); 422 | 423 | describe('hint', () => { 424 | test('Should have "undefined" as default if not provided', () => { 425 | const wrapper = mount(Vga, { 426 | localVue, 427 | vuetify, 428 | propsData: mandatoryProps, 429 | }); 430 | expect(wrapper.vm.$props.hint).toBeUndefined(); 431 | }); 432 | 433 | test('Should accept string input', () => { 434 | mandatoryProps.hint = 'A Hint'; 435 | const wrapper = mount(Vga, { 436 | localVue, 437 | vuetify, 438 | propsData: mandatoryProps, 439 | }); 440 | expect(wrapper.vm.$props.hint).toBe('A Hint'); 441 | }); 442 | }); 443 | 444 | describe('id', () => { 445 | test('Should have "undefined" as default if not provided', () => { 446 | const wrapper = mount(Vga, { 447 | localVue, 448 | vuetify, 449 | propsData: {}, 450 | }); 451 | expect(wrapper.vm.$props.id).toBeUndefined(); 452 | }); 453 | 454 | test('Should accept string input', () => { 455 | mandatoryProps.id = 'an-id-value'; 456 | const wrapper = mount(Vga, { 457 | localVue, 458 | vuetify, 459 | propsData: mandatoryProps, 460 | }); 461 | expect(wrapper.vm.$props.id).toBe('an-id-value'); 462 | }); 463 | }); 464 | 465 | // describe('label', () => { 466 | // test('Should have "undefined" as default if not provided', () => { 467 | // const wrapper = mount(Vga, { 468 | // localVue, 469 | // vuetify, 470 | // propsData: mandatoryProps, 471 | // }); 472 | // expect(wrapper.vm.$props.label).toBeUndefined(); 473 | // }); 474 | 475 | // test('Should accept string input', () => { 476 | // mandatoryProps.label = 'A Label'; 477 | // const wrapper = mount(Vga, { 478 | // localVue, 479 | // vuetify, 480 | // propsData: mandatoryProps, 481 | // }); 482 | // expect(wrapper.vm.$props.label).toBe('A Label'); 483 | // }); 484 | // }); 485 | 486 | describe('light', () => { 487 | test('Should have "false" as default if not provided', () => { 488 | const wrapper = mount(Vga, { 489 | localVue, 490 | vuetify, 491 | propsData: mandatoryProps, 492 | }); 493 | expect(wrapper.vm.$props.light).toBe(false); 494 | }); 495 | 496 | test('Should accept boolean input', () => { 497 | mandatoryProps.light = true; 498 | const wrapper = mount(Vga, { 499 | localVue, 500 | vuetify, 501 | propsData: mandatoryProps, 502 | }); 503 | expect(wrapper.vm.$props.light).toBe(true); 504 | }); 505 | }); 506 | 507 | // describe('loading', () => { 508 | // test('Should have "false" as default if not provided', () => { 509 | // const wrapper = mount(Vga, { 510 | // localVue, 511 | // vuetify, 512 | // propsData: mandatoryProps, 513 | // }); 514 | // expect(wrapper.vm.$props.loading).toBe(false); 515 | // }); 516 | 517 | // test('Should accept string input', () => { 518 | // mandatoryProps.loading = 'We are loading'; 519 | // const wrapper = mount(Vga, { 520 | // localVue, 521 | // vuetify, 522 | // propsData: mandatoryProps, 523 | // }); 524 | // expect(wrapper.vm.$props.loading).toBe('We are loading'); 525 | // }); 526 | 527 | // test('Should accept boolean input', () => { 528 | // mandatoryProps.loading = true; 529 | // const wrapper = mount(Vga, { 530 | // localVue, 531 | // vuetify, 532 | // propsData: mandatoryProps, 533 | // }); 534 | // expect(wrapper.vm.$props.loading).toBe(true); 535 | // }); 536 | // }); 537 | 538 | describe('mask', () => { 539 | test('Should have "undefined" as default if not provided', () => { 540 | const wrapper = mount(Vga, { 541 | localVue, 542 | vuetify, 543 | propsData: mandatoryProps, 544 | }); 545 | expect(wrapper.vm.$props.mask).toBeUndefined(); 546 | }); 547 | 548 | test('Should accept string input', () => { 549 | mandatoryProps.mask = '######'; 550 | const wrapper = mount(Vga, { 551 | localVue, 552 | vuetify, 553 | propsData: mandatoryProps, 554 | }); 555 | expect(wrapper.vm.$props.mask).toBe('######'); 556 | }); 557 | 558 | test('Should accept object input', () => { 559 | mandatoryProps.mask = {}; 560 | const wrapper = mount(Vga, { 561 | localVue, 562 | vuetify, 563 | propsData: mandatoryProps, 564 | }); 565 | expect(wrapper.vm.$props.mask).toEqual({}); 566 | }); 567 | }); 568 | 569 | describe('no-resize', () => { 570 | test('Should have "false" as default if not provided', () => { 571 | const wrapper = mount(Vga, { 572 | localVue, 573 | vuetify, 574 | propsData: mandatoryProps, 575 | }); 576 | expect(wrapper.vm.$props.noResize).toBe(false); 577 | }); 578 | 579 | test('Should accept boolean input', () => { 580 | mandatoryProps.noResize = true; 581 | const wrapper = mount(Vga, { 582 | localVue, 583 | vuetify, 584 | propsData: mandatoryProps, 585 | }); 586 | expect(wrapper.vm.$props.noResize).toBe(true); 587 | }); 588 | }); 589 | 590 | describe('persistent-hint', () => { 591 | test('Should have "false" as default if not provided', () => { 592 | const wrapper = mount(Vga, { 593 | localVue, 594 | vuetify, 595 | propsData: mandatoryProps, 596 | }); 597 | expect(wrapper.vm.$props.persistentHint).toBe(false); 598 | }); 599 | 600 | test('Should accept boolean input', () => { 601 | mandatoryProps.persistentHint = true; 602 | const wrapper = mount(Vga, { 603 | localVue, 604 | vuetify, 605 | propsData: mandatoryProps, 606 | }); 607 | expect(wrapper.vm.$props.persistentHint).toBe(true); 608 | }); 609 | }); 610 | 611 | describe('placeholder', () => { 612 | test('Should have "false" as default if not provided', () => { 613 | const wrapper = mount(Vga, { 614 | localVue, 615 | vuetify, 616 | propsData: mandatoryProps, 617 | }); 618 | expect(wrapper.vm.$props.placeholder).toBeUndefined(); 619 | }); 620 | 621 | test('Should accept string input', () => { 622 | mandatoryProps.placeholder = 'A Placeholder'; 623 | const wrapper = mount(Vga, { 624 | localVue, 625 | vuetify, 626 | propsData: mandatoryProps, 627 | }); 628 | expect(wrapper.vm.$props.placeholder).toBe('A Placeholder'); 629 | }); 630 | }); 631 | 632 | describe('placeName', () => { 633 | test('Should have "false" as default if not provided', () => { 634 | const wrapper = mount(Vga, { 635 | localVue, 636 | vuetify, 637 | propsData: mandatoryProps, 638 | }); 639 | expect(wrapper.vm.$props.placeName).toBe(false); 640 | }); 641 | 642 | test('Should accept boolean input', () => { 643 | mandatoryProps.placeName = true; 644 | const wrapper = mount(Vga, { 645 | localVue, 646 | vuetify, 647 | propsData: mandatoryProps, 648 | }); 649 | expect(wrapper.vm.$props.placeName).toBe(true); 650 | }); 651 | }); 652 | 653 | describe('prefix', () => { 654 | test('Should have "false" as default if not provided', () => { 655 | const wrapper = mount(Vga, { 656 | localVue, 657 | vuetify, 658 | propsData: mandatoryProps, 659 | }); 660 | expect(wrapper.vm.$props.prefix).toBeUndefined(); 661 | }); 662 | 663 | test('Should accept string input', () => { 664 | mandatoryProps.prefix = 'A Prefix'; 665 | const wrapper = mount(Vga, { 666 | localVue, 667 | vuetify, 668 | propsData: mandatoryProps, 669 | }); 670 | expect(wrapper.vm.$props.prefix).toBe('A Prefix'); 671 | }); 672 | }); 673 | 674 | // describe('prepend-icon', () => { 675 | // test('Should have "false" as default if not provided', () => { 676 | // const wrapper = mount(Vga, { 677 | // localVue, 678 | // vuetify, 679 | // propsData: mandatoryProps, 680 | // }); 681 | // expect(wrapper.vm.$props.prependIcon).toBeUndefined(); 682 | // }); 683 | 684 | // test('Should accept string input', () => { 685 | // mandatoryProps.prependIcon = 'A Prefix'; 686 | // const wrapper = mount(Vga, { 687 | // localVue, 688 | // vuetify, 689 | // propsData: mandatoryProps, 690 | // }); 691 | // expect(wrapper.vm.$props.prependIcon).toBe('A Prefix'); 692 | // }); 693 | // }); 694 | 695 | describe('readonly', () => { 696 | test('Should have "false" as default if not provided', () => { 697 | const wrapper = mount(Vga, { 698 | localVue, 699 | vuetify, 700 | propsData: mandatoryProps, 701 | }); 702 | expect(wrapper.vm.$props.readonly).toBe(false); 703 | }); 704 | 705 | test('Should accept boolean input', () => { 706 | mandatoryProps.readonly = true; 707 | const wrapper = mount(Vga, { 708 | localVue, 709 | vuetify, 710 | propsData: mandatoryProps, 711 | }); 712 | expect(wrapper.vm.$props.readonly).toBe(true); 713 | }); 714 | }); 715 | 716 | describe('return-masked-value', () => { 717 | test('Should have "false" as default if not provided', () => { 718 | const wrapper = mount(Vga, { 719 | localVue, 720 | vuetify, 721 | propsData: mandatoryProps, 722 | }); 723 | expect(wrapper.vm.$props.returnMaskedValue).toBe(false); 724 | }); 725 | 726 | test('Should accept boolean input', () => { 727 | mandatoryProps.returnMaskedValue = true; 728 | const wrapper = mount(Vga, { 729 | localVue, 730 | vuetify, 731 | propsData: mandatoryProps, 732 | }); 733 | expect(wrapper.vm.$props.returnMaskedValue).toBe(true); 734 | }); 735 | }); 736 | 737 | describe('rows', () => { 738 | test('Should have "5" as default if not provided', () => { 739 | const wrapper = mount(Vga, { 740 | localVue, 741 | vuetify, 742 | propsData: mandatoryProps, 743 | }); 744 | expect(wrapper.vm.$props.rows).toBe(5); 745 | }); 746 | 747 | test('Should accept number input', () => { 748 | mandatoryProps.rows = 10; 749 | const wrapper = mount(Vga, { 750 | localVue, 751 | vuetify, 752 | propsData: mandatoryProps, 753 | }); 754 | expect(wrapper.vm.$props.rows).toBe(10); 755 | }); 756 | 757 | test('Should accept string input', () => { 758 | mandatoryProps.rows = '1'; 759 | const wrapper = mount(Vga, { 760 | localVue, 761 | vuetify, 762 | propsData: mandatoryProps, 763 | }); 764 | expect(wrapper.vm.$props.rows).toBe('1'); 765 | }); 766 | }); 767 | 768 | // describe('rules', () => { 769 | // test('Should have "[]" as default if not provided', () => { 770 | // const wrapper = mount(Vga, { 771 | // localVue, 772 | // vuetify, 773 | // propsData: mandatoryProps, 774 | // }); 775 | // expect(wrapper.vm.$props.rules).toEqual([]); 776 | // }); 777 | 778 | // test('Should accept boolean input', () => { 779 | // const func = [() => {}]; 780 | // mandatoryProps.rules = func; 781 | // const wrapper = mount(Vga, { 782 | // localVue, 783 | // vuetify, 784 | // propsData: mandatoryProps, 785 | // }); 786 | // expect(wrapper.vm.$props.rules).toEqual(func); 787 | // }); 788 | // }); 789 | 790 | describe('single-line', () => { 791 | test('Should have "false" as default if not provided', () => { 792 | const wrapper = mount(Vga, { 793 | localVue, 794 | vuetify, 795 | propsData: mandatoryProps, 796 | }); 797 | expect(wrapper.vm.$props.singleLine).toBe(false); 798 | }); 799 | 800 | test('Should accept boolean input', () => { 801 | mandatoryProps.singleLine = true; 802 | const wrapper = mount(Vga, { 803 | localVue, 804 | vuetify, 805 | propsData: mandatoryProps, 806 | }); 807 | expect(wrapper.vm.$props.singleLine).toBe(true); 808 | }); 809 | }); 810 | 811 | describe('solo', () => { 812 | test('Should have "false" as default if not provided', () => { 813 | const wrapper = mount(Vga, { 814 | localVue, 815 | vuetify, 816 | propsData: mandatoryProps, 817 | }); 818 | expect(wrapper.vm.$props.solo).toBe(false); 819 | }); 820 | 821 | test('Should accept boolean input', () => { 822 | mandatoryProps.solo = true; 823 | const wrapper = mount(Vga, { 824 | localVue, 825 | vuetify, 826 | propsData: mandatoryProps, 827 | }); 828 | expect(wrapper.vm.$props.solo).toBe(true); 829 | }); 830 | }); 831 | 832 | describe('solo-inverted', () => { 833 | test('Should have "false" as default if not provided', () => { 834 | const wrapper = mount(Vga, { 835 | localVue, 836 | vuetify, 837 | propsData: mandatoryProps, 838 | }); 839 | expect(wrapper.vm.$props.soloInverted).toBe(false); 840 | }); 841 | 842 | test('Should accept boolean input', () => { 843 | mandatoryProps.soloInverted = true; 844 | const wrapper = mount(Vga, { 845 | localVue, 846 | vuetify, 847 | propsData: mandatoryProps, 848 | }); 849 | expect(wrapper.vm.$props.soloInverted).toBe(true); 850 | }); 851 | }); 852 | 853 | describe('suffix', () => { 854 | test('Should have "undefined" as default if not provided', () => { 855 | const wrapper = mount(Vga, { 856 | localVue, 857 | vuetify, 858 | propsData: mandatoryProps, 859 | }); 860 | expect(wrapper.vm.$props.suffix).toBeUndefined(); 861 | }); 862 | 863 | test('Should accept string input', () => { 864 | mandatoryProps.suffix = 'A Suffix'; 865 | const wrapper = mount(Vga, { 866 | localVue, 867 | vuetify, 868 | propsData: mandatoryProps, 869 | }); 870 | expect(wrapper.vm.$props.suffix).toBe('A Suffix'); 871 | }); 872 | }); 873 | 874 | describe('textarea', () => { 875 | test('Should have "false" as default if not provided', () => { 876 | const wrapper = mount(Vga, { 877 | localVue, 878 | vuetify, 879 | propsData: mandatoryProps, 880 | }); 881 | expect(wrapper.vm.$props.textarea).toBe(false); 882 | }); 883 | 884 | test('Should accept boolean input', () => { 885 | mandatoryProps.textarea = true; 886 | const wrapper = mount(Vga, { 887 | localVue, 888 | vuetify, 889 | propsData: mandatoryProps, 890 | }); 891 | expect(wrapper.vm.$props.textarea).toBe(true); 892 | }); 893 | }); 894 | 895 | describe('toggle-keys', () => { 896 | test('Should have "[13, 32]" as default if not provided', () => { 897 | const wrapper = mount(Vga, { 898 | localVue, 899 | vuetify, 900 | propsData: mandatoryProps, 901 | }); 902 | expect(wrapper.vm.$props.toggleKeys).toEqual([13, 32]); 903 | }); 904 | 905 | test('Should accept array input', () => { 906 | mandatoryProps.toggleKeys = ['Hellow']; 907 | const wrapper = mount(Vga, { 908 | localVue, 909 | vuetify, 910 | propsData: mandatoryProps, 911 | }); 912 | expect(wrapper.vm.$props.toggleKeys).toEqual(['Hellow']); 913 | }); 914 | }); 915 | 916 | describe('type', () => { 917 | test('Should have "text" as default if not provided', () => { 918 | const wrapper = mount(Vga, { 919 | localVue, 920 | propsData: mandatoryProps, 921 | }); 922 | expect(wrapper.vm.$props.type).toBe('text'); 923 | }); 924 | 925 | test('Should accept string input', () => { 926 | mandatoryProps.type = 'number'; 927 | const wrapper = mount(Vga, { 928 | localVue, 929 | propsData: mandatoryProps, 930 | }); 931 | expect(wrapper.vm.$props.type).toBe('number'); 932 | }); 933 | }); 934 | 935 | describe('types', () => { 936 | test('Should have "address" as default if not provided', () => { 937 | const wrapper = mount(Vga, { 938 | localVue, 939 | vuetify, 940 | propsData: mandatoryProps, 941 | }); 942 | expect(wrapper.vm.$props.types).toBe('address'); 943 | }); 944 | 945 | test('Should accept string input', () => { 946 | mandatoryProps.types = 'postal'; 947 | const wrapper = mount(Vga, { 948 | localVue, 949 | vuetify, 950 | propsData: mandatoryProps, 951 | }); 952 | expect(wrapper.vm.$props.types).toBe('postal'); 953 | }); 954 | }); 955 | 956 | describe('validate-on-blur', () => { 957 | test('Should have "address" as default if not provided', () => { 958 | const wrapper = mount(Vga, { 959 | localVue, 960 | vuetify, 961 | propsData: mandatoryProps, 962 | }); 963 | expect(wrapper.vm.$props.validateOnBlur).toBe(false); 964 | }); 965 | 966 | test('Should accept string input', () => { 967 | mandatoryProps.validateOnBlur = true; 968 | const wrapper = mount(Vga, { 969 | localVue, 970 | vuetify, 971 | propsData: mandatoryProps, 972 | }); 973 | expect(wrapper.vm.$props.validateOnBlur).toBe(true); 974 | }); 975 | }); 976 | 977 | describe('value', () => { 978 | test('Should have "undefined" as default if not provided', () => { 979 | const wrapper = mount(Vga, { 980 | localVue, 981 | vuetify, 982 | propsData: mandatoryProps, 983 | }); 984 | expect(wrapper.vm.$props.value).toBeUndefined(); 985 | }); 986 | 987 | test('Should accept string input', () => { 988 | mandatoryProps.value = 'Some Prepopulated, Address, Somewhere, Earth'; 989 | const wrapper = mount(Vga, { 990 | localVue, 991 | vuetify, 992 | propsData: mandatoryProps, 993 | }); 994 | expect(wrapper.vm.$props.value).toBe('Some Prepopulated, Address, Somewhere, Earth'); 995 | }); 996 | }); 997 | }); 998 | --------------------------------------------------------------------------------