`
28 | }).join('')
29 | }
30 |
31 | export default subnodesToHTML
32 |
--------------------------------------------------------------------------------
/test/index.js:
--------------------------------------------------------------------------------
1 | // Polyfill fn.bind() for PhantomJS
2 | import bind from 'function-bind'
3 | /* eslint-disable no-extend-native */
4 | Function.prototype.bind = bind
5 |
6 | // Polyfill Object.assign for PhantomJS
7 | import objectAssign from 'object-assign'
8 | Object.assign = objectAssign
9 |
10 | // require all src files for coverage.
11 | // you can also change this to match only the subset of files that
12 | // you want coverage for.
13 | const srcContext = require.context('../src', true, /^\.\/(?!index(\.js)?$)/)
14 | srcContext.keys().forEach(srcContext)
15 |
16 | // Use a div to insert elements
17 | before(function () {
18 | const el = document.createElement('DIV')
19 | el.id = 'tests'
20 | document.body.appendChild(el)
21 | })
22 |
23 | // Remove every test html scenario
24 | afterEach(function () {
25 | const el = document.getElementById('tests')
26 | for (let i = 0; i < el.children.length; ++i) {
27 | el.removeChild(el.children[i])
28 | }
29 | })
30 |
31 | const specsContext = require.context('./specs', true)
32 | specsContext.keys().forEach(specsContext)
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 Antério vieira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | 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, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributions are **welcome** and will be fully **credited**.
4 |
5 | We accept contributions via Pull Requests on [Github](https://github.com/anteriovieira/vue-mindmap).
6 |
7 |
8 | ## Pull Requests
9 |
10 | - **Keep the same style** - eslint will automatically be ran before committing
11 |
12 | - **Tip** to pass lint tests easier use the `npm run lint:fix` command
13 |
14 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests.
15 |
16 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
17 |
18 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
19 |
20 | - **Create feature branches** - Don't ask us to pull from your master branch.
21 |
22 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
23 |
24 | - **Send coherent history** - Make sure your commits message means something
25 |
26 |
27 | ## Running Tests
28 |
29 | Launch visual tests and watch the components at the same time
30 |
31 | ``` bash
32 | $ npm run dev
33 | ```
34 |
35 |
36 | **Happy coding**!
37 |
--------------------------------------------------------------------------------
/test/helpers/wait-for-update.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue/dist/vue.js'
2 |
3 | // Testing helper
4 | // nextTick().then(() => {
5 | //
6 | // Automatically waits for nextTick
7 | // }).then(() => {
8 | // return a promise or value to skip the wait
9 | // })
10 | function nextTick () {
11 | const jobs = []
12 | let done
13 |
14 | const chainer = {
15 | then (cb) {
16 | jobs.push(cb)
17 | return chainer
18 | }
19 | }
20 |
21 | function shift (...args) {
22 | const job = jobs.shift()
23 | let result
24 | try {
25 | result = job(...args)
26 | } catch (e) {
27 | jobs.length = 0
28 | done(e)
29 | }
30 |
31 | // wait for nextTick
32 | if (result !== undefined) {
33 | if (result.then) {
34 | result.then(shift)
35 | } else {
36 | shift(result)
37 | }
38 | } else if (jobs.length) {
39 | requestAnimationFrame(() => Vue.nextTick(shift))
40 | }
41 | }
42 |
43 | // First time
44 | Vue.nextTick(() => {
45 | done = jobs[jobs.length - 1]
46 | if (done.toString().slice(0, 14) !== 'function (err)') {
47 | throw new Error('waitForUpdate chain is missing .then(done)')
48 | }
49 | shift()
50 | })
51 |
52 | return chainer
53 | }
54 |
55 | exports.nextTick = nextTick
56 | exports.delay = time => new Promise(resolve => setTimeout(resolve, time))
57 |
--------------------------------------------------------------------------------
/test/karma.conf.js:
--------------------------------------------------------------------------------
1 | const merge = require('webpack-merge')
2 | const baseConfig = require('../build/webpack.config.dev.js')
3 |
4 | const webpackConfig = merge(baseConfig, {
5 | // use inline sourcemap for karma-sourcemap-loader
6 | devtool: '#inline-source-map'
7 | })
8 |
9 | webpackConfig.plugins = []
10 |
11 | const vueRule = webpackConfig.module.rules.find(rule => rule.loader === 'vue-loader')
12 | vueRule.options = vueRule.options || {}
13 | vueRule.options.loaders = vueRule.options.loaders || {}
14 | vueRule.options.loaders.js = 'babel-loader'
15 |
16 | // no need for app entry during tests
17 | delete webpackConfig.entry
18 |
19 | module.exports = function (config) {
20 | config.set({
21 | // to run in additional browsers:
22 | // 1. install corresponding karma launcher
23 | // http://karma-runner.github.io/0.13/config/browsers.html
24 | // 2. add it to the `browsers` array below.
25 | browsers: ['Chrome'],
26 | frameworks: ['mocha', 'chai-dom', 'sinon-chai'],
27 | reporters: ['spec', 'coverage'],
28 | files: ['./index.js'],
29 | preprocessors: {
30 | './index.js': ['webpack', 'sourcemap']
31 | },
32 | webpack: webpackConfig,
33 | webpackMiddleware: {
34 | noInfo: true
35 | },
36 | coverageReporter: {
37 | dir: './coverage',
38 | reporters: [
39 | { type: 'lcov', subdir: '.' },
40 | { type: 'text-summary' }
41 | ]
42 | }
43 | })
44 | }
45 |
--------------------------------------------------------------------------------
/test/helpers/index.js:
--------------------------------------------------------------------------------
1 | import camelcase from 'camelcase'
2 | import { createVM, Vue } from './utils'
3 | import { nextTick } from './wait-for-update'
4 |
5 | export function dataPropagationTest (Component) {
6 | return function () {
7 | const spy = sinon.spy()
8 | const vm = createVM(this, function (h) {
9 | return (
10 |