Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusBorg committed Apr 18, 2019
2 parents f93a5f0 + a035cfe commit 3a23df9
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 139 deletions.
4 changes: 2 additions & 2 deletions dist/portal-vue.common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/portal-vue.common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/portal-vue.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/portal-vue.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/portal-vue.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*!
* portal-vue © Thorsten Lünborg, 2019
*
* Version: 2.1.0
* Version: 2.1.1
*
* LICENCE: MIT
*
Expand Down Expand Up @@ -536,7 +536,7 @@
_props.name = this.to;
this.portalTarget = new PortalTarget({
el: el,
// parent: this,
parent: this.$parent || this,
propsData: _props
});
},
Expand Down
4 changes: 2 additions & 2 deletions dist/portal-vue.umd.min.js

Large diffs are not rendered by default.

124 changes: 0 additions & 124 deletions docs/.vuepress/components/KoFiButton.vue

This file was deleted.

2 changes: 2 additions & 0 deletions docs/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import PortalVue from '../../dist/portal-vue.esm'
import VueResize from 'vue-resize'
import NoSsr from 'vue-no-ssr'
import KoFiButton from '@linusborg/vue-ko-fi-button'

export default ({ Vue }) => {
Vue.use(PortalVue)
Vue.use(VueResize)
Vue.component('NoSsr', NoSsr)
Vue.component('KoFiButton', KoFiButton)
Vue.prototype.$__VERSION__ = process.env.VERSION

if (typeof window !== 'undefined') {
Expand Down
8 changes: 5 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ sidebar: false
<Hero />

<div style="display: flex; justify-content: center; margin: 30px auto;">
<KoFiButton>
Support me with a coffee
</KoFiButton>
<KoFiButton
username="linusborg"
title="Support me with a coffee?"
color="rgb(208,126,27)"
/>
</div>

## Usage example
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portal-vue",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",
"repository": "https://github.com/LinusBorg/portal-vue",
"author": {
Expand Down Expand Up @@ -37,6 +37,7 @@
},
"devDependencies": {
"@babel/runtime-corejs2": "^7.1.5",
"@linusborg/vue-ko-fi-button": "^0.1.0",
"@types/jest": "^23.1.4",
"@vue/cli-plugin-babel": "^3.1.0",
"@vue/cli-plugin-e2e-cypress": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/mounting-portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default (Vue as withPortalTarget).extend({

this.portalTarget = new PortalTarget({
el,
// parent: this,
parent: this.$parent || this,
propsData: _props,
})
},
Expand Down
36 changes: 36 additions & 0 deletions tests/unit/specs/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ function mountScenario(Component, options = {}, all = false) {

describe('Integration Tests', () => {
beforeEach(() => {
const el = document.querySelector('#target')
if (el) {
el.parentNode.removeChild(el)
}
// ad a fresh version to the body
const newEl = document.createElement('DIV')
newEl.id = 'target'
document.body.appendChild(newEl)

Wormhole.transports = {}
Wormhole.targets = {}
Wormhole.sources = {}
Expand Down Expand Up @@ -159,4 +168,31 @@ describe('Integration Tests', () => {
expect(pWrapper.at(0).text()).toBe('Content2')
expect(pWrapper.at(1).text()).toBe('Content1')
})

it('MountingPortal sets parent of PortalTarget to its parent', async () => {
const spy = jest.fn()
const Component = {
template: `
<div>
<MountingPortal mountTo="#target" >
<Child />
</MountingPortal>
</div>
`,
components: {
Child: {
template: `<div />`,
created() {
spy(this.$parent.$parent)
},
},
},
}
const { wrapper } = mountScenario(Component)

await Vue.nextTick()
const parent = spy.mock.calls[0][0]
expect(parent).toBeDefined()
expect(spy.mock.calls[0][0]).toBe(wrapper.vm)
})
})
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,11 @@
cssnano-preset-default "^4.0.0"
postcss "^7.0.0"

"@linusborg/vue-ko-fi-button@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@linusborg/vue-ko-fi-button/-/vue-ko-fi-button-0.1.0.tgz#1d82a081b67058501f2b9572bae1a998e90d1324"
integrity sha512-sTNTDkoQl8UxIGHB3pFJ/2vzrfAZcU6J3BH/utRPN5exjsHM2vYfYEDz3IHAhO0/kiHsZwk+hyErW0w0/sjfvg==

"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
Expand Down

0 comments on commit 3a23df9

Please sign in to comment.