Skip to content

Commit 754c3a8

Browse files
LinusBorgmohdshakirdsanders11mitarnekuz0r
authored
Release 2.1.5 (#231)
* Update installation.md (#218) Added .com TLD to CDN URL * Fix typos in docs (#219) * Fix typos in docs * Fix typos * docs: Remove outdated line from poral-target docs I think this is something from the previous version * fix: Wormhole.close force=true and from=undefined * deps: remove cypress we don't have e2e tests right now. package takes up considerable size * example: programmatic example should use right build file. * build: 2.1.5 Co-authored-by: Mohd Shakir Zakaria <[email protected]> Co-authored-by: David Sanders <[email protected]> Co-authored-by: Mitar <[email protected]> Co-authored-by: Gohy Leandre <[email protected]>
1 parent c49a452 commit 754c3a8

File tree

17 files changed

+79
-657
lines changed

17 files changed

+79
-657
lines changed

dist/portal-vue.common.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/portal-vue.esm.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/portal-vue.umd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*!
33
* portal-vue © Thorsten Lünborg, 2019
44
*
5-
* Version: 2.1.4
5+
* Version: 2.1.5
66
*
77
* LICENCE: MIT
88
*

dist/portal-vue.umd.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/portal-target.md

-2
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ Emitted everytime the component re-renders because the content from the `<Portal
286286

287287
It receives two arguments, each is a `Boolean`, indicating the absense or presence of content for the target.
288288

289-
The first argument is represents the current contents, the second one the previous contents (just like the arguments of a `watch` handler in a Vue component)
290-
291289
<!-- prettier-ignore -->
292290
```html {4}
293291
<template>

example/components/programmatic/index.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929

3030
<script lang="ts">
3131
import Vue from 'vue'
32-
import { Wormhole } from 'portal-vue'
33-
// const { Wormhole } =
34-
// process.env.NODE_ENV === 'production'
35-
// ? require('@/../dist/portal-vue.common.js')
36-
// : require('@/index').default
32+
33+
const { Wormhole } =
34+
process.env.NODE_ENV === 'production'
35+
? require('@/../dist/portal-vue.common.js')
36+
: require('@/index').default
3737
3838
export default Vue.extend({
3939
data() {

package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "portal-vue",
3-
"version": "2.1.4",
3+
"version": "2.1.5",
44
"license": "MIT",
55
"repository": "https://github.com/LinusBorg/portal-vue",
66
"author": {
@@ -17,8 +17,7 @@
1717
"minify": "minify dist/portal-vue.umd.js --out-file dist/portal-vue.umd.min.js",
1818
"lint": "vue-cli-service lint",
1919
"test": "yarn test:unit",
20-
"test:unit": "vue-cli-service test:unit",
21-
"test:e2e": "vue-cli-service test:e2e"
20+
"test:unit": "vue-cli-service test:unit"
2221
},
2322
"main": "dist/portal-vue.umd.js",
2423
"module": "dist/portal-vue.esm.js",
@@ -40,7 +39,6 @@
4039
"@linusborg/vue-ko-fi-button": "^0.1.0",
4140
"@types/jest": "^23.1.4",
4241
"@vue/cli-plugin-babel": "^3.1.0",
43-
"@vue/cli-plugin-e2e-cypress": "^3.1.0",
4442
"@vue/cli-plugin-eslint": "^3.1.0",
4543
"@vue/cli-plugin-typescript": "^3.1.0",
4644
"@vue/cli-plugin-unit-jest": "^3.1.0",

src/components/wormhole.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const Wormhole = Vue.extend({
5454

5555
close(transport: TransportVector, force = false) {
5656
const { to, from } = transport
57-
if (!to || !from) return
57+
if (!to || (!from && force === false)) return
5858
if (!this.transports[to]) {
5959
return
6060
}

src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface Transport {
3434

3535
export interface TransportVector {
3636
to: string
37-
from: string
37+
from?: string
3838
}
3939

4040
export type PropWithComponent =

tests/e2e/.eslintrc

-12
This file was deleted.

tests/e2e/plugins/index.js

-11
This file was deleted.

tests/e2e/specs/test.js

-8
This file was deleted.

tests/e2e/support/commands.js

-25
This file was deleted.

tests/e2e/support/index.js

-20
This file was deleted.

tests/unit/specs/wormhole.spec.js

+38
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,44 @@ describe('Wormhole', function() {
100100
expect(wormhole.transports).toEqual({ target: [] })
101101
})
102102

103+
it('removes content on close() when force=true and from=undefined', () => {
104+
wormhole.open({
105+
from: 'test-portal',
106+
to: 'target',
107+
passengers: ['Test'],
108+
})
109+
110+
wormhole.close(
111+
{
112+
to: 'target',
113+
},
114+
true
115+
) // force argument
116+
expect(wormhole.transports).toEqual({ target: [] })
117+
})
118+
119+
it('closes all transports to the same target when force=true and from=undefined', () => {
120+
wormhole.open({
121+
from: 'test-portal1',
122+
to: 'target',
123+
passengers: ['Test1'],
124+
})
125+
126+
wormhole.open({
127+
from: 'test-portal2',
128+
to: 'target',
129+
passengers: ['Test2'],
130+
})
131+
132+
wormhole.close(
133+
{
134+
to: 'target',
135+
},
136+
true
137+
) // force argument
138+
expect(wormhole.transports).toEqual({ target: [] })
139+
})
140+
103141
it('hasTarget()', function() {
104142
const check1 = wormhole.hasTarget('target')
105143
expect(check1).toBe(false)

types/lib/types.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface Transport {
2222
}
2323
export interface TransportVector {
2424
to: string;
25-
from: string;
25+
from?: string;
2626
}
2727
export declare type PropWithComponent = VueConstructor<Vue> | ComponentOptions<Vue> | string;
2828
export declare type PortalProps = Partial<{

0 commit comments

Comments
 (0)