{"_id":"@behance/jasmine-vue","_rev":"48-1792f30d709ef5b55dc57d3dccce25df","name":"@behance/jasmine-vue","description":"Jasmine test helper for Vue files","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@behance/jasmine-vue","version":"1.0.0","description":"Jasmine test helper for Vue files","main":"dist/index.js","scripts":{"test":"npm run eslint && npm run karma -- --single-run --reporters=progress,coverage","test:dev":"npm run karma -- --reporters=mocha,coverage","eslint":"eslint src/**/*.js test/**/*.js","karma":"cross-env NODE_ENV=test karma start","webpack":"webpack --progress --color --watch","watch":"babel src --watch --out-dir dist && git add dist","preversion":"babel src --out-dir dist && git add dist"},"repository":{"type":"git","url":"git+https://github.com/behance/jasmine-vue.git"},"author":{"name":"Matt O'Connell","email":"mattoconnell408@gmail.com"},"license":"Apache-2.0","bugs":{"url":"https://github.com/behance/jasmine-vue/issues"},"homepage":"https://github.com/behance/jasmine-vue#readme","devDependencies":{"babel-cli":"^6.24.1","babel-core":"^6.14.0","babel-loader":"^6.2.5","babel-polyfill":"^6.23.0","babel-preset-behance":"^3.1.0","cross-env":"^3.1.2","eslint":"^3.5.0","eslint-plugin-behance":"^1.0.0","eslint-preset-behance":"^4.0.0","jasmine-core":"^2.5.2","karma":"^1.3.0","karma-coverage":"^1.1.1","karma-jasmine":"^1.0.2","karma-mocha-reporter":"^2.2.0","karma-phantomjs-launcher":"^1.0.2","karma-webpack":"^1.8.0","vue":"^2.3.2","vuex":"^2.3.1","webpack":"^2.1.0-beta.25"},"gitHead":"f9361741c63b20ef31b717dd709ca687ee981b94","_id":"@behance/jasmine-vue@1.0.0","_shasum":"5f05d649ad3b00313b3c19a59ca03cd186d047ea","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.11.0","_npmUser":{"name":"matt-oconnell","email":"mattoconnell408@gmail.com"},"dist":{"shasum":"5f05d649ad3b00313b3c19a59ca03cd186d047ea","tarball":"https://registry.npmjs.org/@behance/jasmine-vue/-/jasmine-vue-1.0.0.tgz","integrity":"sha512-AklFqvOTLuf8LaCdJ5f6ueGgg4TbfffbygsDCuiqoiEru0+9PfvQnGcQWe3x2CapwVNMd1b/xrtdkHSGTOBabA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCubI/87JF7mncPEK9H0BA09S5XloDYdYNxeeu7JoXPAAIhAPG7RLsPHhwPkk7EzkSrl6A33dGsxGJruMwF6I7LJmZy"}]},"maintainers":[{"name":"matt-oconnell","email":"mattoconnell408@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jasmine-vue-1.0.0.tgz_1503070532739_0.6257593114860356"},"directories":{}}},"readme":"# jasmine-vue [![npm](https://img.shields.io/npm/v/jasmine-vue.svg)](https://www.npmjs.com/package/jasmine-vue)\n\nJasmine test helper for Vue components\n\n> Requires [`jasmine`](https://github.com/jasmine/jasmine).\n\n## Install\n\n```\n$ npm install --save-dev jasmine-vue\n```\n\nJasmine Vue abstracts away some of the boilerplate required when testing Vue components. Currently it helps with the setup, mounting, and destruction of a component.\n\n## Setup\n\nInclude `jasmine-vue` in the root file of your tests using `require`.\n\n```javascript\nrequire('jasmine-vue');\n```\n\n## Initialization\n\nA `vueInit` function will be available in the test context. It returns a creator object that is used to mount component instances. `vueInit` takes in an optional set of default props. It will generally only need to be called once per component test file.\n\n```javascript\nbeforeEach(function() {\n  const defaultProps = {\n    myProp: true,\n  };\n  // Initialize\n  this.componentCreator = this.vueInit(MyComponent, defaultProps);\n});\n```\n\n## Mounting / Rendering Components\n\nUse  the creator returned from `vueInit` to mount the component.\n\n#### creator.mount( { [customPropsData], [store], [componentOverrides], el } )\n\n- Arguments:\n    - {Object} customPropsData (optional)\n        - will overwrite `defaultProps` passed into `vueInit`, otherwise defaults to them\n    - {Object} store (optional)\n        - creates a `new Vuex.Store` on the passed-in object and sets it on the instance\n    - {Object} componentOverrides (optional)\n        - will override any instance properties\n        - can be used to spy on or stub lifecycle methods\n    - {String|Element} El (optional)\n        - will mount Vue component to an element selector or to an element that is passed in\n        - if left blank, it will mount to body\n- Usage:\n\nWithout any arguments:\n\n```javascript\nit('renders my component with default props', function() {\n  const vm = this.componentCreator.mount();\n  expect($(vm.$el)).toBeInDOM(); // using jasmine-jquery\n  expect(vm.myProp).toEqual(true);\n});\n```\n\nWith custom props data:\n\n```javascript\nit('renders my component using custom props', function() {\n  const vm = this.componentCreator.mount({ propsData: { myProp: false } });\n  expect(vm.myProp).toEqual(false);\n});\n```\n\nWith a store:\n\n```javascript\nit('renders my component using custom props and a Vuex store', function() {\n  const vm = this.componentCreator.mount({}, {\n    state: {\n      text: 'abc123',\n    },\n  });\n  expect(vm.$store.state.text).toEqual('abc123');\n});\n```\n\nWith a component override:\n\n```javascript\nit('renders my component using custom props and a Vuex store', function() {\n  const spy = jasmine.createSpy('spy');\n  const vm = this.componentCreator.mount({}, {}, {\n    beforeMount: spy\n  });\n  expect(spy).toHaveBeenCalled();\n});\n```\n\n#### creator.mountSolo( { [customPropsData], [store], [componentOverrides], el } )\n\n```javascript\nbeforeEach(function() {\n    this.vm = this.componentCreator.mount();\n});\n\nit('clears all previously mounted components and mounts a solo component', function() {\n  const soloVm = this.componentCreator.mountSolo();\n  expect($(this.vm.$el)).not.toBeInDOM();\n  expect($(soloVm.$el)).toBeInDOM();\n});\n```\n\n## Clean up\n\nIn each `afterEach` phase, if components have been mounted, `jasmine-vue` will automatically remove the component DOM element and call Vue's `$destroy` method.\n\n#### vuePreventDestroy\n\nAvailable as `this.vuePreventDestroy`, this method will disable the `afterEach` cleanup of components. This (combined with `fit` or `fdescribe`) allows for some nice sandboxing of components. Focus the test, call `this.vuePreventDestroy`, and open the browser and access the component in its current state. Unlike using the debugger, this allows for interacting with the component in it's current state.\n\n## License\n\n[Apache-2.0](/LICENSE)\n","maintainers":[{"email":"chthomas@adobe.com","name":"chthomas"},{"email":"yumiao@adobe.com","name":"lanniemiao"},{"email":"trajano@adobe.com","name":"mtrajano93"},{"email":"moskalen@adobe.com","name":"moskalen"},{"email":"elewis@adobe.com","name":"elewis"},{"email":"mun.mansi@gmail.com","name":"mansinarain"},{"email":"sean@attamusc.com","name":"attamusc"},{"email":"weikin.huang04@gmail.com","name":"weikinhuang"},{"email":"mike@masedesign.com","name":"mase"},{"email":"agaripian@gmail.com","name":"agaripian"},{"email":"nemtsov@gmail.com","name":"nemtsov"},{"email":"bpackman@gmail.com","name":"bryanpackman"},{"email":"mattoconnell408@gmail.com","name":"matt-oconnell"},{"email":"mlebrun15@gmail.com","name":"mlebrun"},{"email":"andrewlandry@gmail.com","name":"andyroo2000"},{"email":"ing.luisjimenez@gmail.com","name":"ingluisjimenez"},{"email":"gtucker@adobe.com","name":"gtuckeradobe"},{"email":"tpaparne@gmail.com","name":"tpaparne"},{"email":"sapit@adobe.com","name":"danicasapit"},{"email":"dfoxinator@gmail.com","name":"dfoxinator"},{"email":"jelee@adobe.com","name":"jelee11"},{"email":"medoy@adobe.com","name":"jmedoy"},{"email":"joneseymalcolm@gmail.com","name":"bossjones"},{"email":"manny.toledo@gmail.com","name":"mtldo"},{"email":"shean@adobe.com","name":"jushean"},{"email":"bryan.latten@gmail.com","name":"bryanlatten"},{"email":"sadraei@adobe.com","name":"sadraei"},{"email":"fogel@adobe.com","name":"tracyfogel"},{"email":"kangdaniels+npm@gmail.com","name":"kangman"},{"email":"lis@adobe.com","name":"iooi"},{"email":"benake@adobe.com","name":"benake"},{"email":"be.davestein@gmail.com","name":"davestein"}],"time":{"modified":"2022-06-12T15:07:48.410Z","created":"2017-08-18T15:35:32.827Z","1.0.0":"2017-08-18T15:35:32.827Z"},"homepage":"https://github.com/behance/jasmine-vue#readme","repository":{"type":"git","url":"git+https://github.com/behance/jasmine-vue.git"},"author":{"name":"Matt O'Connell","email":"mattoconnell408@gmail.com"},"bugs":{"url":"https://github.com/behance/jasmine-vue/issues"},"license":"Apache-2.0","readmeFilename":"README.md"}